mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 06:00:33 -04:00
no loading between levels, many improvements in code
This commit is contained in:
parent
77f1700902
commit
a8a87d514c
55 changed files with 628 additions and 763 deletions
33
README.md
33
README.md
|
@ -20,39 +20,16 @@ make all
|
||||||
|
|
||||||
You need original DOS version files (distrubuted on CD) or Windows port files.
|
You need original DOS version files (distrubuted on CD) or Windows port files.
|
||||||
|
|
||||||
You need to create following file in the root of the game folder
|
You need to create or update `skeldal.ini` following file in the root of the game folder
|
||||||
|
|
||||||
**WSKELDAL.INI**
|
The `skeldal.ini` must be at current folder or you can specify config using command line option
|
||||||
|
|
||||||
```
|
```
|
||||||
CESTA_MAPY ./maps/
|
$ ./skeldal
|
||||||
CESTA_MUSIC ./music/
|
$ ./skeldal -f conf/skeldal.ini
|
||||||
CESTA_VIDEO ./video/
|
|
||||||
CESTA_DATA ./
|
|
||||||
CESTA_POZICE ./savegame/
|
|
||||||
CESTA_TEMPY /tmp/
|
|
||||||
vmode 0
|
|
||||||
sound_device 9 0 0 0
|
|
||||||
SOUND_MIXFREQ 44100
|
|
||||||
default_map lespred.map
|
|
||||||
ZOOM_SPEED 8
|
|
||||||
TURN_SPEED 8
|
|
||||||
MUSIC_VOLUME 127
|
|
||||||
SOUND_VOLUME 255
|
|
||||||
PRELOAD 0
|
|
||||||
AUTOSAVE 8
|
|
||||||
WINDOWED 1
|
|
||||||
SKIP_INTRO 8
|
|
||||||
FULLRESVIDEO 0
|
|
||||||
DEBUG 0
|
|
||||||
GAME_SPEED 6
|
|
||||||
BATTLE_ACCEL 0
|
|
||||||
WINDOWEDZOOM 0
|
|
||||||
EXTRAS 0
|
|
||||||
```
|
```
|
||||||
(the final format of the configuration file is subject of change)
|
|
||||||
|
|
||||||
Move to root folder of the original game and run the built binary
|
The documentation of the configuration file is in the file.
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ void psani_poznamek_event(EVENT_MSG *msg,void **data)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
c=va_arg(msg->data, int);
|
c=quit_request_as_escape(va_arg(msg->data, int));
|
||||||
set_font(H_FLITT5,NOSHADOW(0));
|
set_font(H_FLITT5,NOSHADOW(0));
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
|
@ -630,7 +630,7 @@ void *map_keyboard(EVENT_MSG *msg,void **usr)
|
||||||
if (msg->msg==E_AUTOMAP_REDRAW) draw=4;
|
if (msg->msg==E_AUTOMAP_REDRAW) draw=4;
|
||||||
if (msg->msg==E_KEYBOARD)
|
if (msg->msg==E_KEYBOARD)
|
||||||
{
|
{
|
||||||
int d = va_arg(msg->data, int);
|
int d = quit_request_as_escape(va_arg(msg->data, int));
|
||||||
c=d>>8;
|
c=d>>8;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
@ -773,13 +773,13 @@ static void wire_glob_map_control(void)
|
||||||
|
|
||||||
char map_menu(int id,int xa,int ya,int xr,int yr)
|
char map_menu(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
char *s;
|
const char *s;
|
||||||
word *c;
|
const word *c;
|
||||||
|
|
||||||
ya;xa;id;
|
ya;xa;id;
|
||||||
id=set_select_mode(0);
|
id=set_select_mode(0);
|
||||||
s=ablock(H_CHARGENM);
|
s=ablock(H_CHARGENM);
|
||||||
c=ablock(H_CHARGENM);
|
c=(const word *)s;
|
||||||
s+=*c*yr+xr+6;
|
s+=*c*yr+xr+6;
|
||||||
id=*s;
|
id=*s;
|
||||||
if (!id) return 1;
|
if (!id) return 1;
|
||||||
|
@ -897,7 +897,7 @@ void map_teleport_keyboard(EVENT_MSG *msg,void **usr)
|
||||||
{
|
{
|
||||||
usr;
|
usr;
|
||||||
if (msg->msg==E_KEYBOARD) {
|
if (msg->msg==E_KEYBOARD) {
|
||||||
int c = va_arg(msg->data, int);
|
int c = quit_request_as_escape(va_arg(msg->data, int));
|
||||||
switch (c>>8)
|
switch (c>>8)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -287,14 +287,14 @@ word *bott_clear(void)
|
||||||
|
|
||||||
static void draw_small_icone(int num,int x,int y)
|
static void draw_small_icone(int num,int x,int y)
|
||||||
{
|
{
|
||||||
word *pic;
|
const word *pic;
|
||||||
|
|
||||||
pic=ablock(H_POSTUP);
|
pic=ablock(H_POSTUP);
|
||||||
num*=13;x+=num;
|
num*=13;x+=num;
|
||||||
put_textured_bar(pic,x,y,13,13,num,0);
|
put_textured_bar(pic,x,y,13,13,num,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bott_fletna_normal(void **pp,int32_t *s)
|
static const void *bott_fletna_normal(const void *pp, int32_t *s)
|
||||||
{
|
{
|
||||||
word *bott_scr;
|
word *bott_scr;
|
||||||
int i,x;
|
int i,x;
|
||||||
|
@ -307,12 +307,13 @@ static void bott_fletna_normal(void **pp,int32_t *s)
|
||||||
{
|
{
|
||||||
set_aligned_position(x,32,1,1,texty[180+i]);outtext(texty[180+i]);
|
set_aligned_position(x,32,1,1,texty[180+i]);outtext(texty[180+i]);
|
||||||
}
|
}
|
||||||
*pp=GetScreenAdr();
|
void *out=GetScreenAdr();
|
||||||
*s=GetScreenSizeBytes();
|
*s=GetScreenSizeBytes();
|
||||||
RestoreScreen();
|
RestoreScreen();
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bott_draw_normal(void **pp,int32_t *s)
|
static const void *bott_draw_normal(const void *pp, int32_t *s)
|
||||||
{
|
{
|
||||||
int i,j;int x,xs=0,y;
|
int i,j;int x,xs=0,y;
|
||||||
word *bott_scr;
|
word *bott_scr;
|
||||||
|
@ -404,9 +405,10 @@ static void bott_draw_normal(void **pp,int32_t *s)
|
||||||
outtext(s);
|
outtext(s);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
*pp=GetScreenAdr();
|
void *out = GetScreenAdr();
|
||||||
*s=GetScreenSizeBytes();
|
*s=GetScreenSizeBytes();
|
||||||
RestoreScreen();
|
RestoreScreen();
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,7 +422,7 @@ void bott_timer_draw(struct the_timer *q)
|
||||||
bott_timer=NULL;
|
bott_timer=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bott_disp_text_proc(void **pp,int32_t *ss)
|
const void *bott_disp_text_proc(const void *pp, int32_t *ss)
|
||||||
{
|
{
|
||||||
char *p,*text;
|
char *p,*text;
|
||||||
int y=20;
|
int y=20;
|
||||||
|
@ -442,9 +444,10 @@ void bott_disp_text_proc(void **pp,int32_t *ss)
|
||||||
p=strchr(p,0)+1;
|
p=strchr(p,0)+1;
|
||||||
}
|
}
|
||||||
while (p[0]);
|
while (p[0]);
|
||||||
*pp=GetScreenAdr();
|
void *out = GetScreenAdr();
|
||||||
*ss=GetScreenSizeBytes();
|
*ss=GetScreenSizeBytes();
|
||||||
RestoreScreen();
|
RestoreScreen();
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bott_disp_text(const char *text)
|
void bott_disp_text(const char *text)
|
||||||
|
@ -460,7 +463,7 @@ void bott_disp_text(const char *text)
|
||||||
strcpy(bott_text,text);
|
strcpy(bott_text,text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MaskPutPicture(int x, int y, char mask, word color, char blend, void *pic)
|
static void MaskPutPicture(int x, int y, char mask, word color, char blend, const void *pic)
|
||||||
{
|
{
|
||||||
short *info=(short *)pic;
|
short *info=(short *)pic;
|
||||||
char *data=(char *)(info+3+256);
|
char *data=(char *)(info+3+256);
|
||||||
|
@ -479,7 +482,7 @@ static void MaskPutPicture(int x, int y, char mask, word color, char blend, void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void bott_draw_rune(void **pp,int32_t *ss)
|
const void *bott_draw_rune(const void *pp, int32_t *ss)
|
||||||
{
|
{
|
||||||
int sel_zivel=showrune/10;
|
int sel_zivel=showrune/10;
|
||||||
int sel_rune=showrune%10;
|
int sel_rune=showrune%10;
|
||||||
|
@ -504,9 +507,10 @@ void bott_draw_rune(void **pp,int32_t *ss)
|
||||||
position (75,60);
|
position (75,60);
|
||||||
outtext(buff);
|
outtext(buff);
|
||||||
put_picture(70,30,ablock(glob_items[showruneitem].vzhled+face_arr[0]));
|
put_picture(70,30,ablock(glob_items[showruneitem].vzhled+face_arr[0]));
|
||||||
*pp=GetScreenAdr();
|
void *out = GetScreenAdr();
|
||||||
*ss=GetScreenSizeBytes();
|
*ss=GetScreenSizeBytes();
|
||||||
RestoreScreen();
|
RestoreScreen();
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bott_disp_rune(char rune, int item)
|
void bott_disp_rune(char rune, int item)
|
||||||
|
@ -527,14 +531,15 @@ void bott_text_forever()
|
||||||
bott_timer=NULL;
|
bott_timer=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bott_draw_proc(void **p,int32_t *s)
|
const void *bott_draw_proc(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
switch (bott_display)
|
switch (bott_display)
|
||||||
{
|
{
|
||||||
case BOTT_NORMAL:bott_draw_normal(p,s);break;
|
case BOTT_NORMAL:return bott_draw_normal(p,s);break;
|
||||||
case BOTT_TEXT:bott_disp_text_proc(p,s);break;
|
case BOTT_TEXT:return bott_disp_text_proc(p,s);break;
|
||||||
case BOTT_FLETNA:bott_fletna_normal(p,s);break;
|
case BOTT_FLETNA:return bott_fletna_normal(p,s);break;
|
||||||
case BOTT_RUNA:bott_draw_rune(p,s);break;
|
case BOTT_RUNA:return bott_draw_rune(p,s);break;
|
||||||
|
default: return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +567,7 @@ void bott_draw_fletna()
|
||||||
void draw_spell(int handle,int phase,int xicht)
|
void draw_spell(int handle,int phase,int xicht)
|
||||||
{
|
{
|
||||||
int x,y,i;
|
int x,y,i;
|
||||||
word *w;
|
const word *w;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
|
||||||
|
@ -721,9 +726,9 @@ static __inline int toInt( float fval )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *check_autofade(void *image, char ceil, int dark)
|
static const void *check_autofade(const void *image, char ceil, int dark)
|
||||||
{
|
{
|
||||||
char *data=image;
|
const char *data=image;
|
||||||
if (data[5]==0x80)
|
if (data[5]==0x80)
|
||||||
{
|
{
|
||||||
word *xy=(word *)image;
|
word *xy=(word *)image;
|
||||||
|
@ -781,7 +786,7 @@ int draw_basic_floor(int celx,int cely,int sector)
|
||||||
|
|
||||||
static int calc_item_shiftup(TITEM *it)
|
static int calc_item_shiftup(TITEM *it)
|
||||||
{
|
{
|
||||||
short *s;
|
const short *s;
|
||||||
char *c;
|
char *c;
|
||||||
int y,x,xs,ys,t;
|
int y,x,xs,ys,t;
|
||||||
|
|
||||||
|
@ -1098,7 +1103,7 @@ static char set_blind(void) {
|
||||||
|
|
||||||
extern char folow_mode;
|
extern char folow_mode;
|
||||||
|
|
||||||
static void zobraz_lodku(word *lodka, word *screen, int size)
|
static void zobraz_lodku(const word *lodka, word *screen, int size)
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
@ -1193,8 +1198,8 @@ void render_scene(int sector, int smer)
|
||||||
// trace_for_bgr(smer);
|
// trace_for_bgr(smer);
|
||||||
i=VIEW3D_Z-1;
|
i=VIEW3D_Z-1;
|
||||||
s=minimap[i][VIEW3D_X];
|
s=minimap[i][VIEW3D_X];
|
||||||
if (s && !map_sectors[s].ceil) clear_buff(ablock(H_BGR_BUFF),back_color,360);
|
if (s && !map_sectors[s].ceil) clear_buff(ablock_copy(H_BGR_BUFF),back_color,360);
|
||||||
else clear_buff(ablock(H_BGR_BUFF),back_color,80);
|
else clear_buff(ablock_copy(H_BGR_BUFF),back_color,80);
|
||||||
for(i=-VIEW3D_X+1;i<VIEW3D_X;i++)
|
for(i=-VIEW3D_X+1;i<VIEW3D_X;i++)
|
||||||
if ((s=minimap[VIEW3D_Z-1][VIEW3D_X+i])!=0)
|
if ((s=minimap[VIEW3D_Z-1][VIEW3D_X+i])!=0)
|
||||||
if (map_coord[s].flags & MC_SHADING) back_clear(i,0);
|
if (map_coord[s].flags & MC_SHADING) back_clear(i,0);
|
||||||
|
@ -1336,7 +1341,7 @@ static FX_PLAY *fx_data=NULL;
|
||||||
|
|
||||||
void draw_fx()
|
void draw_fx()
|
||||||
{
|
{
|
||||||
word *c;
|
const word *c;
|
||||||
FX_PLAY *fx;
|
FX_PLAY *fx;
|
||||||
FX_PLAY **last;
|
FX_PLAY **last;
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ static void draw_other_bar()
|
||||||
int i;
|
int i;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
word *bbar=ablock(H_BOTTBAR);
|
const word *bbar=ablock(H_BOTTBAR);
|
||||||
word *screen=GetScreenAdr()+(480-102)*scr_linelen2;
|
word *screen=GetScreenAdr()+(480-102)*scr_linelen2;
|
||||||
for (i=0;i<102;i++,screen+=scr_linelen2,bbar+=scr_linelen2) memcpy(screen,bbar,scr_linelen2*2);
|
for (i=0;i<102;i++,screen+=scr_linelen2,bbar+=scr_linelen2) memcpy(screen,bbar,scr_linelen2*2);
|
||||||
//put_8bit_clipped(ablock(H_GEN_OKBUTT),378*640+520+screen,0,120,102);
|
//put_8bit_clipped(ablock(H_GEN_OKBUTT),378*640+520+screen,0,120,102);
|
||||||
|
@ -239,7 +239,7 @@ static void draw_other_bar()
|
||||||
|
|
||||||
static void display_character(THUMAN *p,char i)
|
static void display_character(THUMAN *p,char i)
|
||||||
{
|
{
|
||||||
word *w;
|
const word *w;
|
||||||
put_picture(4,SCREEN_OFFLINE,ablock(H_IOBLOUK));
|
put_picture(4,SCREEN_OFFLINE,ablock(H_IOBLOUK));
|
||||||
if (p->used)
|
if (p->used)
|
||||||
{
|
{
|
||||||
|
@ -277,11 +277,11 @@ static void vypocet_perly(int angle,int xp,int yp,int *x,int *y)
|
||||||
|
|
||||||
static void zobraz_perlu(void)
|
static void zobraz_perlu(void)
|
||||||
{
|
{
|
||||||
word *perla;
|
const word *perla;
|
||||||
int x,y;
|
int x,y;
|
||||||
word *scr,*sss;
|
word *scr,*sss;
|
||||||
char *p;
|
char *p;
|
||||||
word *b;
|
const word *b;
|
||||||
int xs,ys,xxs;
|
int xs,ys,xxs;
|
||||||
|
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -567,7 +567,6 @@ static void def_entries()
|
||||||
|
|
||||||
sprintf(s,CHAR_NAME,i);
|
sprintf(s,CHAR_NAME,i);
|
||||||
def_handle(H_GEN_POSTAVY+i,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
def_handle(H_GEN_POSTAVY+i,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
||||||
apreload(H_GEN_POSTAVY+i);
|
|
||||||
mix_back_sound(0);
|
mix_back_sound(0);
|
||||||
}
|
}
|
||||||
for(i=0;i<MAX_XICHTS;i++)
|
for(i=0;i<MAX_XICHTS;i++)
|
||||||
|
@ -576,14 +575,13 @@ static void def_entries()
|
||||||
|
|
||||||
sprintf(s,XICHT_NAME,i);
|
sprintf(s,XICHT_NAME,i);
|
||||||
def_handle(H_GEN_XICHTY+i,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
def_handle(H_GEN_XICHTY+i,s,pcx_8bit_decomp,SR_BGRAFIKA);
|
||||||
apreload(H_GEN_XICHTY+i);
|
|
||||||
mix_back_sound(0);
|
mix_back_sound(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char go_next_page(int id,int xa,int ya,int xr,int yr)
|
static char go_next_page(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
word *w;
|
const word *w;
|
||||||
char *b;
|
char *b;
|
||||||
|
|
||||||
xa,ya;
|
xa,ya;
|
||||||
|
@ -714,7 +712,7 @@ char potvrzeno(char *text,void (*redraw)(char))
|
||||||
|
|
||||||
static char view_another_click2(int id,int xa,int ya,int xr,int yr)
|
static char view_another_click2(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
short *w;
|
const short *w;
|
||||||
|
|
||||||
id,xa,ya,xr,yr;
|
id,xa,ya,xr,yr;
|
||||||
w=ablock(H_OKNO);
|
w=ablock(H_OKNO);
|
||||||
|
@ -760,21 +758,28 @@ static void enter_reaction(EVENT_MSG *msg,void **unused)
|
||||||
if (msg->msg==E_KEYBOARD)
|
if (msg->msg==E_KEYBOARD)
|
||||||
{
|
{
|
||||||
int c = va_arg(msg->data, int);
|
int c = va_arg(msg->data, int);
|
||||||
if (c==13 && !shut_downing_text)
|
if ((c >> 1) == 1 || c == E_QUIT_GAME_KEY) {
|
||||||
|
gen_exit_editor(2,0,0,0,0);
|
||||||
|
return;
|
||||||
|
} else if ((c & 0xFF)==13 && !shut_downing_text)
|
||||||
{
|
{
|
||||||
send_message(E_KEYBOARD,13);
|
send_message(E_KEYBOARD,13);
|
||||||
bott_draw(1);
|
bott_draw(1);
|
||||||
redraw_generator(1);
|
redraw_generator(1);
|
||||||
msg->msg=-1;
|
msg->msg=-1;
|
||||||
}
|
|
||||||
was_enter=1;
|
was_enter=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void enter_reaction2(EVENT_MSG *msg,void **_)
|
static void enter_reaction2(EVENT_MSG *msg,void **_)
|
||||||
{
|
{
|
||||||
int c = va_arg(msg->data, int);
|
int c = va_arg(msg->data, int);
|
||||||
if (msg->msg==E_KEYBOARD && c==13 && !shut_downing_text && ~b_disables & 0x3)
|
if ((c >> 1) == 1 || c == E_QUIT_GAME_KEY) {
|
||||||
|
gen_exit_editor(1,0,0,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg->msg==E_KEYBOARD && (c & 0xFF)==13 && !shut_downing_text && ~b_disables & 0x3)
|
||||||
{
|
{
|
||||||
send_message(E_KEYBOARD,13);
|
send_message(E_KEYBOARD,13);
|
||||||
bott_draw(1);
|
bott_draw(1);
|
||||||
|
@ -804,6 +809,7 @@ char gen_exit_editor(int id,int xa,int ya,int xr,int yr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
game_display_cancel_quit_request();
|
||||||
if (id==2)redraw_generator(1);
|
if (id==2)redraw_generator(1);
|
||||||
else redraw_svitek(0);
|
else redraw_svitek(0);
|
||||||
edit_name();
|
edit_name();
|
||||||
|
@ -848,10 +854,13 @@ char enter_generator()
|
||||||
{
|
{
|
||||||
send_message(E_ADD,E_KEYBOARD,enter_reaction);
|
send_message(E_ADD,E_KEYBOARD,enter_reaction);
|
||||||
EVENT_MSG *ev= task_wait_event(E_CLOSE_GEN);;
|
EVENT_MSG *ev= task_wait_event(E_CLOSE_GEN);;
|
||||||
i=va_arg(ev->data, int);
|
i=ev?va_arg(ev->data, int):255;
|
||||||
send_message(E_DONE,E_KEYBOARD,enter_reaction);
|
send_message(E_DONE,E_KEYBOARD,enter_reaction);
|
||||||
if (i==3 && potvrzeno(texty[116],redraw_generator)) goto znova;
|
if (i==3 && potvrzeno(texty[116],redraw_generator)) goto znova;
|
||||||
if (i==255) return 1;
|
if (i==255) {
|
||||||
|
term_task(edit_task);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (cur_xicht==-1 || i==3);
|
while (cur_xicht==-1 || i==3);
|
||||||
send_message(E_KEYBOARD,13);
|
send_message(E_KEYBOARD,13);
|
||||||
|
|
|
@ -67,7 +67,7 @@ char clk_touch_vyk(int sector,int side,int xr,int yr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int fc;
|
int fc;
|
||||||
word *w;
|
const word *w;
|
||||||
for(i=0;v->items[i];i++);
|
for(i=0;v->items[i];i++);
|
||||||
if (i==8)
|
if (i==8)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,10 @@ char konec(int id,int xa,int ya,int xr,int yr)
|
||||||
if (cur_mode==MD_ANOTHER_MAP) unwire_proc(),wire_proc();
|
if (cur_mode==MD_ANOTHER_MAP) unwire_proc(),wire_proc();
|
||||||
send_message(E_CLOSE_MAP);
|
send_message(E_CLOSE_MAP);
|
||||||
}
|
}
|
||||||
else wire_proc();
|
else {
|
||||||
|
wire_proc();
|
||||||
|
game_display_cancel_quit_request();
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +237,7 @@ char start_invetory(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
THUMAN *p;
|
THUMAN *p;
|
||||||
int i;
|
int i;
|
||||||
word *xs;
|
const word *xs;
|
||||||
|
|
||||||
id;xa;ya;yr;
|
id;xa;ya;yr;
|
||||||
if (cur_mode==MD_ANOTHER_MAP) unwire_proc(),wire_proc();
|
if (cur_mode==MD_ANOTHER_MAP) unwire_proc(),wire_proc();
|
||||||
|
@ -382,7 +385,7 @@ char empty_clk(int id,int xa,int ya,int xr,int yr) //tato udalost slouzi ke zrus
|
||||||
|
|
||||||
static char sing_song_clk(int id,int xa,int ya,int xr,int yr)
|
static char sing_song_clk(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
char *xadr;
|
const char *xadr;
|
||||||
word *xs;
|
word *xs;
|
||||||
static char playing=0;
|
static char playing=0;
|
||||||
char standardflute=map_sectors[viewsector].sector_type>=S_FLT_SMER &&
|
char standardflute=map_sectors[viewsector].sector_type>=S_FLT_SMER &&
|
||||||
|
|
|
@ -125,16 +125,16 @@ static int glob_y;
|
||||||
|
|
||||||
static int last_pgf;
|
static int last_pgf;
|
||||||
|
|
||||||
static word *paleta;
|
static const word *paleta;
|
||||||
static int32_t loc_anim_render_buffer;
|
static int32_t loc_anim_render_buffer;
|
||||||
static short task_num=-1;
|
static short task_num=-1;
|
||||||
|
|
||||||
void small_anm_buff(void *target,void *buff,void *paleta);
|
void small_anm_buff(void *target,const void *buff,const void *paleta);
|
||||||
//#pragma aux small_anm_buff parm[edi][esi][ebx] modify [eax ecx]
|
//#pragma aux small_anm_buff parm[edi][esi][ebx] modify [eax ecx]
|
||||||
void small_anm_delta(void *target,void *buff,void *paleta);
|
void small_anm_delta(void *target,const void *buff,const void *paleta);
|
||||||
//#pragma aux small_anm_delta parm[edi][esi][ebx] modify [eax ecx]
|
//#pragma aux small_anm_delta parm[edi][esi][ebx] modify [eax ecx]
|
||||||
|
|
||||||
static void animace_kouzla(int act,void *data,int csize)
|
static void animace_kouzla(int act,const void *data,int csize)
|
||||||
{
|
{
|
||||||
word *p=GetScreenAdr()+loc_anim_render_buffer;
|
word *p=GetScreenAdr()+loc_anim_render_buffer;
|
||||||
switch (act)
|
switch (act)
|
||||||
|
@ -154,7 +154,7 @@ static void dialog_anim(va_list args)
|
||||||
int speed=va_arg(args,int);
|
int speed=va_arg(args,int);
|
||||||
int rep=va_arg(args,int);
|
int rep=va_arg(args,int);
|
||||||
|
|
||||||
void *anm;
|
const void *anm;
|
||||||
void *aptr;
|
void *aptr;
|
||||||
char hid;
|
char hid;
|
||||||
int spdc=0,cntr=rep,tm,tm2;
|
int spdc=0,cntr=rep,tm,tm2;
|
||||||
|
@ -235,7 +235,7 @@ static T_PARAGRAPH *find_paragraph(int num)
|
||||||
T_PARAGRAPH *z;
|
T_PARAGRAPH *z;
|
||||||
|
|
||||||
num+=local_pgf;
|
num+=local_pgf;
|
||||||
pp=(int *)ablock(H_DIALOGY_DAT);
|
pp=(int *)ablock_copy(H_DIALOGY_DAT);
|
||||||
pocet=*pp;pp+=2;
|
pocet=*pp;pp+=2;
|
||||||
z=(T_PARAGRAPH *)pp;
|
z=(T_PARAGRAPH *)pp;
|
||||||
for(i=0;i<pocet;i++,z++) if (z->num==(unsigned)num) return z;
|
for(i=0;i<pocet;i++,z++) if (z->num==(unsigned)num) return z;
|
||||||
|
@ -256,7 +256,7 @@ static int find_pgnum(char *pc)
|
||||||
int pocet;
|
int pocet;
|
||||||
int pcc,i;
|
int pcc,i;
|
||||||
|
|
||||||
pp=(int *)ablock(H_DIALOGY_DAT);
|
pp=(int *)ablock_copy(H_DIALOGY_DAT);
|
||||||
pocet=*pp;pp+=2;
|
pocet=*pp;pp+=2;
|
||||||
pcc=pc-(char *)pp-8-sizeof(T_PARAGRAPH)*pocet;
|
pcc=pc-(char *)pp-8-sizeof(T_PARAGRAPH)*pocet;
|
||||||
z=(T_PARAGRAPH *)pp;
|
z=(T_PARAGRAPH *)pp;
|
||||||
|
@ -275,7 +275,7 @@ static void goto_paragraph(int prgf)
|
||||||
if (z->visited) z->first=1;
|
if (z->visited) z->first=1;
|
||||||
if (z->alt==z->num || !z->visited)
|
if (z->alt==z->num || !z->visited)
|
||||||
{
|
{
|
||||||
pc=((char *)ablock(H_DIALOGY_DAT))+*((int *)ablock(H_DIALOGY_DAT))*sizeof(T_PARAGRAPH)+8+z->position;
|
pc=((char *)ablock_copy(H_DIALOGY_DAT))+*((int *)ablock_copy(H_DIALOGY_DAT))*sizeof(T_PARAGRAPH)+8+z->position;
|
||||||
last_pgf=prgf;
|
last_pgf=prgf;
|
||||||
z->visited=1;
|
z->visited=1;
|
||||||
return;
|
return;
|
||||||
|
@ -527,7 +527,7 @@ static int get_last_his_line()
|
||||||
|
|
||||||
static void draw_all()
|
static void draw_all()
|
||||||
{
|
{
|
||||||
void *c;
|
const void *c;
|
||||||
show_desc();
|
show_desc();
|
||||||
if (back_pic_enable) c=back_pic;else c=ablock(H_DIALOG_PIC);
|
if (back_pic_enable) c=back_pic;else c=ablock(H_DIALOG_PIC);
|
||||||
other_draw();
|
other_draw();
|
||||||
|
@ -991,7 +991,7 @@ static char ask_who_proc(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
THUMAN *p;
|
THUMAN *p;
|
||||||
int i;
|
int i;
|
||||||
word *xs;
|
const word *xs;
|
||||||
|
|
||||||
if (id==2)
|
if (id==2)
|
||||||
{
|
{
|
||||||
|
@ -1367,7 +1367,7 @@ char save_dialog_info(TMPFILE_WR *f)
|
||||||
T_PARAGRAPH *q;
|
T_PARAGRAPH *q;
|
||||||
|
|
||||||
SEND_LOG("(DIALOGS)(SAVELOAD) Saving dialogs info...");
|
SEND_LOG("(DIALOGS)(SAVELOAD) Saving dialogs info...");
|
||||||
p=ablock(H_DIALOGY_DAT);
|
p=ablock_copy(H_DIALOGY_DAT);
|
||||||
pgf_pocet=*p;
|
pgf_pocet=*p;
|
||||||
temp_storage_write(&pgf_pocet,1*4,f);
|
temp_storage_write(&pgf_pocet,1*4,f);
|
||||||
siz=(pgf_pocet+3)/4;
|
siz=(pgf_pocet+3)/4;
|
||||||
|
@ -1375,7 +1375,7 @@ char save_dialog_info(TMPFILE_WR *f)
|
||||||
{
|
{
|
||||||
c=getmem(siz);
|
c=getmem(siz);
|
||||||
memset(c,0,siz);
|
memset(c,0,siz);
|
||||||
p=ablock(H_DIALOGY_DAT);
|
p=ablock_copy(H_DIALOGY_DAT);
|
||||||
q=(T_PARAGRAPH *)(p+2);
|
q=(T_PARAGRAPH *)(p+2);
|
||||||
for(i=0;i<pgf_pocet;i++)
|
for(i=0;i<pgf_pocet;i++)
|
||||||
{
|
{
|
||||||
|
@ -1399,7 +1399,7 @@ char load_dialog_info(TMPFILE_RD *f)
|
||||||
T_PARAGRAPH *q;
|
T_PARAGRAPH *q;
|
||||||
|
|
||||||
SEND_LOG("(DIALOGS)(SAVELOAD) Loading dialogs info...");
|
SEND_LOG("(DIALOGS)(SAVELOAD) Loading dialogs info...");
|
||||||
p=ablock(H_DIALOGY_DAT);
|
p=ablock_copy(H_DIALOGY_DAT);
|
||||||
aswap(H_DIALOGY_DAT);
|
aswap(H_DIALOGY_DAT);
|
||||||
temp_storage_read(&pgf_pocet,1*4,f);
|
temp_storage_read(&pgf_pocet,1*4,f);
|
||||||
siz=(pgf_pocet+3)/4;
|
siz=(pgf_pocet+3)/4;
|
||||||
|
@ -1413,7 +1413,7 @@ char load_dialog_info(TMPFILE_RD *f)
|
||||||
{
|
{
|
||||||
c=getmem(siz);
|
c=getmem(siz);
|
||||||
res|=(temp_storage_read(c,1*siz,f)!=siz);
|
res|=(temp_storage_read(c,1*siz,f)!=siz);
|
||||||
p=ablock(H_DIALOGY_DAT);
|
p=ablock_copy(H_DIALOGY_DAT);
|
||||||
q=(T_PARAGRAPH *)(p+2);
|
q=(T_PARAGRAPH *)(p+2);
|
||||||
for(i=0;i<pgf_pocet;i++)
|
for(i=0;i<pgf_pocet;i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,7 +203,7 @@ void init_mobs()
|
||||||
send_message(E_ADD,E_KOUZLO_KOLO,mob_reload);
|
send_message(E_ADD,E_KOUZLO_KOLO,mob_reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register_mob_graphics(int num,char *name_part,char *anims,char *seq)
|
static void register_mob_graphics(int num,char *name_part,const char *anims,const char *seq)
|
||||||
{
|
{
|
||||||
char fulname[14];
|
char fulname[14];
|
||||||
char znaky[]=MOB_ZNAKY;
|
char znaky[]=MOB_ZNAKY;
|
||||||
|
@ -949,9 +949,9 @@ void draw_blood(int zasah,int celx,int cely,int posx,int posy)
|
||||||
draw_placed_texture(ablock(H_MZASAH1+zasah-1),celx,cely,posx+64,posy+64,75,0);
|
draw_placed_texture(ablock(H_MZASAH1+zasah-1),celx,cely,posx+64,posy+64,75,0);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
static void *mob_select_palette(TMOB *p)
|
static const void *mob_select_palette(TMOB *p)
|
||||||
{
|
{
|
||||||
char *palet;
|
const char *palet;
|
||||||
|
|
||||||
palet=ablock(p->cislo_vzoru+6*16+4+monster_block);
|
palet=ablock(p->cislo_vzoru+6*16+4+monster_block);
|
||||||
return palet+(p->palette)*PIC_FADE_PAL_SIZE;
|
return palet+(p->palette)*PIC_FADE_PAL_SIZE;
|
||||||
|
|
|
@ -76,7 +76,7 @@ void scroll_support_64(void *lbuf,void *src1,void *src2,int size1,void *xlat);
|
||||||
//#pragma aux scroll_support_64 parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];
|
//#pragma aux scroll_support_64 parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];
|
||||||
void scroll_support_64b(void *lbuf,void *src1,void *src2,int size1,void *xlat);
|
void scroll_support_64b(void *lbuf,void *src1,void *src2,int size1,void *xlat);
|
||||||
//#pragma aux scroll_support_64b parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];*/
|
//#pragma aux scroll_support_64b parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];*/
|
||||||
void fcdraw(void *source,void *target, void *table);
|
void fcdraw(const void *source,void *target,const void *table);
|
||||||
//#pragma aux fcdraw parm [EDX][EBX][EAX] modify [ECX ESI EDI];
|
//#pragma aux fcdraw parm [EDX][EBX][EAX] modify [ECX ESI EDI];
|
||||||
|
|
||||||
/*void lodka32(void *source,void *target,void *background,void *xlat,int32_t xysize);
|
/*void lodka32(void *source,void *target,void *background,void *xlat,int32_t xysize);
|
||||||
|
@ -451,7 +451,7 @@ void create_zooming(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zooming_forward_backward(word *background,char back)
|
static void zooming_forward_backward(const word *background,char back)
|
||||||
{
|
{
|
||||||
if (!zooming_step) return;
|
if (!zooming_step) return;
|
||||||
{
|
{
|
||||||
|
@ -477,12 +477,12 @@ static void zooming_forward_backward(word *background,char back)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void zooming_forward(word *background)
|
void zooming_forward(const word *background)
|
||||||
{
|
{
|
||||||
zooming_forward_backward(background,0);
|
zooming_forward_backward(background,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zooming_backward(word *background)
|
void zooming_backward(const word *background)
|
||||||
{
|
{
|
||||||
zooming_forward_backward(background,1);
|
zooming_forward_backward(background,1);
|
||||||
}
|
}
|
||||||
|
@ -577,12 +577,13 @@ void turn_right()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_cel(int celx,int cely,void *stena,int xofs,int yofs,char rev)
|
void show_cel(int celx,int cely,const void *stena,int xofs,int yofs,char rev)
|
||||||
{
|
{
|
||||||
T_INFO_X_3D *x3d,*x0d;
|
T_INFO_X_3D *x3d,*x0d;
|
||||||
T_INFO_Y *yd,*yp;
|
T_INFO_Y *yd,*yp;
|
||||||
int txtsx,txtsy,realsx,realsy,x,i,yss,ysd;
|
int txtsx,txtsy,realsx,realsy,x,i,yss,ysd;
|
||||||
char *p;int plac;
|
const char *p;
|
||||||
|
int plac;
|
||||||
|
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
@ -649,12 +650,13 @@ void show_cel(int celx,int cely,void *stena,int xofs,int yofs,char rev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void show_cel2(int celx,int cely,void *stena,int xofs,int yofs,char rev)
|
void show_cel2(int celx,int cely,const void *stena,int xofs,int yofs,char rev)
|
||||||
{
|
{
|
||||||
T_INFO_X *x3d;
|
T_INFO_X *x3d;
|
||||||
T_INFO_Y *yd;
|
T_INFO_Y *yd;
|
||||||
int txtsx,txtsy,realsx,realsy,x,i;
|
int txtsx,txtsy,realsx,realsy,x,i;
|
||||||
char *p;int plac;
|
const char *p;
|
||||||
|
int plac;
|
||||||
|
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
@ -716,7 +718,7 @@ void show_cel2(int celx,int cely,void *stena,int xofs,int yofs,char rev)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void draw_floor_ceil(int celx,int cely,char f_c,void *txtr)
|
void draw_floor_ceil(int celx,int cely,char f_c,const void *txtr)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
|
@ -1051,7 +1053,7 @@ void map_pos(int celx,int cely,int posx,int posy,int posz,int *x,int *y)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int items_indextab[][2]={{0,0},{-1,3},{1,7},{-1,7},{1,10},{-1,10},{0,10},{-2,15}};
|
static int items_indextab[][2]={{0,0},{-1,3},{1,7},{-1,7},{1,10},{-1,10},{0,10},{-2,15}};
|
||||||
void draw_item(int celx,int cely,int posx,int posy,short *txtr,int index)
|
void draw_item(int celx,int cely,int posx,int posy,const short *txtr,int index)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
int clipl,clipr;
|
int clipl,clipr;
|
||||||
|
@ -1076,10 +1078,10 @@ void draw_item(int celx,int cely,int posx,int posy,short *txtr,int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void put_textured_bar(void *src,int x,int y,int xs,int ys,int xofs,int yofs)
|
void put_textured_bar(const void *src,int x,int y,int xs,int ys,int xofs,int yofs)
|
||||||
{
|
{
|
||||||
word *pos;
|
word *pos;
|
||||||
word *xy;
|
const word *xy;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1092,7 +1094,7 @@ void put_textured_bar(void *src,int x,int y,int xs,int ys,int xofs,int yofs)
|
||||||
put_textured_bar_(src,pos,xs,ys,xofs,yofs);
|
put_textured_bar_(src,pos,xs,ys,xofs,yofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_placed_texture(short *txtr,int celx,int cely,int posx,int posy,int posz,char turn)
|
void draw_placed_texture(const short *txtr,int celx,int cely,int posx,int posy,int posz,char turn)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
int clipl,clipr;
|
int clipl,clipr;
|
||||||
|
@ -1295,7 +1297,7 @@ void draw_enemy(DRW_ENEMY *drw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_player(short *txtr,int celx,int cely,int posx,int posy,int adjust,char *name)
|
void draw_player( const short *txtr,int celx,int cely,int posx,int posy,int adjust, const char *name)
|
||||||
{
|
{
|
||||||
int x,y,yc,lx,sd;
|
int x,y,yc,lx,sd;
|
||||||
int clipl,clipr;
|
int clipl,clipr;
|
||||||
|
@ -1330,7 +1332,7 @@ void draw_player(short *txtr,int celx,int cely,int posx,int posy,int adjust,char
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_spectxtr(short *txtr,int celx,int cely,int xpos)
|
void draw_spectxtr(const short *txtr,int celx,int cely,int xpos)
|
||||||
{
|
{
|
||||||
int x,y,clipl,clipr;
|
int x,y,clipl,clipr;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -1349,7 +1351,7 @@ void draw_spectxtr(short *txtr,int celx,int cely,int xpos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_item2(int celx,int cely,int xpos,int ypos,void *txtr,int index)
|
void draw_item2(int celx,int cely,int xpos,int ypos, const void *txtr,int index)
|
||||||
{
|
{
|
||||||
int x,y,xs,ys,abc,asc,clipl,clipr;
|
int x,y,xs,ys,abc,asc,clipl,clipr;
|
||||||
static int indextab[][2]={{0,0},{0,1},{1,0},{-1,0},{1,2},{-1,1},{-2,1},{2,1}};
|
static int indextab[][2]={{0,0},{0,1},{1,0},{-1,0},{1,2},{-1,1},{-2,1},{2,1}};
|
||||||
|
@ -1441,7 +1443,7 @@ void set_backgrnd_mode(int mode)
|
||||||
backgrnd_mode=mode;
|
backgrnd_mode=mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_item_top(int celx,int cely,int posx,int posy,word *txtr,int index)
|
int get_item_top(int celx,int cely,int posx,int posy,const word *txtr,int index)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
int randx,randy;
|
int randx,randy;
|
||||||
|
|
|
@ -28,19 +28,19 @@
|
||||||
|
|
||||||
|
|
||||||
void general_engine_init(void);
|
void general_engine_init(void);
|
||||||
void draw_floor_ceil(int celx,int cely,char f_c,void *txtr);
|
void draw_floor_ceil(int celx,int cely,char f_c,const void *txtr);
|
||||||
void show_cel2(int celx,int cely,void *stena,int xofs,int yofs,char rev);
|
void show_cel2(int celx,int cely,const void *stena,int xofs,int yofs,char rev);
|
||||||
//zobrazi primou stenu ktera lezi pred nebo napravo od pozorovatele
|
//zobrazi primou stenu ktera lezi pred nebo napravo od pozorovatele
|
||||||
void show_cel(int celx,int cely,void *stena,int xofs,int yofs,char rev);
|
void show_cel(int celx,int cely,const void *stena,int xofs,int yofs,char rev);
|
||||||
void turn_left(void);
|
void turn_left(void);
|
||||||
void turn_right(void);
|
void turn_right(void);
|
||||||
void zooming_backward(word *background);
|
void zooming_backward(const word *background);
|
||||||
void zooming_forward(word *background);
|
void zooming_forward(const word *background);
|
||||||
void OutBuffer2nd(void);
|
void OutBuffer2nd(void);
|
||||||
void CopyBuffer2nd(void);
|
void CopyBuffer2nd(void);
|
||||||
void report_mode(int);
|
void report_mode(int);
|
||||||
void draw_item(int celx,int cely,int posx,int posy,short *pic,int index);
|
void draw_item(int celx,int cely,int posx,int posy,const short *pic,int index);
|
||||||
void draw_item2(int celx,int cely,int xpos,int ypos,void *texture,int index);
|
void draw_item2(int celx,int cely,int xpos,int ypos,const void *texture,int index);
|
||||||
//void textmode_effekt(void);
|
//void textmode_effekt(void);
|
||||||
//#pragma aux textmode_effekt modify[eax ebx ecx edx edi];
|
//#pragma aux textmode_effekt modify[eax ebx ecx edx edi];
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ void clear_buff(word *background,word backcolor,int lines);
|
||||||
|
|
||||||
typedef struct zoominfo
|
typedef struct zoominfo
|
||||||
{
|
{
|
||||||
void *startptr, *texture;
|
void *startptr;
|
||||||
|
const void *texture;
|
||||||
int32_t texture_line,line_len;
|
int32_t texture_line,line_len;
|
||||||
int32_t *xtable;
|
int32_t *xtable;
|
||||||
short *ytable;
|
short *ytable;
|
||||||
|
@ -122,41 +123,41 @@ typedef short palette_t[256];
|
||||||
|
|
||||||
typedef struct drw_enemy_struct
|
typedef struct drw_enemy_struct
|
||||||
{
|
{
|
||||||
void *txtr;
|
const void *txtr;
|
||||||
int celx,cely,posx,posy,adjust,shiftup,num;
|
int celx,cely,posx,posy,adjust,shiftup,num;
|
||||||
char mirror;
|
char mirror;
|
||||||
char stoned;
|
char stoned;
|
||||||
palette_t *palette;
|
const palette_t *palette;
|
||||||
}DRW_ENEMY;
|
}DRW_ENEMY;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void enemy_draw(void *src,void *trg,int shade,int scale,int maxspace,int clip);
|
void enemy_draw(const void *src,void *trg,int shade,int scale,int maxspace,int clip);
|
||||||
//#pragma aux enemy_draw parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
void enemy_draw_transp(void *src,void *trg,void *shade,int scale,int maxspace,int clip);
|
void enemy_draw_transp(const void *src,void *trg, const void *shade,int scale,int maxspace,int clip);
|
||||||
//#pragma aux enemy_draw_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
void enemy_draw_mirror_transp(void *src,void *trg,void *shade,int scale,int maxspace,int clip);
|
void enemy_draw_mirror_transp(const void *src,void *trg, const void *shade,int scale,int maxspace,int clip);
|
||||||
//#pragma aux enemy_draw_mirror_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_mirror_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
void enemy_draw_mirror(void *src,void *trg,int shade,int scale,int maxspace,int clip);
|
void enemy_draw_mirror(const void *src,void *trg,int shade,int scale,int maxspace,int clip);
|
||||||
//#pragma aux enemy_draw_mirror parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_mirror parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
//clip je v poradi vpravo - vlevo (HiLo)
|
//clip je v poradi vpravo - vlevo (HiLo)
|
||||||
|
|
||||||
void draw_enemy(DRW_ENEMY *drw);
|
void draw_enemy(DRW_ENEMY *drw);
|
||||||
void draw_player(short *txtr,int celx,int cely,int posx,int posy,int adjust,char *name);
|
void draw_player(const short *txtr,int celx,int cely,int posx,int posy,int adjust, const char *name);
|
||||||
|
|
||||||
void set_lclip_rclip(int celx,int cely,int lc,int rc);
|
void set_lclip_rclip(int celx,int cely,int lc,int rc);
|
||||||
void draw_spectxtr(short *txtr,int celx,int cely,int xpos);
|
void draw_spectxtr(const short *txtr,int celx,int cely,int xpos);
|
||||||
|
|
||||||
int turn_speed(int turnspeed); //oba je nutne volat na zacatku
|
int turn_speed(int turnspeed); //oba je nutne volat na zacatku
|
||||||
int zoom_speed(int zoomspeed);
|
int zoom_speed(int zoomspeed);
|
||||||
|
|
||||||
void scroll_and_copy(void *pic,void *slide, void *scr, int size,int shift, void *lineinfo);
|
void scroll_and_copy(const void *pic,void *slide, void *scr, int size,int shift, void *lineinfo);
|
||||||
//#pragma aux scroll_and_copy parm[esi][ebx][edi][ecx][edx][eax]
|
//#pragma aux scroll_and_copy parm[esi][ebx][edi][ecx][edx][eax]
|
||||||
|
|
||||||
void set_backgrnd_mode(int mode);
|
void set_backgrnd_mode(int mode);
|
||||||
|
|
||||||
int get_item_top(int celx,int cely,int posx,int posy,word *txtr,int index);
|
int get_item_top(int celx,int cely,int posx,int posy,const word *txtr,int index);
|
||||||
//vraci nejnizsi souradnici y predmetu leziciho na zemi v celx, cely na pozici posx,posy;
|
//vraci nejnizsi souradnici y predmetu leziciho na zemi v celx, cely na pozici posx,posy;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -155,7 +155,7 @@ skpskp: add edx,2 ;dalsi hodnota v tabulce
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fcdraw(void *source,void *target, void *table)
|
void fcdraw(const void *source,void *target, const void *table)
|
||||||
//#pragma aux fcdraw parm [EDX][EBX][EAX] modify [ECX ESI EDI];
|
//#pragma aux fcdraw parm [EDX][EBX][EAX] modify [ECX ESI EDI];
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ shmad4: add edi,scr_linelen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void scroll_and_copy(void *pic,void *slide, void *scr, int _size,int shift, void *lineinfo)
|
void scroll_and_copy(const void *pic,void *slide, void *scr, int _size,int shift, void *lineinfo)
|
||||||
//#pragma aux scroll_and_copy parm[esi][ebx][edi][ecx][edx][eax]
|
//#pragma aux scroll_and_copy parm[esi][ebx][edi][ecx][edx][eax]
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -570,7 +570,7 @@ sac_end:sub ecx,2 ;odecti counter
|
||||||
#define ed_stk1 600*4
|
#define ed_stk1 600*4
|
||||||
|
|
||||||
|
|
||||||
void enemy_draw(void *src,void *trg,int shade,int scale,int maxspace,int clip)
|
void enemy_draw(const void *src,void *trg,int shade,int scale,int maxspace,int clip)
|
||||||
//#pragma aux enemy_draw parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -756,7 +756,7 @@ ed_err: add esp,ed_stack;vymaz tabulku
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
void enemy_draw_transp(void *src,void *trg,void *shade,int scale,int maxspace,int clip)
|
void enemy_draw_transp(const void *src,void *trg,const void *shade,int scale,int maxspace,int clip)
|
||||||
//#pragma aux enemy_draw_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@ et_err: add esp,ed_stack;vymaz tabulku
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void enemy_draw_mirror_transp(void *src,void *trg,void *shade,int scale,int maxspace,int clip)
|
void enemy_draw_mirror_transp(const void *src,void *trg,const void *shade,int scale,int maxspace,int clip)
|
||||||
//#pragma aux enemy_draw_mirror_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_mirror_transp parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ etmerr: add esp,ed_stack;vymaz tabulku
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
void enemy_draw_mirror(void *src,void *trg,int shade,int scale,int maxspace,int clip)
|
void enemy_draw_mirror(const void *src,void *trg,int shade,int scale,int maxspace,int clip)
|
||||||
//#pragma aux enemy_draw_mirror parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
//#pragma aux enemy_draw_mirror parm[ESI][EDI][EBX][EDX][EAX][ECX]
|
||||||
//clip je v poradi vpravo - vlevo (HiLo)
|
//clip je v poradi vpravo - vlevo (HiLo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1358,7 +1358,7 @@ static void saveload_keyboard(EVENT_MSG *msg,void **_)
|
||||||
{
|
{
|
||||||
if (msg->msg == E_KEYBOARD)
|
if (msg->msg == E_KEYBOARD)
|
||||||
{
|
{
|
||||||
int v = va_arg(msg->data, int);
|
int v = quit_request_as_escape(va_arg(msg->data, int));
|
||||||
switch (v>>8)
|
switch (v>>8)
|
||||||
{
|
{
|
||||||
case 1:unwire_proc();wire_proc();break;
|
case 1:unwire_proc();wire_proc();break;
|
||||||
|
@ -1377,6 +1377,7 @@ static void saveload_keyboard(EVENT_MSG *msg,void **_)
|
||||||
|
|
||||||
void unwire_save_load()
|
void unwire_save_load()
|
||||||
{
|
{
|
||||||
|
term_task_wait(clk_ask_name[0].id);
|
||||||
if (back_texture!=NULL) free(back_texture);
|
if (back_texture!=NULL) free(back_texture);
|
||||||
back_texture=NULL;
|
back_texture=NULL;
|
||||||
if (story_text!=NULL)release_list(story_text);
|
if (story_text!=NULL)release_list(story_text);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <libs/memman.h>
|
||||||
|
|
||||||
#define POCET_POSTAV 6
|
#define POCET_POSTAV 6
|
||||||
#define HODINA 360
|
#define HODINA 360
|
||||||
|
@ -470,7 +471,7 @@ typedef struct tdregisters
|
||||||
{
|
{
|
||||||
int h_num;
|
int h_num;
|
||||||
char name[13];
|
char name[13];
|
||||||
void (*proc)(void **,int32_t *);
|
ABLOCK_DECODEPROC proc;
|
||||||
char path;
|
char path;
|
||||||
}TDREGISTERS;
|
}TDREGISTERS;
|
||||||
|
|
||||||
|
@ -646,17 +647,17 @@ void calc_animations(void);
|
||||||
int load_map(char *filename);
|
int load_map(char *filename);
|
||||||
void other_draw(void);
|
void other_draw(void);
|
||||||
void refresh_scene(void);
|
void refresh_scene(void);
|
||||||
void pcx_fade_decomp(void **p,int32_t *s);
|
const void *pcx_fade_decomp(const void *p, int32_t *s);
|
||||||
void pcx_15bit_decomp(void **p,int32_t *s);
|
const void *pcx_15bit_decomp(const void *p, int32_t *s);
|
||||||
void pcx_15bit_autofade(void **p,int32_t *s);
|
const void *pcx_15bit_autofade(const void *p, int32_t *s);
|
||||||
void pcx_15bit_backgrnd(void **p,int32_t *s);
|
const void *pcx_15bit_backgrnd(const void *p, int32_t *s);
|
||||||
void pcx_8bit_decomp(void **p,int32_t *s);
|
const void *pcx_8bit_decomp(const void *p, int32_t *s);
|
||||||
void hi_8bit_correct(void **p,int32_t *s);
|
const void *hi_8bit_correct(const void *p, int32_t *s);
|
||||||
void pcx_8bit_nopal(void **p,int32_t *s);
|
const void *pcx_8bit_nopal(const void *p, int32_t *s);
|
||||||
void set_background(void **p,int32_t *s);
|
const void *set_background(const void *p, int32_t *s);
|
||||||
void wav_load(void **p,int32_t *s);
|
const void *wav_load(const void *p, int32_t *s);
|
||||||
void load_mob_legacy_format(void **p, int32_t *s);
|
const void *load_mob_legacy_format(const void *p, int32_t *s);
|
||||||
void load_spells_legacy_format(void **p, int32_t *s);
|
const void *load_spells_legacy_format(const void *p, int32_t *s);
|
||||||
void wire_main_functs(void);
|
void wire_main_functs(void);
|
||||||
void ukaz_kompas(char mode);
|
void ukaz_kompas(char mode);
|
||||||
void *timming(EVENT_MSG *msg,void **data);
|
void *timming(EVENT_MSG *msg,void **data);
|
||||||
|
@ -669,8 +670,7 @@ void objekty_mimo(void);
|
||||||
void mouse_set_cursor(int cursor);
|
void mouse_set_cursor(int cursor);
|
||||||
void set_font(int font,int c1,...);
|
void set_font(int font,int c1,...);
|
||||||
void bott_draw(char);
|
void bott_draw(char);
|
||||||
void bott_draw_proc(void **p,int32_t *s);
|
const void *bott_draw_proc(const void *p, int32_t *s);
|
||||||
THE_TIMER *add_to_timer(int id,int delay,int maxcall,void *proc);
|
|
||||||
void mouse_set_default(int cursor);
|
void mouse_set_default(int cursor);
|
||||||
void create_frame(int x,int y,int xs,int ys,char clear);
|
void create_frame(int x,int y,int xs,int ys,char clear);
|
||||||
void save_dump(const uint16_t *screen_addr,
|
void save_dump(const uint16_t *screen_addr,
|
||||||
|
@ -993,7 +993,7 @@ void calc_fly(void);
|
||||||
void zmen_skupinu(THUMAN *p);
|
void zmen_skupinu(THUMAN *p);
|
||||||
void add_to_group(int num);
|
void add_to_group(int num);
|
||||||
void group_all(void);
|
void group_all(void);
|
||||||
void build_items_called(void **p,int32_t *s);
|
const void *build_items_called(const void *p, int32_t *s);
|
||||||
void real_regeneration(void); //regenerace postav behem hry v realu (pouze kondice a mana)
|
void real_regeneration(void); //regenerace postav behem hry v realu (pouze kondice a mana)
|
||||||
char sleep_regenerace(THUMAN *p); //regenerace postav behem spani
|
char sleep_regenerace(THUMAN *p); //regenerace postav behem spani
|
||||||
char check_jidlo_voda(THUMAN *p);
|
char check_jidlo_voda(THUMAN *p);
|
||||||
|
@ -1666,7 +1666,7 @@ int message(int butts,char def,char canc,char *keys,...);
|
||||||
void type_text(EVENT_MSG *msg,void **data); //event procedura (parms: X,Y,TEXT,MAX_SPACE,MAX_CHARS);
|
void type_text(EVENT_MSG *msg,void **data); //event procedura (parms: X,Y,TEXT,MAX_SPACE,MAX_CHARS);
|
||||||
void type_text_v2(va_list args);//char *text_buffer,int x,int y,int max_size,int max_chars,int font,int color,void (*exit_proc)(char));
|
void type_text_v2(va_list args);//char *text_buffer,int x,int y,int max_size,int max_chars,int font,int color,void (*exit_proc)(char));
|
||||||
void zalamovani(char *source,char *target,int maxxs,int *xs,int *ys);
|
void zalamovani(char *source,char *target,int maxxs,int *xs,int *ys);
|
||||||
void col_load(void **data,int32_t *size);
|
const void *col_load(const void *data, int32_t *size);
|
||||||
void open_story_file(void);
|
void open_story_file(void);
|
||||||
void write_story_text(char *text);
|
void write_story_text(char *text);
|
||||||
void close_story_file(void);
|
void close_story_file(void);
|
||||||
|
@ -1781,5 +1781,9 @@ static __inline char TimerEvents(int sector, int side, int32_t time)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline int quit_request_as_escape(int c) {
|
||||||
|
if (c == E_QUIT_GAME_KEY) return 0x011B;else return c;
|
||||||
|
}
|
||||||
|
|
||||||
//extras
|
//extras
|
||||||
#include "extras.h"
|
#include "extras.h"
|
||||||
|
|
|
@ -507,7 +507,7 @@ void global_map_point(EVENT_MSG *msg,void **_)
|
||||||
if(msg->msg == E_MOUSE)
|
if(msg->msg == E_MOUSE)
|
||||||
{
|
{
|
||||||
int x,y,i,xs,ys;
|
int x,y,i,xs,ys;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
ms=get_mouse(msg);
|
ms=get_mouse(msg);
|
||||||
if (ms->event_type & 0x1)
|
if (ms->event_type & 0x1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -429,8 +429,7 @@ void type_text_v2(va_list args)
|
||||||
showview(x,y,xs,ys);
|
showview(x,y,xs,ys);
|
||||||
|
|
||||||
EVENT_MSG *ev= task_wait_event(E_KEYBOARD); //proces bude cekat na klavesu
|
EVENT_MSG *ev= task_wait_event(E_KEYBOARD); //proces bude cekat na klavesu
|
||||||
if (ev == NULL) return;
|
znak=ev?va_arg(ev->data, int):27;
|
||||||
znak=va_arg(ev->data, int);
|
|
||||||
schovej_mysku();
|
schovej_mysku();
|
||||||
if (task_quitmsg()==1) znak=27;
|
if (task_quitmsg()==1) znak=27;
|
||||||
switch(znak & 0xff)
|
switch(znak & 0xff)
|
||||||
|
@ -507,21 +506,22 @@ void type_text_v2(va_list args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void col_load(void **data,int32_t *size)
|
const void *col_load(const void *data, int32_t *size)
|
||||||
{
|
{
|
||||||
int siz=*size;
|
int siz=*size;
|
||||||
char *s,*c;
|
char *s;
|
||||||
|
const char *c;
|
||||||
int palcount;
|
int palcount;
|
||||||
int i;//,j,k;
|
int i;//,j,k;
|
||||||
|
|
||||||
palcount=siz/COL_SIZE;
|
palcount=siz/COL_SIZE;
|
||||||
*size=PIC_FADE_PAL_SIZE*palcount;
|
*size=PIC_FADE_PAL_SIZE*palcount;
|
||||||
s=getmem(*size);
|
s=getmem(*size);
|
||||||
c=*data;c+=8;
|
c=data;c+=8;
|
||||||
for(i=0;i<palcount;i++,c+=COL_SIZE)
|
for(i=0;i<palcount;i++,c+=COL_SIZE) {
|
||||||
palette_shadow(c,(void *)(&s[i*PIC_FADE_PAL_SIZE]),mglob.fade_r,mglob.fade_g,mglob.fade_b);
|
palette_shadow(c,(void *)(&s[i*PIC_FADE_PAL_SIZE]),mglob.fade_r,mglob.fade_g,mglob.fade_b);
|
||||||
free(*data);
|
}
|
||||||
*data=s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ void check_number_1phase(char *exename) //check serial number!
|
||||||
*/
|
*/
|
||||||
static void skeldal_checkbox_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
static void skeldal_checkbox_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
||||||
{
|
{
|
||||||
word *obr;
|
const word *obr;
|
||||||
char *data;
|
char *data;
|
||||||
int phase;
|
int phase;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -1006,7 +1006,7 @@ static void setup_button_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
||||||
char data;
|
char data;
|
||||||
void **z;
|
void **z;
|
||||||
word *pic;
|
word *pic;
|
||||||
word *bb;
|
const word *bb;
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
z=(void **)o->userptr;
|
z=(void **)o->userptr;
|
||||||
|
@ -1088,7 +1088,7 @@ static void skeldal_soupak_draw (int x1,int y1,int x2,int y2,OBJREC *o)
|
||||||
skeldal_soupak_params *z;
|
skeldal_soupak_params *z;
|
||||||
int rozsah;
|
int rozsah;
|
||||||
int value;
|
int value;
|
||||||
word *pic;
|
const word *pic;
|
||||||
word *back;
|
word *back;
|
||||||
int total;
|
int total;
|
||||||
int xpos;
|
int xpos;
|
||||||
|
@ -1120,7 +1120,7 @@ static void skeldal_soupak_event(EVENT_MSG *msg,OBJREC *o)
|
||||||
skeldal_soupak_params *z;
|
skeldal_soupak_params *z;
|
||||||
int rozsah;
|
int rozsah;
|
||||||
int total;
|
int total;
|
||||||
word *pic;
|
const word *pic;
|
||||||
int ypos,newvalue;
|
int ypos,newvalue;
|
||||||
|
|
||||||
ms=get_mouse(msg);
|
ms=get_mouse(msg);
|
||||||
|
|
36
game/inv.c
36
game/inv.c
|
@ -109,7 +109,7 @@ void zkontroluj_postavu();
|
||||||
|
|
||||||
void place_human_item(word *obrazek,int x,int y,int item)
|
void place_human_item(word *obrazek,int x,int y,int item)
|
||||||
{
|
{
|
||||||
word *p;
|
const word *p;
|
||||||
|
|
||||||
p=ablock(item);
|
p=ablock(item);
|
||||||
put_picture2picture(p,obrazek,PO_XSS-p[0]/2+x,PO_YS-p[1]-y-20);
|
put_picture2picture(p,obrazek,PO_XSS-p[0]/2+x,PO_YS-p[1]-y-20);
|
||||||
|
@ -143,22 +143,25 @@ void item_sound_event(int item,int sector)
|
||||||
play_sample_at_sector(glob_items[item].sound+sound_handle,viewsector,sector,0,0);
|
play_sample_at_sector(glob_items[item].sound+sound_handle,viewsector,sector,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void items_15to16_correct(void **p,int32_t *s)
|
static const void *items_15to16_correct(const void *p,int32_t *s)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
char *cur=(char *)(*p);
|
void *np = getmem(*s);
|
||||||
|
memcpy(np, p, *s);
|
||||||
|
char *cur=(char *)(np);
|
||||||
for (i=0;i<IT_LIB_SIZE;i++)
|
for (i=0;i<IT_LIB_SIZE;i++)
|
||||||
{
|
{
|
||||||
int pos=IT_ICONE_SIZE*i;
|
int pos=IT_ICONE_SIZE*i;
|
||||||
word *pal;
|
word *pal;
|
||||||
|
|
||||||
if (pos>=*s) return;
|
if (pos>=*s) return np;
|
||||||
pal=((word *)(cur+pos))+3;
|
pal=((word *)(cur+pos))+3;
|
||||||
for (j=0;j<256;j++,pal++)
|
for (j=0;j<256;j++,pal++)
|
||||||
{
|
{
|
||||||
*pal=RGB555(*pal>>10,(*pal>>5)& 0x1F,(*pal & 0x1F));
|
*pal=RGB555(*pal>>10,(*pal>>5)& 0x1F,(*pal & 0x1F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_items()
|
void load_items()
|
||||||
|
@ -870,7 +873,8 @@ char exit_inv(int id,int xa,int ya,int xr,int yr)
|
||||||
void definuj_postavy()
|
void definuj_postavy()
|
||||||
{
|
{
|
||||||
int i,num1,r,inv=0,z;
|
int i,num1,r,inv=0,z;
|
||||||
char *c,*end,cc;
|
const char *c,*end;
|
||||||
|
char cc;
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
c=ablock(H_POSTAVY_DAT);
|
c=ablock(H_POSTAVY_DAT);
|
||||||
|
@ -1128,7 +1132,7 @@ void display_items_in_inv(THUMAN *h)
|
||||||
short *p;
|
short *p;
|
||||||
|
|
||||||
put_picture(266,TOP_OFS,ablock(H_IDESKA));
|
put_picture(266,TOP_OFS,ablock(H_IDESKA));
|
||||||
p=ablock(H_IMRIZ1);
|
p=ablock_copy(H_IMRIZ1);
|
||||||
p[1]=INV_YS*((h->inv_size-1)/6)+58;
|
p[1]=INV_YS*((h->inv_size-1)/6)+58;
|
||||||
put_picture(INV_X,INV_Y,p);
|
put_picture(INV_X,INV_Y,p);
|
||||||
xr=INV_X;x=0;
|
xr=INV_X;x=0;
|
||||||
|
@ -1176,7 +1180,8 @@ void display_rings()
|
||||||
void *build_items_wearing(THUMAN *h, int32_t *s)
|
void *build_items_wearing(THUMAN *h, int32_t *s)
|
||||||
{
|
{
|
||||||
int i,vzhled,it;
|
int i,vzhled,it;
|
||||||
word *p,hx,hy;
|
const word *p;
|
||||||
|
word hx,hy;
|
||||||
word *ob;
|
word *ob;
|
||||||
size_t siz;
|
size_t siz;
|
||||||
char *pp;
|
char *pp;
|
||||||
|
@ -1224,9 +1229,9 @@ void *build_items_wearing(THUMAN *h, int32_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void build_items_called(void **p,int32_t *s)
|
const void *build_items_called(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
*p=build_items_wearing(&postavy[memman_handle-H_POSTAVY], s);
|
return build_items_wearing(&postavy[memman_handle-H_POSTAVY], s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_items_wearing(THUMAN *h)
|
void display_items_wearing(THUMAN *h)
|
||||||
|
@ -1240,7 +1245,7 @@ void display_items_wearing(THUMAN *h)
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
TITEM *itt;
|
TITEM *itt;
|
||||||
word *w;int vzhled;
|
const word *w;int vzhled;
|
||||||
|
|
||||||
itt=&glob_items[it-1];
|
itt=&glob_items[it-1];
|
||||||
vzhled=itt->vzhled;
|
vzhled=itt->vzhled;
|
||||||
|
@ -1860,7 +1865,7 @@ char bag_click(int id,int xa,int ya,int xr,int yr)
|
||||||
char item_pointed(int k,int x,int y,short item,short kind)
|
char item_pointed(int k,int x,int y,short item,short kind)
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2,xs,ys,xsiz,ysiz,i;
|
int x1,y1,x2,y2,xs,ys,xsiz,ysiz,i;
|
||||||
short *p;
|
const short *p;
|
||||||
char *c,cc;
|
char *c,cc;
|
||||||
|
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
@ -2166,7 +2171,7 @@ void *inv_keyboard(EVENT_MSG *msg,void **usr)
|
||||||
usr;
|
usr;
|
||||||
if (msg->msg==E_KEYBOARD)
|
if (msg->msg==E_KEYBOARD)
|
||||||
{
|
{
|
||||||
c=va_arg(msg->data, int)>>8;
|
c=quit_request_as_escape(va_arg(msg->data, int))>>8;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 0x17:
|
case 0x17:
|
||||||
|
@ -2212,7 +2217,8 @@ void draw_fly_items(int celx,int cely,int sector,int side)
|
||||||
{
|
{
|
||||||
LETICI_VEC *p;
|
LETICI_VEC *p;
|
||||||
int xpos,ypos;
|
int xpos,ypos;
|
||||||
short *pic,picnum;char turn,smr;
|
const short *pic;
|
||||||
|
short picnum;char turn,smr;
|
||||||
TITEM *it;
|
TITEM *it;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2692,7 +2698,7 @@ static void block_back()
|
||||||
|
|
||||||
static void redraw_keepers_items()
|
static void redraw_keepers_items()
|
||||||
{
|
{
|
||||||
word *w;
|
const word *w;
|
||||||
schovej_mysku();
|
schovej_mysku();
|
||||||
w=ablock(H_SHOP_PIC);
|
w=ablock(H_SHOP_PIC);
|
||||||
display_keepers_items();
|
display_keepers_items();
|
||||||
|
@ -2934,7 +2940,7 @@ void enter_shop(int shopid)
|
||||||
|
|
||||||
char shop_change_player(int id, int xa, int ya,int xr,int yr)
|
char shop_change_player(int id, int xa, int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
word *xs;
|
const word *xs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
id;xa;ya;yr;
|
id;xa;ya;yr;
|
||||||
|
|
|
@ -337,7 +337,7 @@ static int get_data_handle(char *filename,void *dec)
|
||||||
static void insert_picture(char *filename,int align,int line,int lsize)
|
static void insert_picture(char *filename,int align,int line,int lsize)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
short *psiz;
|
const short *psiz;
|
||||||
char *c=write_buff;
|
char *c=write_buff;
|
||||||
|
|
||||||
psiz=ablock(get_data_handle(filename,pcx_8bit_decomp));
|
psiz=ablock(get_data_handle(filename,pcx_8bit_decomp));
|
||||||
|
@ -568,7 +568,7 @@ static char *displ_picture(char *c)
|
||||||
{
|
{
|
||||||
char *d;
|
char *d;
|
||||||
int x,y,hn,z,ln,sl;
|
int x,y,hn,z,ln,sl;
|
||||||
short *sh;
|
const short *sh;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -161,43 +161,45 @@ unsigned char twins;
|
||||||
|
|
||||||
static short rand_value;
|
static short rand_value;
|
||||||
|
|
||||||
static word *paleta;
|
static word paleta[256];
|
||||||
|
|
||||||
void show_full_lfb12e(void *target,void *buff,void *paleta);
|
void show_full_lfb12e(void *target,const void *buff,const void *paleta);
|
||||||
//#pragma aux show_full_lfb12e parm[edi][esi][ebx] modify [eax ecx]
|
//#pragma aux show_full_lfb12e parm[edi][esi][ebx] modify [eax ecx]
|
||||||
void show_delta_lfb12e(void *target,void *buff,void *paleta);
|
void show_delta_lfb12e(void *target,const void *buff,const void *paleta);
|
||||||
//#pragma aux show_delta_lfb12e parm[edi][esi][ebx] modify [eax ecx]
|
//#pragma aux show_delta_lfb12e parm[edi][esi][ebx] modify [eax ecx]
|
||||||
char mob_check_next_sector(int sect,int dir,char alone,char passable);
|
char mob_check_next_sector(int sect,int dir,const char alone,char passable);
|
||||||
|
|
||||||
void call_spell(int i);
|
void call_spell(int i);
|
||||||
int calculatePhaseDoor(int sector, int dir, int um);
|
int calculatePhaseDoor(int sector, int dir, int um);
|
||||||
|
|
||||||
|
|
||||||
static void animace_kouzla(int act,void *data, int ssize)
|
static void animace_kouzla(int act,const void *data, int ssize)
|
||||||
{
|
{
|
||||||
switch (act)
|
switch (act)
|
||||||
{
|
{
|
||||||
case MGIF_LZW:
|
case MGIF_LZW:
|
||||||
case MGIF_COPY:show_full_lfb12e(anim_render_buffer,data,paleta);break;
|
case MGIF_COPY:show_full_lfb12e(anim_render_buffer,data,paleta);break;
|
||||||
case MGIF_DELTA:show_delta_lfb12e(anim_render_buffer,data,paleta);break;
|
case MGIF_DELTA:show_delta_lfb12e(anim_render_buffer,data,paleta);break;
|
||||||
case MGIF_PAL:paleta=data;*paleta|=0x8000;break;
|
case MGIF_PAL:memcpy(paleta,data,sizeof(paleta));paleta[0]|=0x8000;break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void load_spells_legacy_format(void **p, int32_t *s) {
|
const void *load_spells_legacy_format(const void *p, int32_t *s) {
|
||||||
TKOUZLO *k = (*p);
|
void *np = getmem(*s);
|
||||||
TKOUZLO *end = (TKOUZLO *)((char *)(*p) + k->start);
|
memcpy(np,p,*s);
|
||||||
|
TKOUZLO *k = (np);
|
||||||
|
TKOUZLO *end = (TKOUZLO *)((char *)(np) + k->start);
|
||||||
++k;
|
++k;
|
||||||
int count = 1;
|
int count = 1;
|
||||||
while (k < end) {
|
while (k < end) {
|
||||||
++count;
|
++count;
|
||||||
TKOUZLO *end2 = (TKOUZLO *)((char *)(*p) + k->start);
|
TKOUZLO *end2 = (TKOUZLO *)((char *)(np) + k->start);
|
||||||
if (end2 < end) end = end2;
|
if (end2 < end) end = end2;
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
SEND_LOG("(SPELL) Loading spell table: count %d", count);
|
SEND_LOG("(SPELL) Loading spell table: count %d", count);
|
||||||
k = (*p);
|
k = (np);
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
char *b = (char *)k;
|
char *b = (char *)k;
|
||||||
char traceon = *(k->spellname-1); //traceon was there;
|
char traceon = *(k->spellname-1); //traceon was there;
|
||||||
|
@ -207,6 +209,7 @@ void load_spells_legacy_format(void **p, int32_t *s) {
|
||||||
k->traceon = traceon;
|
k->traceon = traceon;
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,7 +218,7 @@ static void play_anim(va_list args) //tasked animation
|
||||||
{
|
{
|
||||||
int block=va_arg(args,int);
|
int block=va_arg(args,int);
|
||||||
#define ANIM_SIZE (320*180*2)
|
#define ANIM_SIZE (320*180*2)
|
||||||
void *anm;
|
const void *anm;
|
||||||
int32_t *l,c;
|
int32_t *l,c;
|
||||||
|
|
||||||
if (running_anm)
|
if (running_anm)
|
||||||
|
|
34
game/menu.c
34
game/menu.c
|
@ -62,7 +62,7 @@ static char vymacknout(int id,int xa,int ya,int xr,int yr)
|
||||||
|
|
||||||
static char promacknuti(int id,int xa,int ya,int xr,int yr)
|
static char promacknuti(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
char *z;
|
const char *z;
|
||||||
word *w;
|
word *w;
|
||||||
|
|
||||||
z=ablock(H_MENU_MASK);w=(word *)z;
|
z=ablock(H_MENU_MASK);w=(word *)z;
|
||||||
|
@ -122,18 +122,17 @@ jp1:lodsb
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
static void nahraj_rozdilovy_pcx(void **pp,int32_t *s)
|
static const void *nahraj_rozdilovy_pcx(const void *pp, int32_t *s)
|
||||||
{
|
{
|
||||||
char *org,*pos;
|
char *org,*pos;
|
||||||
char *vysl;
|
char *vysl;
|
||||||
word *size,*paltab;
|
word *size,*paltab;
|
||||||
word *hicolor,*p;
|
word *hicolor,*p;
|
||||||
void *origin;
|
const void *origin;
|
||||||
int siz;
|
int siz;
|
||||||
|
|
||||||
load_pcx((char *)*pp,*s,A_8BIT,&vysl);
|
load_pcx((char *)pp,*s,A_8BIT,&vysl);
|
||||||
size=(word *)vysl;
|
size=(word *)vysl;
|
||||||
free(*pp);
|
|
||||||
siz=size[0]*size[1];
|
siz=size[0]*size[1];
|
||||||
p=hicolor=getmem(siz*2+12);
|
p=hicolor=getmem(siz*2+12);
|
||||||
*p++=size[0];
|
*p++=size[0];
|
||||||
|
@ -145,8 +144,8 @@ static void nahraj_rozdilovy_pcx(void **pp,int32_t *s)
|
||||||
paltab=(word *)vysl+3;
|
paltab=(word *)vysl+3;
|
||||||
rozdily((uint8_t *)org,(uint8_t *)pos,hicolor+3,paltab,siz);
|
rozdily((uint8_t *)org,(uint8_t *)pos,hicolor+3,paltab,siz);
|
||||||
free(vysl);
|
free(vysl);
|
||||||
*pp=hicolor;
|
|
||||||
*s=siz*2+12;
|
*s=siz*2+12;
|
||||||
|
return hicolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ jp2: inc ebx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
static void zobraz_podle_masky_asm(char barva, uint16_t *scr, uint16_t *data, uint8_t *maska, int xs, int ys, int scr_linelen) {
|
static void zobraz_podle_masky_asm(char barva, uint16_t *scr, const uint16_t *data, const uint8_t *maska, int xs, int ys, int scr_linelen) {
|
||||||
int width = xs;
|
int width = xs;
|
||||||
|
|
||||||
for (int y = 0; y < ys; y++) {
|
for (int y = 0; y < ys; y++) {
|
||||||
|
@ -221,8 +220,8 @@ static void zobraz_podle_masky_asm(char barva, uint16_t *scr, uint16_t *data, ui
|
||||||
|
|
||||||
static void zobraz_podle_masky(char barva,char anim)
|
static void zobraz_podle_masky(char barva,char anim)
|
||||||
{
|
{
|
||||||
char *maska;
|
const char *maska;
|
||||||
word *data;
|
const word *data;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
word *obr=GetScreenAdr()+300*scr_linelen2+220;
|
word *obr=GetScreenAdr()+300*scr_linelen2+220;
|
||||||
word xs,ys;
|
word xs,ys;
|
||||||
|
@ -272,11 +271,11 @@ static void prehraj_animaci_v_menu(EVENT_MSG *msg,char **unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void preload_anim(va_list args)
|
static void preload_anim(va_list args)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
low_mem=0;
|
|
||||||
ablock(H_ANIM+29);
|
ablock(H_ANIM+29);
|
||||||
for(i=0;i<30;i+=2)
|
for(i=0;i<30;i+=2)
|
||||||
{
|
{
|
||||||
|
@ -305,6 +304,7 @@ static void preload_anim(va_list args)
|
||||||
task_wait_event(E_TIMER);
|
task_wait_event(E_TIMER);
|
||||||
load_ok=1;
|
load_ok=1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void klavesnice(EVENT_MSG *msg,void **unused)
|
static void klavesnice(EVENT_MSG *msg,void **unused)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +317,11 @@ static void klavesnice(EVENT_MSG *msg,void **unused)
|
||||||
for(cursor=0;cursor<5;cursor++) if (cur_dir[cursor]==SELECT) break;
|
for(cursor=0;cursor<5;cursor++) if (cur_dir[cursor]==SELECT) break;
|
||||||
if (cursor==5) cursor=-1;
|
if (cursor==5) cursor=-1;
|
||||||
int c = va_arg(msg->data,int);
|
int c = va_arg(msg->data,int);
|
||||||
switch(c)
|
if (c ==E_QUIT_GAME_KEY) {
|
||||||
|
send_message(E_MENU_SELECT,4);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch(c >> 8)
|
||||||
{
|
{
|
||||||
case 'H':cursor--;if (cursor<0) cursor=0;break;
|
case 'H':cursor--;if (cursor<0) cursor=0;break;
|
||||||
case 'P':cursor++;if (cursor>4) cursor=4;break;
|
case 'P':cursor++;if (cursor>4) cursor=4;break;
|
||||||
|
@ -328,14 +332,12 @@ static void klavesnice(EVENT_MSG *msg,void **unused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int enter_menu(char open)
|
int enter_menu(char open)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
|
|
||||||
init_menu_entries();
|
init_menu_entries();
|
||||||
add_task(2048,preload_anim);
|
|
||||||
load_ok=0;
|
|
||||||
while(!load_ok) task_sleep();
|
|
||||||
if (!open)
|
if (!open)
|
||||||
{
|
{
|
||||||
change_music(get_next_music_from_playlist());
|
change_music(get_next_music_from_playlist());
|
||||||
|
@ -353,7 +355,7 @@ int enter_menu(char open)
|
||||||
ms_last_event.event_type=0x1;
|
ms_last_event.event_type=0x1;
|
||||||
send_message(E_MOUSE,&ms_last_event);
|
send_message(E_MOUSE,&ms_last_event);
|
||||||
EVENT_MSG *ev = task_wait_event(E_MENU_SELECT);
|
EVENT_MSG *ev = task_wait_event(E_MENU_SELECT);
|
||||||
c=va_arg(ev->data, int);
|
c=ev?va_arg(ev->data, int):-1;
|
||||||
disable_click_map();
|
disable_click_map();
|
||||||
send_message(E_DONE,E_KEYBOARD,klavesnice);
|
send_message(E_DONE,E_KEYBOARD,klavesnice);
|
||||||
cur_dir[c]=UNSELECT;
|
cur_dir[c]=UNSELECT;
|
||||||
|
@ -516,7 +518,7 @@ void titles(va_list args)
|
||||||
char send_back=va_arg(args,int);
|
char send_back=va_arg(args,int);
|
||||||
char *textname=va_arg(args,char *);
|
char *textname=va_arg(args,char *);
|
||||||
|
|
||||||
void *picture;
|
const void *picture;
|
||||||
word *scr,*buff;
|
word *scr,*buff;
|
||||||
int counter,newc;
|
int counter,newc;
|
||||||
int lcounter=1;
|
int lcounter=1;
|
||||||
|
|
|
@ -125,45 +125,7 @@ void prepare_graphics(int *ofs,char *names,int32_t size,void *decomp,int class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void preload_percent(int cur,int max)
|
|
||||||
{
|
|
||||||
int pos;
|
|
||||||
pos=cur*640/max;
|
|
||||||
if (pos>640) pos=640;
|
|
||||||
curcolor=RGB555(16,16,16);hor_line32(0,476,pos);
|
|
||||||
curcolor=RGB555(8,8,8);hor_line32(0,477,pos);
|
|
||||||
curcolor=RGB555(31,31,31);hor_line32(0,475,pos);
|
|
||||||
showview(0,460,640,20);
|
|
||||||
do_events();
|
|
||||||
}
|
|
||||||
|
|
||||||
void preload_objects(int ofsts)
|
|
||||||
//#pragma preload_objects parm [];
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char lodka=1;
|
|
||||||
|
|
||||||
for(i=1;i<mapsize;i++) if (map_sectors[i].sector_type==S_LODKA) break;
|
|
||||||
if (i==mapsize) lodka=0;
|
|
||||||
// const char *c = build_pathname(2, pathname[SR_DATA], "LOADING.MUS");
|
|
||||||
// change_music(c);
|
|
||||||
trans_bar(0,460,640,20,0);
|
|
||||||
position(0,460);
|
|
||||||
set_font(H_FBOLD,RGB555(0,31,0));
|
|
||||||
const char *c = concat2(texty[TX_LOAD], mglob.mapname);
|
|
||||||
outtext(c);
|
|
||||||
for(i=0;i<ofsts;i++)
|
|
||||||
{
|
|
||||||
if (i<H_LODKA0 || i>H_LODKA7 || lodka) apreload_sign(i,ofsts);
|
|
||||||
}
|
|
||||||
apreload_start(preload_percent);
|
|
||||||
/* for(i=0;i<ofsts;i++)
|
|
||||||
{
|
|
||||||
ablock(ofsts-i-1);
|
|
||||||
preload_percent(i+ofsts,ofsts);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int load_level_texts(const char *filename)
|
int load_level_texts(const char *filename)
|
||||||
{
|
{
|
||||||
|
@ -194,21 +156,6 @@ char *change_extension_support(char *buffer, const char *filename,char *new_exte
|
||||||
|
|
||||||
#define set_file_extension(filename, extension) change_extension_support((char *)alloca(strlen(filename)+strlen(extension)), (filename), (extension))
|
#define set_file_extension(filename, extension) change_extension_support((char *)alloca(strlen(filename)+strlen(extension)), (filename), (extension))
|
||||||
|
|
||||||
void show_loading_picture(char *filename)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
int32_t s;
|
|
||||||
|
|
||||||
p=afile(filename,SR_BGRAFIKA,&s);
|
|
||||||
put_picture(0,0,p);
|
|
||||||
showview(0,0,0,0);
|
|
||||||
free(p);
|
|
||||||
#ifdef LOGFILE
|
|
||||||
display_ver(639,0,2,0);
|
|
||||||
#endif
|
|
||||||
cancel_pass=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int snd_devnum;
|
extern int snd_devnum;
|
||||||
|
|
||||||
int load_map(char *filename)
|
int load_map(char *filename)
|
||||||
|
@ -228,8 +175,6 @@ int load_map(char *filename)
|
||||||
const char *mpath = build_pathname(2, gpathtable[SR_MAP], filename);
|
const char *mpath = build_pathname(2, gpathtable[SR_MAP], filename);
|
||||||
mpath = local_strdup(mpath);
|
mpath = local_strdup(mpath);
|
||||||
schovej_mysku();
|
schovej_mysku();
|
||||||
if (level_preload) show_loading_picture("LOADING.HI");
|
|
||||||
change_music("?");
|
|
||||||
zobraz_mysku();
|
zobraz_mysku();
|
||||||
f=fopen_icase(mpath,"rb");
|
f=fopen_icase(mpath,"rb");
|
||||||
if (level_fname!=NULL) free(level_fname);
|
if (level_fname!=NULL) free(level_fname);
|
||||||
|
@ -317,7 +262,7 @@ int load_map(char *filename)
|
||||||
SEND_LOG("(GAME) Loading enemies...");
|
SEND_LOG("(GAME) Loading enemies...");
|
||||||
if (mob_template==NULL)
|
if (mob_template==NULL)
|
||||||
{
|
{
|
||||||
int32_t h;char *p;
|
int32_t h;const char *p;
|
||||||
|
|
||||||
alock(H_ENEMY);
|
alock(H_ENEMY);
|
||||||
p=ablock(H_ENEMY);
|
p=ablock(H_ENEMY);
|
||||||
|
@ -370,7 +315,6 @@ int load_map(char *filename)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
flag_map=(char *)getmem(mapsize*4);
|
flag_map=(char *)getmem(mapsize*4);
|
||||||
memset(minimap,0,sizeof(minimap));
|
memset(minimap,0,sizeof(minimap));
|
||||||
if (level_preload) preload_objects(ofsts);
|
|
||||||
end_ptr=ofsts;
|
end_ptr=ofsts;
|
||||||
const char *tpath=set_file_extension(mpath,".txt");
|
const char *tpath=set_file_extension(mpath,".txt");
|
||||||
suc=load_level_texts(tpath);
|
suc=load_level_texts(tpath);
|
||||||
|
@ -1866,16 +1810,16 @@ void sleep_players(va_list args)
|
||||||
|
|
||||||
void *game_keyboard(EVENT_MSG *msg,void **usr)
|
void *game_keyboard(EVENT_MSG *msg,void **usr)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
int c;
|
||||||
|
|
||||||
usr;
|
usr;
|
||||||
if (pass_zavora) return NULL;
|
if (pass_zavora) return NULL;
|
||||||
if (cur_mode==MD_END_GAME) return NULL;
|
if (cur_mode==MD_END_GAME) return NULL;
|
||||||
if (msg->msg==E_KEYBOARD)
|
if (msg->msg==E_KEYBOARD)
|
||||||
{
|
{
|
||||||
c=va_arg(msg->data, int)>>8;
|
c=quit_request_as_escape(va_arg(msg->data, int));
|
||||||
while (_bios_keybrd(_KEYBRD_READY) ) _bios_keybrd(_KEYBRD_READ);
|
while (_bios_keybrd(_KEYBRD_READY) ) _bios_keybrd(_KEYBRD_READ);
|
||||||
switch (c)
|
switch (c >> 8)
|
||||||
{
|
{
|
||||||
case 'H':step_zoom(0);break;
|
case 'H':step_zoom(0);break;
|
||||||
case 'P':step_zoom(2);break;
|
case 'P':step_zoom(2);break;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void setup_keyboard(EVENT_MSG *msg,void **_)
|
||||||
{
|
{
|
||||||
if (msg->msg == E_KEYBOARD)
|
if (msg->msg == E_KEYBOARD)
|
||||||
{
|
{
|
||||||
char c= va_arg(msg->data, int);
|
char c= quit_request_as_escape(va_arg(msg->data, int));
|
||||||
if (c==27)
|
if (c==27)
|
||||||
{
|
{
|
||||||
unwire_proc();
|
unwire_proc();
|
||||||
|
|
101
game/skeldal.c
101
game/skeldal.c
|
@ -91,11 +91,11 @@ static int init_music_vol=127;
|
||||||
static int init_gfx_vol=255;
|
static int init_gfx_vol=255;
|
||||||
static char titles_on=0;
|
static char titles_on=0;
|
||||||
|
|
||||||
void pcx_fade_decomp(void **p,int32_t *s);
|
const void *pcx_fade_decomp(const void *p, int32_t *s);
|
||||||
void pcx_15bit_decomp(void **p,int32_t *s);
|
const void *pcx_15bit_decomp(const void *p, int32_t *s);
|
||||||
void pcx_15bit_autofade(void **p,int32_t *s);
|
const void *pcx_15bit_autofade(const void *p, int32_t *s);
|
||||||
void pcx_15bit_backgrnd(void **p,int32_t *s);
|
const void *pcx_15bit_backgrnd(const void *p, int32_t *s);
|
||||||
void pcx_8bit_decomp(void **p,int32_t *s);
|
const void *pcx_8bit_decomp(const void *p, int32_t *s);
|
||||||
|
|
||||||
char *texty_knihy;
|
char *texty_knihy;
|
||||||
static char *patch_file=NULL;
|
static char *patch_file=NULL;
|
||||||
|
@ -280,82 +280,80 @@ void purge_temps(char _) {
|
||||||
temp_storage_clear();
|
temp_storage_clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcx_fade_decomp(void **p,int32_t *s)
|
const void *pcx_fade_decomp(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
int r = load_pcx(*p,*s,A_FADE_PAL,&buff,mglob.fade_r,mglob.fade_g,mglob.fade_b);
|
int r = load_pcx(p,*s,A_FADE_PAL,&buff,mglob.fade_r,mglob.fade_g,mglob.fade_b);
|
||||||
assert(r > 0);
|
assert(r > 0);
|
||||||
*s=r;
|
*s=r;
|
||||||
free(*p);
|
return buff;
|
||||||
*p=buff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcx_15bit_decomp(void **p,int32_t *s)
|
const void *pcx_15bit_decomp(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
int r = load_pcx(*p,*s,A_16BIT,&buff);
|
int r = load_pcx(p,*s,A_16BIT,&buff);
|
||||||
assert(r > 0);
|
assert(r > 0);
|
||||||
*s=r;
|
*s=r;
|
||||||
free(*p);
|
return buff;
|
||||||
*p=buff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcx_15bit_autofade(void **p,int32_t *s)
|
const void *pcx_15bit_autofade(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
int r = load_pcx(*p,*s,A_16BIT,&buff);
|
int r = load_pcx(p,*s,A_16BIT,&buff);
|
||||||
assert(r > 0);
|
assert(r > 0);
|
||||||
*s=r;
|
*s=r;
|
||||||
free(*p);
|
|
||||||
*p=buff;
|
|
||||||
buff[5]=0x80;
|
buff[5]=0x80;
|
||||||
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcx_15bit_backgrnd(void **p,int32_t *s)
|
const void *pcx_15bit_backgrnd(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
int32_t i;int32_t *z;
|
int32_t i;int32_t *z;
|
||||||
|
|
||||||
if (*p!=NULL)
|
if (p!=NULL)
|
||||||
{
|
{
|
||||||
int r = load_pcx(*p,*s,A_16BIT,&buff);
|
int r = load_pcx(p,*s,A_16BIT,&buff);
|
||||||
assert(r>0);
|
assert(r>0);
|
||||||
z=(int32_t *)buff;
|
z=(int32_t *)buff;
|
||||||
*s=r;
|
*s=r;
|
||||||
for(i=*s;i>0;i-=4,z++) *z|=0x80008000;
|
for(i=*s;i>0;i-=4,z++) *z|=0x80008000;
|
||||||
free(*p);
|
return buff;
|
||||||
*p=buff;
|
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcx_8bit_nopal(void **p,int32_t *s)
|
const void *pcx_8bit_nopal(const void *p,int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff = NULL;
|
||||||
|
|
||||||
if (*p!=NULL)
|
if (p!=NULL)
|
||||||
{
|
{
|
||||||
int r = load_pcx(*p,*s,A_8BIT_NOPAL,&buff);
|
int r = load_pcx(p,*s,A_8BIT_NOPAL,&buff);
|
||||||
assert(r>0);
|
assert(r>0);
|
||||||
*s=r;
|
*s=r;
|
||||||
free(*p);
|
|
||||||
*p=buff;
|
|
||||||
}
|
}
|
||||||
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pcx_8bit_decomp(void **p,int32_t *s)
|
|
||||||
|
const void *pcx_8bit_decomp(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
int r = load_pcx(*p,*s,A_8BIT,&buff);
|
int r = load_pcx(p,*s,A_8BIT,&buff);
|
||||||
assert(r>0);
|
assert(r>0);
|
||||||
*s=r;
|
*s=r;
|
||||||
free(*p);
|
return buff;
|
||||||
*p=buff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hi_8bit_correct(void **p,int32_t *s)
|
const void *hi_8bit_correct(const void *p,int32_t *s)
|
||||||
{
|
{
|
||||||
word *ptr=(word *)*p;
|
word *out = (word *)getmem(*s);
|
||||||
|
memcpy(out, p, *s);
|
||||||
|
word *ptr=out;
|
||||||
int i;
|
int i;
|
||||||
if (ptr[2]==8)
|
if (ptr[2]==8)
|
||||||
{
|
{
|
||||||
|
@ -364,13 +362,14 @@ void hi_8bit_correct(void **p,int32_t *s)
|
||||||
ptr[i+3]=((ptr[i+3] & ~0x1F)+ptr[i+3]);
|
ptr[i+3]=((ptr[i+3] & ~0x1F)+ptr[i+3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void load_mob_legacy_format(void **p, int32_t *s) {
|
const void *load_mob_legacy_format(const void *p, int32_t *s) {
|
||||||
const int sz = 376;
|
const int sz = 376;
|
||||||
int count = *s / sz;;
|
int count = *s / sz;;
|
||||||
char *c = *p;
|
const char *c = p;
|
||||||
TMOB *out = getmem(count * sizeof(TMOB));
|
TMOB *out = getmem(count * sizeof(TMOB));
|
||||||
|
|
||||||
memset(out, 0 , sizeof(TMOB)*count);
|
memset(out, 0 , sizeof(TMOB)*count);
|
||||||
|
@ -393,33 +392,34 @@ void load_mob_legacy_format(void **p, int32_t *s) {
|
||||||
memcpy(d, c, nx - ofs); //last padding 1
|
memcpy(d, c, nx - ofs); //last padding 1
|
||||||
c+=nx - ofs - 1;
|
c+=nx - ofs - 1;
|
||||||
}
|
}
|
||||||
free(*p);
|
|
||||||
*p =out;
|
|
||||||
*s = count * sizeof(TMOB);
|
*s = count * sizeof(TMOB);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_background(void **p,int32_t *s)
|
const void *set_background(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
word *data;
|
const word *data;
|
||||||
word *ptr;
|
word *ptr;
|
||||||
word *pal;
|
const word *pal;
|
||||||
char *pic;
|
char *pic;
|
||||||
|
void *out;
|
||||||
int counter;
|
int counter;
|
||||||
|
|
||||||
|
|
||||||
if (!bgr_handle) return;
|
if (!bgr_handle) return p;
|
||||||
if (bgr_distance==-1) return;
|
if (bgr_distance==-1) return p;
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
data=ablock(bgr_handle);
|
data=ablock(bgr_handle);
|
||||||
*s=scr_linelen2*360*2;
|
*s=scr_linelen2*360*2;
|
||||||
ptr=*p=getmem(*s);
|
out = ptr=getmem(*s);
|
||||||
counter=scr_linelen2*360;
|
counter=scr_linelen2*360;
|
||||||
pal=data+3+bgr_distance*256;
|
pal=data+3+bgr_distance*256;
|
||||||
pic=(char *)data+PIC_FADE_PAL_SIZE;
|
pic=(char *)data+PIC_FADE_PAL_SIZE;
|
||||||
do
|
do
|
||||||
*ptr++=pal[(uint8_t)*pic++] | BGSWITCHBIT;
|
*ptr++=pal[(uint8_t)*pic++] | BGSWITCHBIT;
|
||||||
while (--counter);
|
while (--counter);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouse_set_cursor(int cursor)
|
void mouse_set_cursor(int cursor)
|
||||||
|
@ -1268,6 +1268,7 @@ void play_anim(int anim_num)
|
||||||
char *t,*z;
|
char *t,*z;
|
||||||
TSTR_LIST titl=NULL;
|
TSTR_LIST titl=NULL;
|
||||||
const char *s = build_pathname(2,gpathtable[SR_VIDEO], texty[anim_num]);
|
const char *s = build_pathname(2,gpathtable[SR_VIDEO], texty[anim_num]);
|
||||||
|
s = local_strdup(s);
|
||||||
if (snd_devnum==DEV_NOSOUND || titles_on)
|
if (snd_devnum==DEV_NOSOUND || titles_on)
|
||||||
{
|
{
|
||||||
concat(t,s," ");
|
concat(t,s," ");
|
||||||
|
@ -1433,7 +1434,7 @@ static void load_saved_game(void)
|
||||||
update_mysky();
|
update_mysky();
|
||||||
{
|
{
|
||||||
EVENT_MSG *msg = task_wait_event(E_CLOSE_MAP);
|
EVENT_MSG *msg = task_wait_event(E_CLOSE_MAP);
|
||||||
game = va_arg(msg->data, int);
|
game = msg?va_arg(msg->data, int):-1;
|
||||||
}
|
}
|
||||||
unwire_proc();
|
unwire_proc();
|
||||||
disable_click_map();
|
disable_click_map();
|
||||||
|
@ -1485,6 +1486,7 @@ static void start(va_list args)
|
||||||
volba=enter_menu(openning);openning=1;
|
volba=enter_menu(openning);openning=1;
|
||||||
switch (volba)
|
switch (volba)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case V_KONEC:exit_wait=1;break;
|
case V_KONEC:exit_wait=1;break;
|
||||||
case V_NOVA_HRA: if (!enter_generator())
|
case V_NOVA_HRA: if (!enter_generator())
|
||||||
{
|
{
|
||||||
|
@ -1594,6 +1596,10 @@ void show_help_short() {
|
||||||
printf("add -h to print help\n");
|
printf("add -h to print help\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void quit_cb_exit_wait(void *) {
|
||||||
|
exit_wait = 1;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
def_mman_group_table(gpathtable);
|
def_mman_group_table(gpathtable);
|
||||||
|
@ -1638,9 +1644,12 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
init_skeldal(cfg);
|
init_skeldal(cfg);
|
||||||
|
|
||||||
add_task(65536,start);
|
int start_task = add_task(65536,start);
|
||||||
|
|
||||||
escape();
|
escape();
|
||||||
|
|
||||||
|
term_task_wait(start_task);
|
||||||
|
|
||||||
closemode();
|
closemode();
|
||||||
|
|
||||||
ini_close(cfg);
|
ini_close(cfg);
|
||||||
|
|
|
@ -196,17 +196,17 @@ int calcul_volume(int chan,int x,int y,int side,int volume)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wav_load(void **p,int32_t *s)
|
const void *wav_load(const void *p, int32_t *s)
|
||||||
{
|
{
|
||||||
char *sr;
|
const char *sr;
|
||||||
char *tg;
|
char *tg;
|
||||||
void *tgr;
|
void *tgr;
|
||||||
struct t_wave x[3];
|
struct t_wave x[3];
|
||||||
|
|
||||||
sr=*p;
|
sr=p;
|
||||||
sr=find_chunk(sr,WAV_FMT);
|
sr=find_chunk(sr,WAV_FMT);
|
||||||
read_chunk(sr,&x);
|
read_chunk(sr,&x);
|
||||||
sr=*p;
|
sr=p;
|
||||||
sr=find_chunk(sr,WAV_DATA);
|
sr=find_chunk(sr,WAV_DATA);
|
||||||
*s=get_chunk_size(sr);
|
*s=get_chunk_size(sr);
|
||||||
tgr=tg=getmem(*s+sizeof(struct t_wave)+4);
|
tgr=tg=getmem(*s+sizeof(struct t_wave)+4);
|
||||||
|
@ -215,31 +215,9 @@ void wav_load(void **p,int32_t *s)
|
||||||
*(int *)tg=*s;
|
*(int *)tg=*s;
|
||||||
tg+=4;
|
tg+=4;
|
||||||
read_chunk(sr,tg);
|
read_chunk(sr,tg);
|
||||||
free(*p);
|
|
||||||
*p=tgr;
|
|
||||||
*s+=sizeof(struct t_wave)+4;
|
*s+=sizeof(struct t_wave)+4;
|
||||||
/* if (x[0].freq!=x[0].bps)
|
return tgr;
|
||||||
{
|
|
||||||
char s;
|
|
||||||
|
|
||||||
siz>>=1;
|
|
||||||
s=siz & 1;
|
|
||||||
siz>>=1;
|
|
||||||
d=tg;
|
|
||||||
for(;siz--;d++) *d^=0x80008000;
|
|
||||||
if (s) {c=(char *)d;c[1]^=0x80;}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char s;
|
|
||||||
|
|
||||||
s=siz & 3;
|
|
||||||
siz>>=2;
|
|
||||||
d=(int32_t *)tg;
|
|
||||||
for(;siz--;d++) *d^=0x80808080;
|
|
||||||
c=(char *)d;
|
|
||||||
for(;s--;c++) *c^=0x80;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void play_effekt(int x,int y,int xd,int yd,int side,int sided,const TMA_SOUND *p)
|
void play_effekt(int x,int y,int xd,int yd,int side,int sided,const TMA_SOUND *p)
|
||||||
|
@ -247,7 +225,7 @@ void play_effekt(int x,int y,int xd,int yd,int side,int sided,const TMA_SOUND *p
|
||||||
int chan;
|
int chan;
|
||||||
int blockid;
|
int blockid;
|
||||||
SND_INFO *track;
|
SND_INFO *track;
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
if (!sound_enabled) return;
|
if (!sound_enabled) return;
|
||||||
side;
|
side;
|
||||||
|
@ -273,8 +251,6 @@ void play_effekt(int x,int y,int xd,int yd,int side,int sided,const TMA_SOUND *p
|
||||||
if (blockid == -1) {
|
if (blockid == -1) {
|
||||||
def_handle(end_ptr, p->filename, wav_load, SR_ZVUKY);
|
def_handle(end_ptr, p->filename, wav_load, SR_ZVUKY);
|
||||||
blockid = end_ptr++;
|
blockid = end_ptr++;
|
||||||
if (level_preload)
|
|
||||||
apreload(blockid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alock(blockid);
|
alock(blockid);
|
||||||
|
@ -414,7 +390,7 @@ void purge_playlist()
|
||||||
void play_sample_at_sector(int sample,int sector1,int sector2,int track, char loop)
|
void play_sample_at_sector(int sample,int sector1,int sector2,int track, char loop)
|
||||||
{
|
{
|
||||||
int x,y,xd,yd,chan;
|
int x,y,xd,yd,chan;
|
||||||
char *s;
|
const char *s;
|
||||||
struct t_wave *p;
|
struct t_wave *p;
|
||||||
int siz;
|
int siz;
|
||||||
int oldtrack;
|
int oldtrack;
|
||||||
|
@ -450,7 +426,7 @@ void play_sample_at_sector(int sample,int sector1,int sector2,int track, char lo
|
||||||
|
|
||||||
void play_sample_at_channel(int sample,int channel,int vol)
|
void play_sample_at_channel(int sample,int channel,int vol)
|
||||||
{
|
{
|
||||||
char *s;
|
const char *s;
|
||||||
struct t_wave *p;
|
struct t_wave *p;
|
||||||
int siz;
|
int siz;
|
||||||
|
|
||||||
|
@ -486,7 +462,7 @@ void create_sound_table(char *template,int32_t size)
|
||||||
|
|
||||||
void create_sound_table_old()
|
void create_sound_table_old()
|
||||||
{
|
{
|
||||||
char *c,*s;
|
const char *c,*s;
|
||||||
int32_t pocet;
|
int32_t pocet;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
|
@ -547,8 +523,8 @@ static int flute_canal=30;
|
||||||
|
|
||||||
void start_play_flute(char note)
|
void start_play_flute(char note)
|
||||||
{
|
{
|
||||||
void *q;
|
const void *q;
|
||||||
char *w;
|
const char *w;
|
||||||
float realfrq;
|
float realfrq;
|
||||||
int vol=50;
|
int vol=50;
|
||||||
|
|
||||||
|
@ -569,8 +545,8 @@ void start_play_flute(char note)
|
||||||
|
|
||||||
void stop_play_flute()
|
void stop_play_flute()
|
||||||
{
|
{
|
||||||
void *q;
|
const void *q;
|
||||||
char *w;
|
const char *w;
|
||||||
|
|
||||||
if (check_snd_effect(SND_GFX))
|
if (check_snd_effect(SND_GFX))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ char ask_who_proc(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
THUMAN *p;
|
THUMAN *p;
|
||||||
int i;
|
int i;
|
||||||
word *xs;
|
const word *xs;
|
||||||
|
|
||||||
xs=ablock(H_OKNO);
|
xs=ablock(H_OKNO);
|
||||||
i=xr/xs[0];yr;xa;ya;id;
|
i=xr/xs[0];yr;xa;ya;id;
|
||||||
|
@ -1492,7 +1492,7 @@ char runes_mask(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
char *c;
|
char *c;
|
||||||
int cc;
|
int cc;
|
||||||
short *d;
|
const short *d;
|
||||||
|
|
||||||
id;ya;xa;
|
id;ya;xa;
|
||||||
d=ablock(H_RUNEMASK);
|
d=ablock(H_RUNEMASK);
|
||||||
|
@ -1927,7 +1927,7 @@ void programming_keyboard(EVENT_MSG *msg,void **unused)
|
||||||
unused;
|
unused;
|
||||||
if (msg->msg==E_KEYBOARD)
|
if (msg->msg==E_KEYBOARD)
|
||||||
{
|
{
|
||||||
c=va_arg(msg->data, int)>>8;
|
c=quit_request_as_escape(va_arg(msg->data, int))>>8;
|
||||||
while (_bios_keybrd(_KEYBRD_READY) ) _bios_keybrd(_KEYBRD_READ);
|
while (_bios_keybrd(_KEYBRD_READY) ) _bios_keybrd(_KEYBRD_READ);
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,7 +198,7 @@ void button2(OBJREC *o)
|
||||||
|
|
||||||
void draw_status_line(char *c)
|
void draw_status_line(char *c)
|
||||||
{
|
{
|
||||||
static word *font;
|
static const word *font;
|
||||||
static FC_TABLE color;
|
static FC_TABLE color;
|
||||||
static word backgr;
|
static word backgr;
|
||||||
static word ysmax=0,y;
|
static word ysmax=0,y;
|
||||||
|
|
|
@ -12,14 +12,15 @@ word *lbuffer;
|
||||||
word *screen;
|
word *screen;
|
||||||
word curcolor,charcolors[7] = {0x0000,0x03E0,0x0380,0x0300,0x0280,0x0000,0x0000};
|
word curcolor,charcolors[7] = {0x0000,0x03E0,0x0380,0x0300,0x0280,0x0000,0x0000};
|
||||||
longint linelen;
|
longint linelen;
|
||||||
word *curfont,*writepos,writeposx;
|
const word *curfont;
|
||||||
|
word *writepos,writeposx;
|
||||||
byte fontdsize=0;
|
byte fontdsize=0;
|
||||||
byte *palmem,*xlatmem;
|
byte *palmem,*xlatmem;
|
||||||
void (*showview)(word,word,word,word);
|
void (*showview)(word,word,word,word);
|
||||||
char line480=0;
|
char line480=0;
|
||||||
int32_t screen_buffer_size=512000;
|
int32_t screen_buffer_size=512000;
|
||||||
|
|
||||||
void *mscursor,*mssavebuffer=NULL;
|
const void *mscursor,*mssavebuffer=NULL;
|
||||||
integer mscuroldx=0,mscuroldy=0;
|
integer mscuroldx=0,mscuroldy=0;
|
||||||
integer msshowx=0,msshowy=0;
|
integer msshowx=0,msshowy=0;
|
||||||
int32_t pictlen; // Tato promenna je pouze pouzita v BGRAPH1.ASM
|
int32_t pictlen; // Tato promenna je pouze pouzita v BGRAPH1.ASM
|
||||||
|
@ -194,7 +195,7 @@ void hide_ms_cursor()
|
||||||
put_picture(mscuroldx,mscuroldy,mssavebuffer);
|
put_picture(mscuroldx,mscuroldy,mssavebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *register_ms_cursor(void *cursor)
|
void *register_ms_cursor(const void *cursor)
|
||||||
{
|
{
|
||||||
integer xs,ys;
|
integer xs,ys;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ void RedirectScreenBufferSecond(void);
|
||||||
|
|
||||||
|
|
||||||
extern word curcolor,charcolors[7];
|
extern word curcolor,charcolors[7];
|
||||||
extern word *curfont,*writepos,writeposx;
|
extern const word *curfont;
|
||||||
|
extern word *writepos,writeposx;
|
||||||
extern byte fontdsize;
|
extern byte fontdsize;
|
||||||
extern void (*showview)(word,word,word,word);
|
extern void (*showview)(word,word,word,word);
|
||||||
extern char __skip_change_line_test;
|
extern char __skip_change_line_test;
|
||||||
|
@ -42,13 +43,13 @@ void ver_line_xor(int x1,int y1,int y2);
|
||||||
//#pragma aux ver_line_xor parm [eSi] [eAX] [eCX] modify [eDX];
|
//#pragma aux ver_line_xor parm [eSi] [eAX] [eCX] modify [eDX];
|
||||||
void line_32(int x,int y,int xs,int ys);
|
void line_32(int x,int y,int xs,int ys);
|
||||||
//#pragma aux line_32 parm [esi] [eax] [ecx] [ebx] modify [edx edi]
|
//#pragma aux line_32 parm [esi] [eax] [ecx] [ebx] modify [edx edi]
|
||||||
void char_32(word *posit,word *font,char znak);
|
void char_32(word *posit,const word *font,char znak);
|
||||||
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||||
void char2_32(word *posit,word *font,char znak);
|
void char2_32(word *posit,const word *font,char znak);
|
||||||
//#pragma aux char2_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
//#pragma aux char2_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||||
word charsize(word *font,char znak);
|
word charsize(const word *font,char znak);
|
||||||
//#pragma aux charsize parm [esi] [eax]
|
//#pragma aux charsize parm [esi] [eax]
|
||||||
void put_picture(word x,word y,void *p);
|
void put_picture(word x,word y,const void *p);
|
||||||
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
|
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
|
||||||
void get_picture(word x,word y,word xs,word ys,void *p);
|
void get_picture(word x,word y,word xs,word ys,void *p);
|
||||||
//#pragma aux get_picture parm [esi] [eax] [ebx] [ecx] [edi] modify [edx]
|
//#pragma aux get_picture parm [esi] [eax] [ebx] [ecx] [edi] modify [edx]
|
||||||
|
@ -108,22 +109,22 @@ void closemode(void);
|
||||||
void line32(word x1,word y1, word x2, word y2);
|
void line32(word x1,word y1, word x2, word y2);
|
||||||
void position(word x,word y);
|
void position(word x,word y);
|
||||||
void show_ms_cursor(integer x,integer y);
|
void show_ms_cursor(integer x,integer y);
|
||||||
void *register_ms_cursor(void *cursor);
|
void *register_ms_cursor(const void *cursor);
|
||||||
void move_ms_cursor(integer newx,integer newy,char nodraw);
|
void move_ms_cursor(integer newx,integer newy,char nodraw);
|
||||||
void hide_ms_cursor(void);
|
void hide_ms_cursor(void);
|
||||||
void redraw_ms_cursor_on_screen(void);
|
void redraw_ms_cursor_on_screen(void);
|
||||||
int text_height(char *text);
|
int text_height( const char *text);
|
||||||
int text_width(char *text);
|
int text_width( const char *text);
|
||||||
void set_aligned_position(int x,int y,char alignx, char aligny,char *text);
|
void set_aligned_position(int x,int y,char alignx, char aligny,const char *text);
|
||||||
void rectangle(int x1,int y1,int x2,int y2,int color);
|
void rectangle(int x1,int y1,int x2,int y2,int color);
|
||||||
word *mapvesaadr1(word *a);
|
word *mapvesaadr1(word *a);
|
||||||
void rel_position_x(word x);
|
void rel_position_x(word x);
|
||||||
|
|
||||||
void put_8bit_clipped(void *src,void *trg,int startline,int velx,int vely);
|
void put_8bit_clipped(const void *src,void *trg,int startline,int velx,int vely);
|
||||||
//#pragma aux put_8bit_clipped parm [ESI][EDI][EAX][EBX][EDX] modify [ECX];
|
//#pragma aux put_8bit_clipped parm [ESI][EDI][EAX][EBX][EDX] modify [ECX];
|
||||||
void put_textured_bar_(void *src,void *trg,int xsiz,int ysiz,int xofs,int yofs);
|
void put_textured_bar_(const void *src,void *trg,int xsiz,int ysiz,int xofs,int yofs);
|
||||||
//#pragma aux put_textured_bar_ parm [EBX][EDI][EDX][ECX][ESI][EAX];
|
//#pragma aux put_textured_bar_ parm [EBX][EDI][EDX][ECX][ESI][EAX];
|
||||||
void put_textured_bar(void *src,int x,int y,int xs,int ys,int xofs,int yofs);
|
void put_textured_bar(const void *src,int x,int y,int xs,int ys,int xofs,int yofs);
|
||||||
void trans_bar(int x,int y,int xs,int ys,int barva);
|
void trans_bar(int x,int y,int xs,int ys,int barva);
|
||||||
//#pragma aux trans_bar parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];
|
//#pragma aux trans_bar parm [EDI][ESI][EDX][ECX][EBX] modify [EAX];
|
||||||
void trans_bar25(int x,int y,int xs,int ys);
|
void trans_bar25(int x,int y,int xs,int ys);
|
||||||
|
@ -132,11 +133,11 @@ void trans_line_x(int x,int y,int xs,int barva);
|
||||||
//#pragma aux trans_line_x parm [EDI][ESI][ECX][EDX] modify [EAX];
|
//#pragma aux trans_line_x parm [EDI][ESI][ECX][EDX] modify [EAX];
|
||||||
void trans_line_y(int x,int y,int ys,int barva);
|
void trans_line_y(int x,int y,int ys,int barva);
|
||||||
//#pragma aux trans_line_y parm [EDI][ESI][ECX][EDX] modify [EAX];
|
//#pragma aux trans_line_y parm [EDI][ESI][ECX][EDX] modify [EAX];
|
||||||
void draw_placed_texture(short *txtr,int celx,int cely,int posx,int posy,int posz,char turn);
|
void draw_placed_texture(const short *txtr,int celx,int cely,int posx,int posy,int posz,char turn);
|
||||||
|
|
||||||
void put_image(word *image,word *target,int start_line,int sizex,int sizey);
|
void put_image(const word *image,word *target,int start_line,int sizex,int sizey);
|
||||||
//#pragma aux put_image parm [ESI][EDI][EAX][EBX][EDX] modify [ECX]
|
//#pragma aux put_image parm [ESI][EDI][EAX][EBX][EDX] modify [ECX]
|
||||||
void put_picture2picture(word *source,word *target,int xp,int yp);
|
void put_picture2picture(const word *source,word *target,int xp,int yp);
|
||||||
//#pragma aux put_picture2picture parm [ESI][EDI][EAX][EDX] modify [ECX]
|
//#pragma aux put_picture2picture parm [ESI][EDI][EAX][EDX] modify [ECX]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
word *screen;
|
word *screen;
|
||||||
word curcolor,charcolors[7] = {0x0000,RGB555(0,31,0),RGB555(0,28,0),RGB555(0,24,0),RGB555(0,20,0),0x0000,0x0000};
|
word curcolor,charcolors[7] = {0x0000,RGB555(0,31,0),RGB555(0,28,0),RGB555(0,24,0),RGB555(0,20,0),0x0000,0x0000};
|
||||||
word *curfont,*writepos,writeposx;
|
const word *curfont;
|
||||||
|
word *writepos,writeposx;
|
||||||
byte fontdsize=0;
|
byte fontdsize=0;
|
||||||
void (*showview)(word,word,word,word);
|
void (*showview)(word,word,word,word);
|
||||||
char line480=0;
|
char line480=0;
|
||||||
|
@ -17,7 +18,8 @@ char screenstate=0;
|
||||||
char __skip_change_line_test=0;
|
char __skip_change_line_test=0;
|
||||||
char no_restore_mode=0;
|
char no_restore_mode=0;
|
||||||
|
|
||||||
void *mscursor,*mssavebuffer=NULL;
|
const void *mscursor;
|
||||||
|
void *mssavebuffer=NULL;
|
||||||
integer mscuroldx=0,mscuroldy=0;
|
integer mscuroldx=0,mscuroldy=0;
|
||||||
integer mscuroldxs=1,mscuroldys=1;
|
integer mscuroldxs=1,mscuroldys=1;
|
||||||
char write_window=0;
|
char write_window=0;
|
||||||
|
@ -501,7 +503,7 @@ void redraw_ms_cursor_on_screen(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *register_ms_cursor(void *cursor)
|
void *register_ms_cursor(const void *cursor)
|
||||||
{
|
{
|
||||||
integer xs,ys;
|
integer xs,ys;
|
||||||
|
|
||||||
|
@ -544,7 +546,7 @@ void move_ms_cursor(integer newx,integer newy,char nodraw)
|
||||||
mscuroldys=ys;
|
mscuroldys=ys;
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_height(char *text)
|
int text_height(const char *text)
|
||||||
{
|
{
|
||||||
char max=0,cur;
|
char max=0,cur;
|
||||||
|
|
||||||
|
@ -553,7 +555,7 @@ int text_height(char *text)
|
||||||
return max<<fontdsize;
|
return max<<fontdsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int text_width(char *text)
|
int text_width(const char *text)
|
||||||
{
|
{
|
||||||
int suma=0;
|
int suma=0;
|
||||||
|
|
||||||
|
@ -563,7 +565,7 @@ int text_width(char *text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_aligned_position(int x,int y,char alignx,char aligny,char *text)
|
void set_aligned_position(int x,int y,char alignx,char aligny,const char *text)
|
||||||
{
|
{
|
||||||
switch (alignx)
|
switch (alignx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,7 +121,7 @@ void line_32(int x,int y,int xs,int ys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void char_32(word *posit,word *font,char znak)
|
void char_32(word *posit,const word *font,char znak)
|
||||||
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
//#pragma aux char_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
|
@ -213,7 +213,7 @@ chrend: ;konec
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
void char2_32(word *posit,word *font,char znak)
|
void char2_32(word *posit, const word *font,char znak)
|
||||||
//#pragma aux char2_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
//#pragma aux char2_32 parm [edi] [esi] [eax] modify [eax ebx ecx edx]
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ chr2end: ;konec
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
word charsize(word *font,char znak)
|
word charsize(const word *font,char znak)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned char *esi = (unsigned char *)font;
|
unsigned char *esi = (unsigned char *)font;
|
||||||
|
@ -308,12 +308,12 @@ chsend: and eax,0ffffh
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_picture(word x,word y,void *p)
|
void put_picture(word x,word y,const void *p)
|
||||||
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
|
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
word *adr=GetScreenAdr()+scr_linelen2*y+x;
|
word *adr=GetScreenAdr()+scr_linelen2*y+x;
|
||||||
word *data=p;
|
const word *data=p;
|
||||||
word xs=data[0];
|
word xs=data[0];
|
||||||
word ys=data[1];
|
word ys=data[1];
|
||||||
word mode=data[2];
|
word mode=data[2];
|
||||||
|
@ -354,7 +354,7 @@ void put_picture(word x,word y,void *p)
|
||||||
}
|
}
|
||||||
if (mode==8 || mode==264)
|
if (mode==8 || mode==264)
|
||||||
{
|
{
|
||||||
word *table=data;
|
const word *table=data;
|
||||||
uint8_t *cdata=(uint8_t *)(data+(mode==264?10*256:256));
|
uint8_t *cdata=(uint8_t *)(data+(mode==264?10*256:256));
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
@ -369,7 +369,7 @@ void put_picture(word x,word y,void *p)
|
||||||
}
|
}
|
||||||
else if (mode==512 )
|
else if (mode==512 )
|
||||||
{
|
{
|
||||||
word *table=data;
|
const word *table=data;
|
||||||
uint8_t *cdata=(uint8_t *)(data+256);
|
uint8_t *cdata=(uint8_t *)(data+256);
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
@ -412,11 +412,11 @@ void get_picture(word x,word y,word xs,word ys,void *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_image(word *image,word *target,int start_line,int sizex,int sizey)
|
void put_image(const word *image,word *target,int start_line,int sizex,int sizey)
|
||||||
//#pragma aux put_image parm [ESI][EDI][EAX][EBX][EDX] modify [ECX]
|
//#pragma aux put_image parm [ESI][EDI][EAX][EBX][EDX] modify [ECX]
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
word *esi = image;
|
const word *esi = image;
|
||||||
word *edi = target;
|
word *edi = target;
|
||||||
int edx = sizey;
|
int edx = sizey;
|
||||||
int ecx = esi[0];
|
int ecx = esi[0];
|
||||||
|
@ -464,15 +464,15 @@ puti_lp:mov ecx,ebx
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_8bit_clipped(void *src,void *trg,int startline,int velx,int vely)
|
void put_8bit_clipped(const void *src,void *trg,int startline,int velx,int vely)
|
||||||
//#pragma aux put_8bit_clipped parm [ESI][EDI][EAX][EBX][EDX] modify [ECX];
|
//#pragma aux put_8bit_clipped parm [ESI][EDI][EAX][EBX][EDX] modify [ECX];
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
if (src==NULL) return;
|
if (src==NULL) return;
|
||||||
{
|
{
|
||||||
word *esi = src;
|
const word *esi = src;
|
||||||
word *edi = trg;
|
word *edi = trg;
|
||||||
word *paleta = esi+3;
|
const word *paleta = esi+3;
|
||||||
int cx = esi[0];
|
int cx = esi[0];
|
||||||
unsigned char *imgdata = (unsigned char *)(esi + 3 + 256)+ startline * cx;
|
unsigned char *imgdata = (unsigned char *)(esi + 3 + 256)+ startline * cx;
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ put8_trns:
|
||||||
ende:
|
ende:
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void put_textured_bar_(void *src,void *trg,int xsiz,int ysiz,int xofs,int yofs)
|
void put_textured_bar_(const void *src,void *trg,int xsiz,int ysiz,int xofs,int yofs)
|
||||||
//#pragma aux put_textured_bar_ parm [EBX][EDI][EDX][ECX][ESI][EAX];
|
//#pragma aux put_textured_bar_ parm [EBX][EDI][EDX][ECX][ESI][EAX];
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ void wait_retrace()
|
||||||
|
|
||||||
#define pic_start (2+2+2+512*5+512*5)
|
#define pic_start (2+2+2+512*5+512*5)
|
||||||
|
|
||||||
void put_picture2picture(word *source,word *target,int xp,int yp)
|
void put_picture2picture(const word *source,word *target,int xp,int yp)
|
||||||
//#pragma aux put_picture2picture parm [ESI][EDI][EAX][EDX] modify [ECX]
|
//#pragma aux put_picture2picture parm [ESI][EDI][EAX][EDX] modify [ECX]
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,9 @@ void keyboard(EVENT_MSG *msg, void *user_data) {
|
||||||
user_data;
|
user_data;
|
||||||
if (msg->msg == E_WATCH) {
|
if (msg->msg == E_WATCH) {
|
||||||
*otevri_zavoru = 1;
|
*otevri_zavoru = 1;
|
||||||
|
if (game_display_is_quit_requested()) {
|
||||||
|
send_message(E_KEYBOARD, E_QUIT_GAME_KEY);
|
||||||
|
}
|
||||||
if (!_bios_keybrd(_KEYBRD_READY))
|
if (!_bios_keybrd(_KEYBRD_READY))
|
||||||
return;
|
return;
|
||||||
i = _bios_keybrd(_KEYBRD_READ);
|
i = _bios_keybrd(_KEYBRD_READ);
|
||||||
|
|
|
@ -464,15 +464,12 @@ void except_GPF()
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void init_events()
|
void init_events()
|
||||||
{
|
{
|
||||||
send_message(E_ADD,E_WATCH,keyboard);
|
send_message(E_ADD,E_WATCH,keyboard);
|
||||||
send_message(E_ADD,E_WATCH,timer);
|
send_message(E_ADD,E_WATCH,timer);
|
||||||
send_message(E_ADD,E_WATCH,tasker);
|
send_message(E_ADD,E_WATCH,tasker);
|
||||||
#ifdef nodebug
|
|
||||||
alloc_exception(0xD,except_GPF);
|
|
||||||
alloc_exception(0xE,except_GPF);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char do_events_called=0;
|
static char do_events_called=0;
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
#define E_MOUSE 11
|
#define E_MOUSE 11
|
||||||
#define E_TIMER 12
|
#define E_TIMER 12
|
||||||
|
|
||||||
|
|
||||||
|
#define E_QUIT_GAME_KEY ((int)0xFFFF)
|
||||||
|
|
||||||
#define TASK_RUNNING 0
|
#define TASK_RUNNING 0
|
||||||
#define TASK_TERMINATING 1
|
#define TASK_TERMINATING 1
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FC_TABLE f_default;
|
||||||
word desktop_y_size;
|
word desktop_y_size;
|
||||||
char force_redraw_desktop=0;
|
char force_redraw_desktop=0;
|
||||||
static char change_flag=0,f_cancel_event=0;
|
static char change_flag=0,f_cancel_event=0;
|
||||||
word *default_font;
|
const word *default_font;
|
||||||
void empty()
|
void empty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ CTL3D *border(word light,word shadow, word bsize, word btype)
|
||||||
return &p;
|
return &p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void property(CTL3D *ctl,word *font,FC_TABLE *fcolor,word color)
|
void property(CTL3D *ctl,const word *font,FC_TABLE *fcolor,word color)
|
||||||
{
|
{
|
||||||
if (ctl!=NULL) memcpy(&o_end->border3d,ctl,sizeof(CTL3D));
|
if (ctl!=NULL) memcpy(&o_end->border3d,ctl,sizeof(CTL3D));
|
||||||
if (font!=NULL) o_end->font=font;
|
if (font!=NULL) o_end->font=font;
|
||||||
|
|
|
@ -69,7 +69,7 @@ typedef struct objrec
|
||||||
int32_t datasize;
|
int32_t datasize;
|
||||||
void *data;
|
void *data;
|
||||||
FC_TABLE f_color;
|
FC_TABLE f_color;
|
||||||
word *font;
|
const word *font;
|
||||||
void *userptr;
|
void *userptr;
|
||||||
void (*call_init)(struct objrec *, va_list);
|
void (*call_init)(struct objrec *, va_list);
|
||||||
void (*call_draw)(int , int, int, int, struct objrec *);
|
void (*call_draw)(int , int, int, int, struct objrec *);
|
||||||
|
@ -122,7 +122,7 @@ extern CTL3D noneborder;
|
||||||
extern FC_TABLE f_default;
|
extern FC_TABLE f_default;
|
||||||
extern word desktop_y_size;
|
extern word desktop_y_size;
|
||||||
//extern char change_flag;
|
//extern char change_flag;
|
||||||
extern word *default_font;
|
extern const word *default_font;
|
||||||
extern void *gui_background;
|
extern void *gui_background;
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void redraw_object(OBJREC *o);
|
||||||
void redraw_window(void);
|
void redraw_window(void);
|
||||||
void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC *),...);
|
void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC *),...);
|
||||||
CTL3D *border(word light,word shadow, word bsize, word btype);
|
CTL3D *border(word light,word shadow, word bsize, word btype);
|
||||||
void property(CTL3D *ctl,word *font,FC_TABLE *fcolor,word color);
|
void property(CTL3D *ctl,const word *font,FC_TABLE *fcolor,word color);
|
||||||
FC_TABLE *flat_color(word color);
|
FC_TABLE *flat_color(word color);
|
||||||
void aktivate_window(MS_EVENT *ms);
|
void aktivate_window(MS_EVENT *ms);
|
||||||
void redraw_desktop(void);
|
void redraw_desktop(void);
|
||||||
|
|
396
libs/memman.c
396
libs/memman.c
|
@ -21,7 +21,7 @@ void bonz_table();
|
||||||
|
|
||||||
#define NON_GETMEM_RESERVED (4*1024)
|
#define NON_GETMEM_RESERVED (4*1024)
|
||||||
static const char ** mman_pathlist=NULL;
|
static const char ** mman_pathlist=NULL;
|
||||||
static char swap_status=0;
|
|
||||||
|
|
||||||
static FILE *swap = NULL;
|
static FILE *swap = NULL;
|
||||||
char mman_patch=0;
|
char mman_patch=0;
|
||||||
|
@ -121,133 +121,97 @@ typedef struct tnametable
|
||||||
int32_t seek;
|
int32_t seek;
|
||||||
}TNAMETABLE;
|
}TNAMETABLE;
|
||||||
|
|
||||||
|
typedef struct tnametable_ref {
|
||||||
|
const TNAMETABLE *data;
|
||||||
|
uint32_t count;
|
||||||
|
} TNAMETABLE_REF;
|
||||||
|
|
||||||
static int32_t *grptable,grptabsiz;
|
static int32_t *grptable,grptabsiz;
|
||||||
static TNAMETABLE *nametable;
|
static TNAMETABLE_REF bmf_nametable;
|
||||||
static int nmtab_size;
|
static TNAMETABLE_REF patch_nametable;
|
||||||
static int next_name_read=0;
|
static int next_name_read=0;
|
||||||
static int last_group;
|
static int last_group;
|
||||||
|
|
||||||
char *main_file_name=NULL;
|
char *main_file_name=NULL;
|
||||||
handle_groups _handles;
|
handle_groups _handles;
|
||||||
static FILE *bmf=NULL;
|
//static FILE *bmf=NULL;
|
||||||
static FILE *patch=NULL;
|
//static FILE *patch=NULL;
|
||||||
|
static void *bmf_m = NULL;
|
||||||
|
static size_t bmf_s = 0;
|
||||||
|
static void *patch_m = NULL;
|
||||||
|
static size_t patch_s = 0;
|
||||||
uint32_t bk_global_counter=0;
|
uint32_t bk_global_counter=0;
|
||||||
char *swap_path;
|
char *swap_path;
|
||||||
|
|
||||||
#ifdef LOGFILE
|
|
||||||
void bonz_table()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
if (bmf==NULL) return;
|
|
||||||
for(i=0;i<nmtab_size;i++)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%-12.12s %12d\n",nametable[i].name,nametable[i].seek);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int test_file_exist_DOS(int group,char *filename)
|
static int test_file_exist_DOS(int group,char *filename)
|
||||||
{
|
{
|
||||||
char *f;
|
const char *f = build_pathname(2, mman_pathlist[group], filename);
|
||||||
|
|
||||||
f=alloca(strlen(mman_pathlist[group])+strlen(filename)+1);
|
|
||||||
strcpy(f,mman_pathlist[group]);
|
|
||||||
strcat(f,filename);
|
|
||||||
if (!check_file_exists(f)) return 0;
|
if (!check_file_exists(f)) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void load_grp_table()
|
void load_grp_table()
|
||||||
{
|
{
|
||||||
int32_t i = 0;;
|
int32_t i = 0;;
|
||||||
|
|
||||||
SEND_LOG("(LOAD) Loading Group Table");
|
SEND_LOG("(LOAD) Loading Group Table");
|
||||||
fseek(bmf,4,SEEK_SET);
|
const uint32_t *src_table = (const uint32_t *)bmf_m;
|
||||||
fread(&i,4,1,bmf);
|
//fseek(bmf,4,SEEK_SET);
|
||||||
|
i = src_table[1];//fread(&i,4,1,bmf);
|
||||||
grptable=(int32_t *)getmem(i+4);
|
grptable=(int32_t *)getmem(i+4);
|
||||||
fseek(bmf,0,SEEK_SET);
|
//fseek(bmf,0,SEEK_SET);
|
||||||
fread(grptable,i,1,bmf);
|
grptabsiz = src_table[0];
|
||||||
|
//fread(grptable,i,1,bmf);
|
||||||
grptabsiz=i;
|
grptabsiz=i;
|
||||||
for(i=0;i<(grptabsiz>>3);i++) grptable[i*2+1]=(grptable[i*2+1]-grptabsiz)>>4;
|
for(i=0;i<(grptabsiz>>3);i++) grptable[i*2+1]=(grptable[i*2+1]-grptabsiz)>>4;
|
||||||
SEND_LOG("(LOAD) Group Table Loaded");
|
SEND_LOG("(LOAD) Group Table Loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_file_table()
|
|
||||||
{
|
|
||||||
int strsize;
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
SEND_LOG("(LOAD) Loading File Table");
|
static TNAMETABLE_REF load_file_table(const void *bmf_m)
|
||||||
fseek(bmf,grptabsiz,SEEK_SET);
|
{
|
||||||
fseek(bmf,12,SEEK_CUR);
|
const uint32_t *src_table = (const uint32_t *)bmf_m;
|
||||||
fread(&strsize,4,1,bmf);
|
uint32_t grptabsiz = src_table[1];
|
||||||
strsize-=grptabsiz;
|
TNAMETABLE_REF out;
|
||||||
fseek(bmf,grptabsiz,SEEK_SET);
|
out.data = (const TNAMETABLE *)((const char *)bmf_m + grptabsiz);
|
||||||
p=getmem(strsize);
|
out.count = (out.data[0].seek - grptabsiz)/sizeof(TNAMETABLE);
|
||||||
nametable = p;
|
return out;
|
||||||
fread(nametable,1,strsize,bmf);
|
|
||||||
nmtab_size=strsize/sizeof(*nametable);
|
|
||||||
SEND_LOG("(LOAD) File Table Loaded");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_file_entry_in_table(const TNAMETABLE_REF *where, char *name) {
|
||||||
int find_name(int group,char *name)
|
for(uint32_t i = 0; i< where->count; ++i) {
|
||||||
{
|
if (strncmp(where->data[i].name, name, 12) == 0) {
|
||||||
int i;
|
return where->data[i].seek;
|
||||||
|
|
||||||
for(i=0;i<(grptabsiz>>2);i+=2)
|
|
||||||
{
|
|
||||||
if (grptable[i]==group) break;
|
|
||||||
}
|
}
|
||||||
if ((grptabsiz>>2)<=i) return -1;
|
|
||||||
for(i=grptable[i+1];i<nmtab_size;i++)
|
|
||||||
if (!strncmp(nametable[i].name,name,12)) break;
|
|
||||||
if (i==nmtab_size) return -1;
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int get_file_entry(int group,char *name)
|
int get_file_entry(int group,char *name)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char ex;
|
char ex;
|
||||||
|
|
||||||
if (mman_patch) ex=test_file_exist_DOS(group,name);else ex=0;
|
ex=test_file_exist_DOS(group,name);
|
||||||
if (ex || bmf==0) return 0;
|
if (ex || bmf_m==0) return 0;
|
||||||
i=find_name(group,name);
|
if (patch_m) {
|
||||||
if (i==-1) return 0;
|
int sk = get_file_entry_in_table(&patch_nametable, name);
|
||||||
return nametable[i].seek;
|
if (sk >= 0) return -sk;
|
||||||
|
}
|
||||||
|
if (bmf_m) {
|
||||||
|
int sk = get_file_entry_in_table(&bmf_nametable, name);
|
||||||
|
if (sk >= 0) return sk;
|
||||||
}
|
}
|
||||||
int swap_block(THANDLE_DATA *h)
|
|
||||||
{
|
|
||||||
int32_t wsize,pos;
|
|
||||||
|
|
||||||
if (mman_action!=NULL) mman_action(MMA_SWAP);
|
|
||||||
if (!swap) return -1;
|
|
||||||
if (h->flags & BK_HSWAP) pos=h->seekpos; else pos=swap_add_block(h->size);
|
|
||||||
fseek(swap,0,SEEK_END);
|
|
||||||
wsize=ftell(swap);
|
|
||||||
fseek(swap,pos,SEEK_SET);
|
|
||||||
SEND_LOG("(SWAP) Swaping block '%-.12s'",h->src_file);
|
|
||||||
wsize=fwrite(h->blockdata,1,h->size,swap);
|
|
||||||
swap_status=1;
|
|
||||||
if ((unsigned)wsize==h->size)
|
|
||||||
{
|
|
||||||
h->seekpos=pos;
|
|
||||||
if (h->flags & BK_PRELOAD) h->flags&=~BK_SWAPABLE;
|
|
||||||
h->flags|=BK_HSWAP;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SEND_LOG("(SWAP) Swap failed!");
|
|
||||||
swap_error();
|
|
||||||
}
|
|
||||||
swap_free_block(pos,h->size);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
THANDLE_DATA *get_handle(int handle)
|
THANDLE_DATA *get_handle(int handle)
|
||||||
{
|
{
|
||||||
|
@ -264,80 +228,16 @@ THANDLE_DATA *get_handle(int handle)
|
||||||
return ((THANDLE_DATA *)_handles[group])+list;
|
return ((THANDLE_DATA *)_handles[group])+list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void heap_error(size_t size) //heap system
|
|
||||||
{
|
|
||||||
int i,j;
|
|
||||||
uint32_t maxcounter=0;
|
|
||||||
THANDLE_DATA *sh;
|
|
||||||
char repeat=0,did=0;
|
|
||||||
THANDLE_DATA *lastblock=NULL;
|
|
||||||
char *last_free=NULL;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
maxcounter=0;
|
|
||||||
sh=NULL;
|
|
||||||
repeat=0;did=0;
|
|
||||||
for(i=0;i<BK_MAJOR_HANDLES;i++)
|
|
||||||
if (_handles[i]!=NULL)
|
|
||||||
{
|
|
||||||
uint32_t c,max=0xffffffff,d;
|
|
||||||
for (j=0;j<BK_MINOR_HANDLES;j++)
|
|
||||||
{
|
|
||||||
THANDLE_DATA *h;
|
|
||||||
|
|
||||||
h=((THANDLE_DATA *)_handles[i]+j);
|
static char need_to_be_free(const void *ptr) {
|
||||||
c=bk_global_counter-h->counter;
|
const char *beg = (const char *)bmf_m;
|
||||||
if (h->status==BK_PRESENT && ~h->flags & BK_LOCKED) {
|
const char *p = (const char *)ptr;
|
||||||
if (last_free!=NULL)
|
if (p >= beg && p < beg+bmf_s) return 0;
|
||||||
{
|
beg = (const char *)patch_m;
|
||||||
d=(char *)h->blockdata-last_free;
|
if (p >= beg && p < beg+bmf_s) return 0;
|
||||||
if (d<max) sh=h,max=d,did=1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (c>maxcounter)
|
|
||||||
{
|
|
||||||
maxcounter=c;
|
|
||||||
sh=h;
|
|
||||||
did=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lastblock==sh)
|
|
||||||
{
|
|
||||||
did=0;repeat=0;
|
|
||||||
}
|
|
||||||
if (did)
|
|
||||||
{
|
|
||||||
size-=sh->size;
|
|
||||||
last_free=sh->blockdata;
|
|
||||||
if (sh->flags & BK_SWAPABLE)
|
|
||||||
{
|
|
||||||
if (swap_block(sh)) //pri neuspechu o ulozeni je nalezen blok jiny
|
|
||||||
{
|
|
||||||
sh->counter=bk_global_counter;
|
|
||||||
repeat=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
free(sh->blockdata);
|
|
||||||
sh->status=BK_SWAPED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (sh->flags & BK_PRELOAD) sh->status=BK_SWAPED;
|
|
||||||
else sh->status=BK_NOT_LOADED;
|
|
||||||
free(sh->blockdata);
|
|
||||||
if (mman_action!=NULL) mman_action(MMA_FREE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
standard_mem_error(size);
|
|
||||||
lastblock=sh;
|
|
||||||
}
|
|
||||||
while (repeat || size>0);
|
|
||||||
// if (swaped) _dos_commit(swap);
|
|
||||||
}
|
|
||||||
|
|
||||||
THANDLE_DATA *kill_block(int handle)
|
THANDLE_DATA *kill_block(int handle)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +251,9 @@ THANDLE_DATA *kill_block(int handle)
|
||||||
}
|
}
|
||||||
SEND_LOG("(KILL) Killing block '%-.12s' (%04X)",h->src_file,handle);
|
SEND_LOG("(KILL) Killing block '%-.12s' (%04X)",h->src_file,handle);
|
||||||
if (h->status==BK_SAME_AS) return h;
|
if (h->status==BK_SAME_AS) return h;
|
||||||
if (h->status==BK_PRESENT) free(h->blockdata);
|
if (h->status==BK_PRESENT) {
|
||||||
|
ablock_free(h->blockdata);
|
||||||
|
}
|
||||||
if (h->flags & BK_HSWAP) swap_free_block(h->seekpos,h->size);
|
if (h->flags & BK_HSWAP) swap_free_block(h->seekpos,h->size);
|
||||||
h->status=BK_NOT_LOADED;
|
h->status=BK_NOT_LOADED;
|
||||||
h->flags&=~BK_HSWAP;
|
h->flags&=~BK_HSWAP;
|
||||||
|
@ -369,6 +271,11 @@ THANDLE_DATA *zneplatnit_block(int handle)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void heap_error() {
|
||||||
|
display_error("out of memory");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
void init_manager(const char *filename,const char *swap_is_not_supported) // filename= Jmeno datoveho souboru nebo NULL pak
|
void init_manager(const char *filename,const char *swap_is_not_supported) // filename= Jmeno datoveho souboru nebo NULL pak
|
||||||
// se pouzije DOS
|
// se pouzije DOS
|
||||||
// swp je cesta do TEMP adresare
|
// swp je cesta do TEMP adresare
|
||||||
|
@ -378,13 +285,12 @@ void init_manager(const char *filename,const char *swap_is_not_supported) // fil
|
||||||
memset(_handles,0,sizeof(_handles));
|
memset(_handles,0,sizeof(_handles));
|
||||||
if (filename!=NULL)
|
if (filename!=NULL)
|
||||||
{
|
{
|
||||||
bmf=fopen_icase(filename,"rb");
|
bmf_m = map_file_to_memory(file_icase_find(filename), &bmf_s);
|
||||||
if (bmf)
|
if (bmf_m)
|
||||||
{
|
{
|
||||||
main_file_name=(char *)getmem(strlen(filename)+1);
|
main_file_name=(char *)getmem(strlen(filename)+1);
|
||||||
strcpy(main_file_name,filename);
|
strcpy(main_file_name,filename);
|
||||||
load_grp_table();
|
bmf_nametable = load_file_table(bmf_m);
|
||||||
load_file_table();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
main_file_name=NULL;
|
main_file_name=NULL;
|
||||||
|
@ -433,11 +339,11 @@ int find_handle(const char *name,void *decomp)
|
||||||
|
|
||||||
int test_file_exist(int group,char *filename)
|
int test_file_exist(int group,char *filename)
|
||||||
{
|
{
|
||||||
if (find_name(group,filename)==-1) return test_file_exist_DOS(group,filename);
|
if (get_file_entry(group,filename)==0) return test_file_exist_DOS(group,filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
THANDLE_DATA *def_handle(int handle,const char *filename,void *decompress,char path)
|
THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decompress,char path)
|
||||||
{
|
{
|
||||||
THANDLE_DATA *h;
|
THANDLE_DATA *h;
|
||||||
int i;
|
int i;
|
||||||
|
@ -473,7 +379,7 @@ THANDLE_DATA *def_handle(int handle,const char *filename,void *decompress,char p
|
||||||
|
|
||||||
void *afile(char *filename,int group,int32_t *blocksize)
|
void *afile(char *filename,int group,int32_t *blocksize)
|
||||||
{
|
{
|
||||||
char *c,*d;
|
char *d;
|
||||||
int32_t entr;
|
int32_t entr;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
@ -484,27 +390,41 @@ void *afile(char *filename,int group,int32_t *blocksize)
|
||||||
else entr=get_file_entry(group,d);
|
else entr=get_file_entry(group,d);
|
||||||
if (entr!=0)
|
if (entr!=0)
|
||||||
{
|
{
|
||||||
FILE *hnd;
|
const void *hnd;
|
||||||
SEND_LOG("(LOAD) Afile is loading file '%s' from group %d",d,group);
|
SEND_LOG("(LOAD) Afile is loading file '%s' from group %d",d,group);
|
||||||
if (entr<0) entr=-entr,hnd=patch;else hnd=bmf;
|
if (entr<0) entr=-entr,hnd=patch_m;else hnd=bmf_m;
|
||||||
fseek(hnd,entr,SEEK_SET);
|
const int32_t * szptr = (const int32_t *)hnd;
|
||||||
fread(blocksize,1,4,hnd);
|
*blocksize = *szptr;
|
||||||
p=getmem(*blocksize);
|
void *ret = getmem(*blocksize);
|
||||||
fread(p,1,*blocksize,hnd);
|
memcpy(ret, szptr+1, *blocksize);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
else if (mman_pathlist!=NULL)
|
else if (mman_pathlist!=NULL)
|
||||||
{
|
{
|
||||||
|
const char *name = build_pathname(2,mman_pathlist[group],d);
|
||||||
|
|
||||||
SEND_LOG("(LOAD) Afile is loading file '%s' from disk (group %d)",d,group);
|
SEND_LOG("(LOAD) Afile is loading file '%s' from disk (group %d)",d,group);
|
||||||
c=alloca(strlen(filename)+strlen(mman_pathlist[group])+2);
|
p=load_file(name);
|
||||||
c=strcat(strcpy(c,mman_pathlist[group]),filename);
|
|
||||||
p=load_file(c);
|
|
||||||
*blocksize=last_load_size;
|
*blocksize=last_load_size;
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ablock(int handle)
|
|
||||||
|
static void decompress_data(THANDLE_DATA *h) {
|
||||||
|
if (h->loadproc) {
|
||||||
|
int32_t sz = h->size;
|
||||||
|
const void *r = h->loadproc(h->blockdata, &sz);
|
||||||
|
if (r != h->blockdata) {
|
||||||
|
ablock_free(h->blockdata);
|
||||||
|
h->blockdata = r;
|
||||||
|
h->size = sz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const void *ablock(int handle)
|
||||||
{
|
{
|
||||||
THANDLE_DATA *h;
|
THANDLE_DATA *h;
|
||||||
|
|
||||||
|
@ -517,10 +437,11 @@ void *ablock(int handle)
|
||||||
handle=h->seekpos;
|
handle=h->seekpos;
|
||||||
goto sem;
|
goto sem;
|
||||||
}
|
}
|
||||||
if (h->status==BK_PRESENT) return h->blockdata;
|
if (h->status==BK_PRESENT) {
|
||||||
if (h->status==BK_DIRLIST)
|
return h->blockdata;
|
||||||
|
} if (h->status==BK_DIRLIST)
|
||||||
{
|
{
|
||||||
free(h->blockdata);h->status=BK_NOT_LOADED;
|
ablock_free(h->blockdata);h->status=BK_NOT_LOADED;
|
||||||
}
|
}
|
||||||
if (h->status==BK_NOT_LOADED)
|
if (h->status==BK_NOT_LOADED)
|
||||||
{
|
{
|
||||||
|
@ -541,27 +462,26 @@ void *ablock(int handle)
|
||||||
p=NULL;
|
p=NULL;
|
||||||
s=0;
|
s=0;
|
||||||
}
|
}
|
||||||
if (h->loadproc!=NULL) h->loadproc(&p,&s);
|
|
||||||
h->blockdata=p;
|
h->blockdata=p;
|
||||||
h->status=BK_PRESENT;
|
h->status=BK_PRESENT;
|
||||||
h->size=s;
|
h->size=s;
|
||||||
return p;
|
decompress_data(h);
|
||||||
|
return h->blockdata;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int entr=h->seekpos;
|
int entr=h->seekpos;
|
||||||
FILE *hnd;
|
const void *hnd;
|
||||||
if (mman_action!=NULL) mman_action(MMA_READ);
|
if (mman_action!=NULL) mman_action(MMA_READ);
|
||||||
if (entr<0) entr=-entr,hnd=patch;else hnd=bmf;
|
if (entr<0) entr=-entr,hnd=patch_m;else hnd=bmf_m;
|
||||||
fseek(hnd,entr,SEEK_SET);
|
const int32_t *szptr =(const int32_t *)((const char *)hnd+entr);
|
||||||
fread(&s,1,4,hnd);
|
s = *szptr;
|
||||||
p=getmem(s);
|
void *p = (void *)(szptr+1);
|
||||||
fread(p,1,s,hnd);
|
|
||||||
if (h->loadproc!=NULL) h->loadproc(&p,&s);
|
|
||||||
h->blockdata=p;
|
h->blockdata=p;
|
||||||
h->status=BK_PRESENT;
|
h->status=BK_PRESENT;
|
||||||
h->size=s;
|
h->size=s;
|
||||||
return p;
|
decompress_data(h);
|
||||||
|
return h->blockdata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//tato cast programu bude jeste dodelana - else ....
|
//tato cast programu bude jeste dodelana - else ....
|
||||||
|
@ -572,6 +492,16 @@ void *ablock(int handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *ablock_copy(int handle) {
|
||||||
|
const void *ptr = ablock(handle);
|
||||||
|
if (need_to_be_free(ptr)) return (void *)ptr;
|
||||||
|
THANDLE_DATA *h = get_handle(handle);
|
||||||
|
void *cpy = getmem(h->size);
|
||||||
|
memcpy(cpy, ptr, h->size);
|
||||||
|
h->blockdata = cpy;
|
||||||
|
return cpy;
|
||||||
|
}
|
||||||
|
|
||||||
void alock(int handle)
|
void alock(int handle)
|
||||||
{
|
{
|
||||||
THANDLE_DATA *h;
|
THANDLE_DATA *h;
|
||||||
|
@ -651,43 +581,6 @@ void apreload_sign(int handle,int max_handle)
|
||||||
if (!(h->flags & BK_PRELOAD) || !(h->flags & BK_HSWAP)) apr_sign[handle]=h->seekpos;
|
if (!(h->flags & BK_PRELOAD) || !(h->flags & BK_HSWAP)) apr_sign[handle]=h->seekpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int apreload_sort(const void *val1,const void *val2)
|
|
||||||
{
|
|
||||||
int32_t vl1,vl2;
|
|
||||||
|
|
||||||
vl1=apr_sign[*(word *)val1];
|
|
||||||
vl2=apr_sign[*(word *)val2];
|
|
||||||
return (vl1>vl2)-(vl1<vl2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void apreload_start(void (*percent)(int cur,int max))
|
|
||||||
{
|
|
||||||
short *p;
|
|
||||||
int i;
|
|
||||||
int c,z;
|
|
||||||
|
|
||||||
swap_status=0;
|
|
||||||
p=NewArr(short,max_sign);
|
|
||||||
for(i=0;i<max_sign;i++) p[i]=i;
|
|
||||||
qsort(p,max_sign,sizeof(word),apreload_sort);
|
|
||||||
for(i=0,c=0;i<max_sign;i++) if (apr_sign[p[i]]==0x7f7f7f7f)p[i]=-1;else c++;
|
|
||||||
for(i=0,z=0;i<max_sign;i++) if (p[i]!=-1)
|
|
||||||
{
|
|
||||||
apreload(p[i]);
|
|
||||||
percent(z++,swap_status?c+max_sign*2:c);
|
|
||||||
}
|
|
||||||
if (swap_status)
|
|
||||||
for(i=0;i<max_sign;i++)
|
|
||||||
{
|
|
||||||
THANDLE_DATA *h=get_handle(p[i]);
|
|
||||||
if (h->status==BK_PRESENT) swap_block(h);
|
|
||||||
percent(c+i,c+max_sign);
|
|
||||||
}
|
|
||||||
// _dos_commit(swap);
|
|
||||||
free(apr_sign);
|
|
||||||
free(p);
|
|
||||||
apr_sign=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void undef_handle(int handle)
|
void undef_handle(int handle)
|
||||||
{
|
{
|
||||||
|
@ -715,11 +608,10 @@ void close_manager()
|
||||||
free(_handles[i]);
|
free(_handles[i]);
|
||||||
}
|
}
|
||||||
free(main_file_name);
|
free(main_file_name);
|
||||||
if (bmf) fclose(bmf);
|
if (bmf_m) unmap_file(bmf_m, bmf_s);
|
||||||
if (patch) fclose(patch);
|
if (patch_m) unmap_file(patch_m, patch_s);
|
||||||
if (swap) fclose(swap);
|
if (swap) fclose(swap);
|
||||||
free(grptable); grptable=NULL;
|
|
||||||
free(nametable); nametable=NULL;
|
|
||||||
max_handle=0;
|
max_handle=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,13 +706,6 @@ void *grealloc(void *p,int32_t size)
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *read_next_entry(char mode)
|
|
||||||
{
|
|
||||||
if (mode==MMR_FIRST) next_name_read=0;
|
|
||||||
if (main_file_name==NULL) return NULL;
|
|
||||||
if (next_name_read>=nmtab_size) return NULL;
|
|
||||||
return nametable[next_name_read++].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
int read_group(int index)
|
int read_group(int index)
|
||||||
{
|
{
|
||||||
|
@ -829,34 +714,13 @@ int read_group(int index)
|
||||||
|
|
||||||
char add_patch_file(char *filename)
|
char add_patch_file(char *filename)
|
||||||
{
|
{
|
||||||
int32_t l;
|
|
||||||
int32_t poc;
|
|
||||||
int i,cc=0;
|
|
||||||
TNAMETABLE p;
|
|
||||||
SEND_LOG("Adding patch: %s",filename);
|
SEND_LOG("Adding patch: %s",filename);
|
||||||
if (!patch) return 2;
|
if (!patch_m) return 2;
|
||||||
if (!bmf) return 3;
|
if (!bmf_m) return 3;
|
||||||
patch=fopen_icase(filename,"rb");
|
patch_m = map_file_to_memory(file_icase_find(filename), &bmf_s);
|
||||||
if (!patch) return 1;
|
if (!patch_m) return 1;
|
||||||
fseek(patch,4,SEEK_SET);
|
patch_nametable = load_file_table(patch_m);
|
||||||
fread(&l,1,4,patch);
|
SEND_LOG("Patch added: %s - %u entries modified",filename,patch_nametable.count);
|
||||||
fseek(patch,l,SEEK_SET);
|
|
||||||
fread(&p,1,sizeof(p),patch);
|
|
||||||
poc=(p.seek-l)/sizeof(p);
|
|
||||||
fseek(patch,l,SEEK_SET);
|
|
||||||
for(i=0;i<poc;i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
fread(&p,1,sizeof(p),patch);
|
|
||||||
j=find_name(read_group(0),p.name);
|
|
||||||
if (j==-1)
|
|
||||||
{
|
|
||||||
nametable=grealloc(nametable,sizeof(TNAMETABLE)*(nmtab_size+1));
|
|
||||||
j=nmtab_size++;strncpy(nametable[j].name,p.name,12);
|
|
||||||
}
|
|
||||||
nametable[j].seek=-p.seek,cc++;
|
|
||||||
}
|
|
||||||
SEND_LOG("Patch added: %s - %d entries modified",filename,cc);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,3 +807,7 @@ FILE *afiletemp(char *filename, int group)
|
||||||
fseek(f,0,SEEK_SET);
|
fseek(f,0,SEEK_SET);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ablock_free(const void *ptr) {
|
||||||
|
if (need_to_be_free(ptr)) free((void *)ptr);
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
///decodes block if needed
|
||||||
|
/**
|
||||||
|
* @param src source data
|
||||||
|
* @param size source size - you need to write own size if data has been converted
|
||||||
|
* @param pointer either to src or newly allocated block with replacement (must be allocated by malloc)
|
||||||
|
*/
|
||||||
|
typedef const void *(*ABLOCK_DECODEPROC)(const void *src, int32_t *size);
|
||||||
|
|
||||||
|
|
||||||
#define freemem(size) free(size);
|
#define freemem(size) free(size);
|
||||||
//#define malloc(size) getmem(size)
|
//#define malloc(size) getmem(size)
|
||||||
|
@ -36,11 +44,11 @@ typedef struct thandle_data
|
||||||
{
|
{
|
||||||
char src_file[12]; //12
|
char src_file[12]; //12
|
||||||
int32_t seekpos; //16
|
int32_t seekpos; //16
|
||||||
void *blockdata; //20
|
const void *blockdata; //20
|
||||||
char flags; //21
|
char flags; //21
|
||||||
uint8_t path; //22
|
uint8_t path; //22
|
||||||
short status;
|
short status;
|
||||||
void (*loadproc)(void **data,int32_t *size);//28
|
ABLOCK_DECODEPROC loadproc;
|
||||||
unsigned short lockcount; //32
|
unsigned short lockcount; //32
|
||||||
uint32_t counter;
|
uint32_t counter;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
@ -66,6 +74,7 @@ typedef handle_list *handle_groups[BK_MAJOR_HANDLES];
|
||||||
#define BK_SHARED 4
|
#define BK_SHARED 4
|
||||||
#define BK_PRELOAD 8
|
#define BK_PRELOAD 8
|
||||||
#define BK_HSWAP 16
|
#define BK_HSWAP 16
|
||||||
|
#define BK_READONLY 32
|
||||||
|
|
||||||
//extern char *const * mman_pathlist; //tento pointer musi byt naplnen ukazatelem na tabulku cest
|
//extern char *const * mman_pathlist; //tento pointer musi byt naplnen ukazatelem na tabulku cest
|
||||||
extern int memman_handle; //cislo handle naposled zpracovavaneho prikazem ablock
|
extern int memman_handle; //cislo handle naposled zpracovavaneho prikazem ablock
|
||||||
|
@ -75,13 +84,13 @@ void *grealloc(void *m,int32_t size); //realokace pameti pres memman
|
||||||
void *load_file(const char *filename); //obycejne natahne soubor do pameti a vrati ukazatel.
|
void *load_file(const char *filename); //obycejne natahne soubor do pameti a vrati ukazatel.
|
||||||
void init_manager(const char *filename,const char *swp); //inicializuje manager. Jmeno filename i swapname nejsou povinne (musi byt NULL kdyz nejsou pouzity)
|
void init_manager(const char *filename,const char *swp); //inicializuje manager. Jmeno filename i swapname nejsou povinne (musi byt NULL kdyz nejsou pouzity)
|
||||||
void def_mman_group_table(const char ** ); //define pointer to table of paths, for each group there is path
|
void def_mman_group_table(const char ** ); //define pointer to table of paths, for each group there is path
|
||||||
THANDLE_DATA *def_handle(int handle,const char *filename,void *decompress,char path); //deklaruje rukojet. promenna decompress je ukazatel na funkci ktera upravi data pred vracenim ukazatele
|
THANDLE_DATA *def_handle(int handle,const char *filename,ABLOCK_DECODEPROC decompress,char path); //deklaruje rukojet. promenna decompress je ukazatel na funkci ktera upravi data pred vracenim ukazatele
|
||||||
void *ablock(int handle); //vraci ukazatel bloku spojeneho s handlem
|
const void *ablock(int handle); //vraci ukazatel bloku spojeneho s handlem
|
||||||
|
void *ablock_copy(int handle); //vraci ukazatel bloku spojeneho s handlem
|
||||||
void alock(int handle); //zamyka blok
|
void alock(int handle); //zamyka blok
|
||||||
void aunlock(int handle); //odmyka blok
|
void aunlock(int handle); //odmyka blok
|
||||||
void aswap(int handle); //zapina swapovani pro blok
|
void aswap(int handle); //zapina swapovani pro blok
|
||||||
void aunswap(int handle); //vypina swapovani pro blok
|
void aunswap(int handle); //vypina swapovani pro blok
|
||||||
void apreload(int handle); //zapina preloading pro blok (preloading proved pomoci ablock)
|
|
||||||
//void free(void); //free
|
//void free(void); //free
|
||||||
void close_manager(void); //uzavre manager a uvolni veskerou pamet
|
void close_manager(void); //uzavre manager a uvolni veskerou pamet
|
||||||
void undef_handle(int handle); //uvolni hadle k dalsimu pouziti
|
void undef_handle(int handle); //uvolni hadle k dalsimu pouziti
|
||||||
|
@ -92,11 +101,9 @@ int test_file_exist(int group,char *filename); //testuje zda soubor existuje v r
|
||||||
void *afile(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru
|
void *afile(char *filename,int group,int32_t *blocksize); //nahraje do pameti soubor registrovany v ramci mmanageru
|
||||||
int32_t get_handle_size(int handle);
|
int32_t get_handle_size(int handle);
|
||||||
//void get_mem_info(MEMORYSTATUS *mem);
|
//void get_mem_info(MEMORYSTATUS *mem);
|
||||||
|
void ablock_free(const void *ptr);
|
||||||
|
|
||||||
void apreload_sign(int handle,int max_handle); //pripravi preloading pro nacteni dat z CD (sekvencne)
|
|
||||||
void apreload_start(void (*percent)(int cur,int max)); //provede sekvenci apreload
|
|
||||||
|
|
||||||
char *read_next_entry(char mode); //cte adresar DDL souboru a vraci jmeno, nebo NULL. mode udava, zda se hleda od zacatku, nebo pokracuje tam kde program skoncil
|
|
||||||
int read_group(int index);
|
int read_group(int index);
|
||||||
char add_patch_file(char *filename); //pripojuje zaplatu
|
char add_patch_file(char *filename); //pripojuje zaplatu
|
||||||
FILE *afiletemp(char *filename, int group);
|
FILE *afiletemp(char *filename, int group);
|
||||||
|
|
|
@ -123,7 +123,7 @@ static void StretchImageHQ(word *src, word *trg, int32_t linelen, char full)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void PlayMGFFile(void *file, MGIF_PROC proc,int ypos,char full)
|
static void PlayMGFFile(const void *file, MGIF_PROC proc,int ypos,char full)
|
||||||
{
|
{
|
||||||
int32_t scr_linelen2 = GetScreenPitch();
|
int32_t scr_linelen2 = GetScreenPitch();
|
||||||
mgif_install_proc(proc);
|
mgif_install_proc(proc);
|
||||||
|
@ -144,7 +144,9 @@ static void PlayMGFFile(void *file, MGIF_PROC proc,int ypos,char full)
|
||||||
file=mgif_play(file);
|
file=mgif_play(file);
|
||||||
StretchImageHQ(picture, GetScreenAdr()+ypos*scr_linelen2, scr_linelen2,full);
|
StretchImageHQ(picture, GetScreenAdr()+ypos*scr_linelen2, scr_linelen2,full);
|
||||||
showview(0,ypos,0,360);
|
showview(0,ypos,0,360);
|
||||||
if (_bios_keybrd(_KEYBRD_READY)==0) {
|
if (game_display_is_quit_requested()) {
|
||||||
|
break;
|
||||||
|
} else if (_bios_keybrd(_KEYBRD_READY)==0) {
|
||||||
mix_back_sound(0);
|
mix_back_sound(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -159,13 +161,13 @@ static void PlayMGFFile(void *file, MGIF_PROC proc,int ypos,char full)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void show_full_lfb12e(void *target,void *buff,void *paleta);
|
void show_full_lfb12e(void *target,const void *buff,const void *paleta);
|
||||||
void show_delta_lfb12e(void *target,void *buff,void *paleta);
|
void show_delta_lfb12e(void *target,const void *buff,const void *paleta);
|
||||||
void show_delta_lfb12e_dx(void *target,void *buff,void *paleta);
|
void show_delta_lfb12e_dx(void *target,void *buff,void *paleta);
|
||||||
void show_full_lfb12e_dx(void *target,void *buff,void *paleta);
|
void show_full_lfb12e_dx(void *target,void *buff,void *paleta);
|
||||||
|
|
||||||
|
|
||||||
word * load_mgf_palette(word *pal) {
|
word * load_mgf_palette(const word *pal) {
|
||||||
static word paleta[256];
|
static word paleta[256];
|
||||||
for (int i = 0; i < 256; ++i) {
|
for (int i = 0; i < 256; ++i) {
|
||||||
paleta[i] = pal[i]+(pal[i]&0x7fe0);
|
paleta[i] = pal[i]+(pal[i]&0x7fe0);
|
||||||
|
@ -173,7 +175,7 @@ word * load_mgf_palette(word *pal) {
|
||||||
return paleta;
|
return paleta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BigPlayProc(int act,void *data,int csize)
|
void BigPlayProc(int act,const void *data,int csize)
|
||||||
{
|
{
|
||||||
switch (act)
|
switch (act)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +191,7 @@ void BigPlayProc(int act,void *data,int csize)
|
||||||
void play_animation(const char *filename,char mode,int posy,char sound)
|
void play_animation(const char *filename,char mode,int posy,char sound)
|
||||||
{
|
{
|
||||||
size_t sz;
|
size_t sz;
|
||||||
void *mgf=map_file_to_memory(filename, &sz);
|
void *mgf=map_file_to_memory(file_icase_find(filename), &sz);
|
||||||
change_music(NULL);
|
change_music(NULL);
|
||||||
if (mgf==NULL) return;
|
if (mgf==NULL) return;
|
||||||
PlayMGFFile(mgf,BigPlayProc,posy,mode & 0x80);
|
PlayMGFFile(mgf,BigPlayProc,posy,mode & 0x80);
|
||||||
|
|
|
@ -74,9 +74,9 @@ void mgif_install_proc(MGIF_PROC proc)
|
||||||
show_proc=proc;
|
show_proc=proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mgif_header load_mgif_header(char **mgif) {
|
struct mgif_header load_mgif_header(const char **mgif) {
|
||||||
struct mgif_header r;
|
struct mgif_header r;
|
||||||
char *iter = *mgif;
|
const char *iter = *mgif;
|
||||||
memcpy(r.sign, iter, 4); iter+=4;
|
memcpy(r.sign, iter, 4); iter+=4;
|
||||||
memcpy(r.year, iter, 2); iter+=2;
|
memcpy(r.year, iter, 2); iter+=2;
|
||||||
r.eof = *iter++;
|
r.eof = *iter++;
|
||||||
|
@ -90,9 +90,9 @@ struct mgif_header load_mgif_header(char **mgif) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *open_mgif(void *mgif) //vraci ukazatel na prvni frame
|
const void *open_mgif(const void *mgif) //vraci ukazatel na prvni frame
|
||||||
{
|
{
|
||||||
char *c = mgif;
|
const char *c = mgif;
|
||||||
struct mgif_header mgh = load_mgif_header(&c);
|
struct mgif_header mgh = load_mgif_header(&c);
|
||||||
|
|
||||||
if (strncmp(mgh.sign,MGIF,4)) return NULL;
|
if (strncmp(mgh.sign,MGIF,4)) return NULL;
|
||||||
|
@ -111,9 +111,9 @@ void close_mgif(void) //dealokuje buffery pro prehravani
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int input_code(void *source,int32_t *bitepos,int bitsize,int mask)
|
int input_code(const void *source,int32_t *bitepos,int bitsize,int mask)
|
||||||
{
|
{
|
||||||
uint8_t *esi = source; // mov esi,source
|
const uint8_t *esi = source; // mov esi,source
|
||||||
int32_t *edi = bitepos; // mov edi,bitepos
|
int32_t *edi = bitepos; // mov edi,bitepos
|
||||||
int ebx = bitsize; // mov ebx,bitsize
|
int ebx = bitsize; // mov ebx,bitsize
|
||||||
int edx = mask; // mov edx,mask
|
int edx = mask; // mov edx,mask
|
||||||
|
@ -276,7 +276,7 @@ end:
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void lzw_decode(void *source,char *target)
|
void lzw_decode(const void *source,char *target)
|
||||||
{
|
{
|
||||||
int32_t bitpos=0;
|
int32_t bitpos=0;
|
||||||
int code;
|
int code;
|
||||||
|
@ -332,7 +332,7 @@ typedef struct chunk_header_t {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
} CHUNK_HEADER_T;
|
} CHUNK_HEADER_T;
|
||||||
|
|
||||||
CHUNK_HEADER_T read_chunk_header(char **iter) {
|
CHUNK_HEADER_T read_chunk_header(const char **iter) {
|
||||||
CHUNK_HEADER_T ret;
|
CHUNK_HEADER_T ret;
|
||||||
ret.type = *(uint8_t *)(*iter)++;
|
ret.type = *(uint8_t *)(*iter)++;
|
||||||
ret.size = *(uint8_t *)(*iter)++;
|
ret.size = *(uint8_t *)(*iter)++;
|
||||||
|
@ -341,7 +341,7 @@ CHUNK_HEADER_T read_chunk_header(char **iter) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAME_HEADER_T read_frame_header(char **iter) {
|
FRAME_HEADER_T read_frame_header(const char **iter) {
|
||||||
FRAME_HEADER_T ret;
|
FRAME_HEADER_T ret;
|
||||||
ret.count = *(uint8_t *)(*iter)++;
|
ret.count = *(uint8_t *)(*iter)++;
|
||||||
ret.size = *(uint8_t *)(*iter)++;
|
ret.size = *(uint8_t *)(*iter)++;
|
||||||
|
@ -350,11 +350,13 @@ FRAME_HEADER_T read_frame_header(char **iter) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *mgif_play(void *mgif) //dekoduje a zobrazi frame
|
const void *mgif_play(const void *mgif) //dekoduje a zobrazi frame
|
||||||
{
|
{
|
||||||
char *pf,*pc,*ff;
|
const char *pf;
|
||||||
|
const char *pc;
|
||||||
|
char *ff;
|
||||||
// int acts,size,act,csize;
|
// int acts,size,act,csize;
|
||||||
void *scr_sav;
|
const void *scr_sav;
|
||||||
int scr_act=-1;
|
int scr_act=-1;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//!!!! POZOR, NUTNE LINKOVAT SOUBOR LZWA.ASM
|
//!!!! POZOR, NUTNE LINKOVAT SOUBOR LZWA.ASM
|
||||||
#ifndef _MGIFMEM_H
|
#ifndef _MGIFMEM_H
|
||||||
|
|
||||||
typedef void (*MGIF_PROC)(int,void *,int csize); //prvni cislo akce, druhy data akce
|
typedef void (*MGIF_PROC)(int,const void *,int csize); //prvni cislo akce, druhy data akce
|
||||||
|
|
||||||
#define _MGIFMEM_H
|
#define _MGIFMEM_H
|
||||||
#define MGIF "MGIF"
|
#define MGIF "MGIF"
|
||||||
|
@ -34,7 +34,7 @@ typedef struct mgif_header
|
||||||
|
|
||||||
|
|
||||||
void mgif_install_proc(MGIF_PROC proc);
|
void mgif_install_proc(MGIF_PROC proc);
|
||||||
void *open_mgif(void *mgif); //vraci ukazatel na prvni frame
|
const void *open_mgif(const void *mgif); //vraci ukazatel na prvni frame
|
||||||
void *mgif_play(void *mgif); //dekoduje a zobrazi frame
|
const void *mgif_play(const void *mgif); //dekoduje a zobrazi frame
|
||||||
void close_mgif(void); //dealokuje buffery pro prehravani
|
void close_mgif(void); //dealokuje buffery pro prehravani
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
void show_full_lfb12e(void *target, void *buff, void *paleta) {
|
void show_full_lfb12e(void *target,const void *buff, const void *paleta) {
|
||||||
uint16_t *edi = (uint16_t *)target;
|
uint16_t *edi = (uint16_t *)target;
|
||||||
uint8_t *esi = (uint8_t *)buff;
|
uint8_t *esi = (uint8_t *)buff;
|
||||||
uint16_t *ebx = (uint16_t *)paleta;
|
uint16_t *ebx = (uint16_t *)paleta;
|
||||||
|
|
49
libs/pcx.c
49
libs/pcx.c
|
@ -13,9 +13,9 @@
|
||||||
void *get_palette_ptr=NULL;
|
void *get_palette_ptr=NULL;
|
||||||
|
|
||||||
|
|
||||||
void decomprimate_line_256(char *src,char *trg,int linelen,int *srcstep)
|
void decomprimate_line_256(const char *src,char *trg,int linelen,int *srcstep)
|
||||||
{
|
{
|
||||||
char *srcsave;
|
const char *srcsave;
|
||||||
|
|
||||||
srcsave=src;
|
srcsave=src;
|
||||||
while (linelen--)
|
while (linelen--)
|
||||||
|
@ -31,9 +31,9 @@ void decomprimate_line_256(char *src,char *trg,int linelen,int *srcstep)
|
||||||
}
|
}
|
||||||
*srcstep=src-srcsave;
|
*srcstep=src-srcsave;
|
||||||
}
|
}
|
||||||
void decomprimate_line_hi(char *src,unsigned short *trg,unsigned short *paleta,int linelen,int *srcstep)
|
void decomprimate_line_hi(const char *src,unsigned short *trg,unsigned short *paleta,int linelen,int *srcstep)
|
||||||
{
|
{
|
||||||
char *srcsave;
|
const char *srcsave;
|
||||||
|
|
||||||
srcsave=src;
|
srcsave=src;
|
||||||
while (linelen--)
|
while (linelen--)
|
||||||
|
@ -52,10 +52,10 @@ void decomprimate_line_hi(char *src,unsigned short *trg,unsigned short *paleta,i
|
||||||
*srcstep=src-srcsave;
|
*srcstep=src-srcsave;
|
||||||
}
|
}
|
||||||
|
|
||||||
void palette_shadow(char *pal1,unsigned short pal2[][256],int tr,int tg,int tb)
|
void palette_shadow(const char *pal1,unsigned short pal2[][256],int tr,int tg,int tb)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
char *bt;
|
const char *bt;
|
||||||
int r,g,b;
|
int r,g,b;
|
||||||
short hi;
|
short hi;
|
||||||
|
|
||||||
|
@ -90,14 +90,15 @@ void palette_shadow(char *pal1,unsigned short pal2[][256],int tr,int tg,int tb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int load_pcx(char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
int load_pcx(const char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
||||||
//dale nasleduji int hodnoty poctu prechodu a R,G,B barvy
|
//dale nasleduji int hodnoty poctu prechodu a R,G,B barvy
|
||||||
{
|
{
|
||||||
unsigned short paleta2[256];
|
unsigned short paleta2[256];
|
||||||
char *paleta1;
|
const char *paleta1;
|
||||||
char *ptr1;
|
const char *ptr1;
|
||||||
|
char *ptr4;
|
||||||
unsigned short *ptr2;
|
unsigned short *ptr2;
|
||||||
char *ptr3;
|
const char *ptr3;
|
||||||
int i;
|
int i;
|
||||||
PCXHEADER pcxdata;
|
PCXHEADER pcxdata;
|
||||||
int xsize,ysize;
|
int xsize,ysize;
|
||||||
|
@ -129,20 +130,20 @@ int load_pcx(char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
||||||
case A_NORMAL_PAL: *buffer=(char *)getmem(sz = xsize*ysize+16+768);break;
|
case A_NORMAL_PAL: *buffer=(char *)getmem(sz = xsize*ysize+16+768);break;
|
||||||
default: return -2; //invalid type specificied
|
default: return -2; //invalid type specificied
|
||||||
}
|
}
|
||||||
ptr1=*buffer;
|
ptr4=*buffer;
|
||||||
*(unsigned short *)ptr1++=xsize;ptr1++;
|
*(unsigned short *)ptr4++=xsize;ptr4++;
|
||||||
*(unsigned short *)ptr1++=ysize;ptr1++;
|
*(unsigned short *)ptr4++=ysize;ptr4++;
|
||||||
*(unsigned short *)ptr1++=conv_type;ptr1++;
|
*(unsigned short *)ptr4++=conv_type;ptr4++;
|
||||||
pcx+=sizeof(pcxdata);ptr3=pcx;
|
pcx+=sizeof(pcxdata);ptr3=pcx;
|
||||||
if (conv_type==A_NORMAL_PAL)
|
if (conv_type==A_NORMAL_PAL)
|
||||||
{
|
{
|
||||||
memcpy(ptr1,paleta1,768);
|
memcpy(ptr4,paleta1,768);
|
||||||
ptr1+=768;
|
ptr4+=768;
|
||||||
}
|
}
|
||||||
if (conv_type==A_8BIT)
|
if (conv_type==A_8BIT)
|
||||||
{
|
{
|
||||||
memcpy(ptr1,paleta2,512);
|
memcpy(ptr4,paleta2,512);
|
||||||
ptr1+=512;
|
ptr4+=512;
|
||||||
}
|
}
|
||||||
if (conv_type==A_FADE_PAL)
|
if (conv_type==A_FADE_PAL)
|
||||||
{
|
{
|
||||||
|
@ -154,8 +155,8 @@ int load_pcx(char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
||||||
tg=va_arg(lst,int);
|
tg=va_arg(lst,int);
|
||||||
tb=va_arg(lst,int);
|
tb=va_arg(lst,int);
|
||||||
va_end(lst);
|
va_end(lst);
|
||||||
palette_shadow(paleta1,(unsigned short (*)[256])ptr1,tr,tg,tb);
|
palette_shadow(paleta1,(unsigned short (*)[256])ptr4,tr,tg,tb);
|
||||||
ptr1+=SHADE_PAL;
|
ptr4+=SHADE_PAL;
|
||||||
}
|
}
|
||||||
ysize++;
|
ysize++;
|
||||||
while (--ysize)
|
while (--ysize)
|
||||||
|
@ -163,13 +164,13 @@ int load_pcx(char *pcx,int32_t fsize,int conv_type,char **buffer, ... )
|
||||||
int step;
|
int step;
|
||||||
if (conv_type==A_16BIT)
|
if (conv_type==A_16BIT)
|
||||||
{
|
{
|
||||||
decomprimate_line_hi(ptr3,(unsigned short *)ptr1,paleta2,pcxdata.bytesperline,&step);
|
decomprimate_line_hi(ptr3,(unsigned short *)ptr4,paleta2,pcxdata.bytesperline,&step);
|
||||||
ptr1+=2*xsize;
|
ptr4+=2*xsize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
decomprimate_line_256(ptr3,ptr1,pcxdata.bytesperline,&step);
|
decomprimate_line_256(ptr3,ptr4,pcxdata.bytesperline,&step);
|
||||||
ptr1+=xsize;
|
ptr4+=xsize;
|
||||||
}
|
}
|
||||||
ptr3+=step;
|
ptr3+=step;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
//returns <0 error, >0 allocated size
|
//returns <0 error, >0 allocated size
|
||||||
int load_pcx(char *pcx,int32_t fsize,int conv_type,char **buffer, ... );
|
int load_pcx(const char *pcx,int32_t fsize,int conv_type,char **buffer, ... );
|
||||||
int open_pcx(const char *filename,int type,char **buffer,...);
|
int open_pcx(const char *filename,int type,char **buffer,...);
|
||||||
void palette_shadow(char *pal1,unsigned short pal2[][256],int tr,int tg,int tb);
|
void palette_shadow(const char *pal1,unsigned short pal2[][256],int tr,int tg,int tb);
|
||||||
extern void *get_palette_ptr;
|
extern void *get_palette_ptr;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wav_mem.h"
|
#include "wav_mem.h"
|
||||||
|
|
||||||
char *find_chunk(char *wav,char *name)
|
const char *find_chunk(const char *wav,char *name) //TODO improve
|
||||||
{
|
{
|
||||||
int32_t next;
|
int32_t next;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ char *find_chunk(char *wav,char *name)
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_chunk_size(char *wav)
|
int get_chunk_size(const char *wav)
|
||||||
{
|
{
|
||||||
int32_t size;
|
int32_t size;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ int get_chunk_size(char *wav)
|
||||||
return(size);
|
return(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_chunk(char *wav,void *mem)
|
int read_chunk(const char *wav,void *mem)
|
||||||
{
|
{
|
||||||
|
|
||||||
wav+=4;
|
wav+=4;
|
||||||
|
|
|
@ -12,9 +12,9 @@ typedef struct t_wave
|
||||||
int32_t freq,bps;
|
int32_t freq,bps;
|
||||||
}T_WAVE;
|
}T_WAVE;
|
||||||
|
|
||||||
char *find_chunk(char *wav,char *name);
|
const char *find_chunk(const char *wav,char *name);
|
||||||
int get_chunk_size(char *wav);
|
int get_chunk_size(const char *wav);
|
||||||
int read_chunk(char *wav,void *mem);
|
int read_chunk(const char *wav,void *mem);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@ int sound_detect(int *dev,int *port,int *dma, int *irq);
|
||||||
void set_mixing_device(int mix_dev,int mix_freq,...);
|
void set_mixing_device(int mix_dev,int mix_freq,...);
|
||||||
char start_mixing(void);
|
char start_mixing(void);
|
||||||
void stop_mixing(void);
|
void stop_mixing(void);
|
||||||
void play_sample(int channel,void *sample,int32_t size,int32_t lstart,int32_t sfreq,int type);
|
void play_sample(int channel,const void *sample,int32_t size,int32_t lstart,int32_t sfreq,int type);
|
||||||
void set_channel_volume(int channel,int left,int right);
|
void set_channel_volume(int channel,int left,int right);
|
||||||
void set_end_of_song_callback(const char * (*cb)(void *), void *ctx);
|
void set_end_of_song_callback(const char * (*cb)(void *), void *ctx);
|
||||||
|
|
||||||
|
@ -43,14 +43,14 @@ char get_channel_state(int channel);
|
||||||
void get_channel_volume(int channel,int *left,int *right);
|
void get_channel_volume(int channel,int *left,int *right);
|
||||||
void mute_channel(int channel);
|
void mute_channel(int channel);
|
||||||
void chan_break_loop(int channel);
|
void chan_break_loop(int channel);
|
||||||
void chan_break_ext(int channel,void *org_sample,int32_t size_sample); //zrusi loop s moznosti dohrat zvuk
|
void chan_break_ext(int channel,const void *org_sample,int32_t size_sample); //zrusi loop s moznosti dohrat zvuk
|
||||||
|
|
||||||
char set_snd_effect(int funct,int data);
|
char set_snd_effect(int funct,int data);
|
||||||
char check_snd_effect(int funct);
|
char check_snd_effect(int funct);
|
||||||
int get_snd_effect(int funct);
|
int get_snd_effect(int funct);
|
||||||
|
|
||||||
void *PrepareVideoSound(int mixfreq, int buffsize);
|
void *PrepareVideoSound(int mixfreq, int buffsize);
|
||||||
char LoadNextVideoFrame(void *buffer, char *data, int size, short *xlat, short *accnums, int32_t *writepos);
|
char LoadNextVideoFrame(void *buffer, const char *data, int size, const short *xlat, short *accnums, int32_t *writepos);
|
||||||
void DoneVideoSound(void *buffer);
|
void DoneVideoSound(void *buffer);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,14 @@ char check_file_exists(const char *pathname) {
|
||||||
return std::filesystem::exists(path)?1:0;
|
return std::filesystem::exists(path)?1:0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *file_icase_find(const char *pathname) {
|
||||||
|
static std::string p;
|
||||||
|
std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname));
|
||||||
|
p = path;
|
||||||
|
return p.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
FILE *fopen_icase(const char *pathname, const char *mode) {
|
FILE *fopen_icase(const char *pathname, const char *mode) {
|
||||||
std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname));
|
std::filesystem::path path = try_to_find_file(convert_pathname_to_path(pathname));
|
||||||
return fopen(path.c_str(), mode);
|
return fopen(path.c_str(), mode);
|
||||||
|
|
|
@ -144,7 +144,10 @@ void term_task(int id_num) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char is_running(int id_num) {
|
char is_running(int id_num) {
|
||||||
return id_num < 0 || task_list.find(id_num) != task_list.end();
|
if (id_num < 0) return false;
|
||||||
|
auto iter = task_list.find(id_num);
|
||||||
|
if (iter == task_list.end()) return false;
|
||||||
|
return !iter->second->exited;
|
||||||
}
|
}
|
||||||
void unsuspend_task(EVENT_MSG *msg) {
|
void unsuspend_task(EVENT_MSG *msg) {
|
||||||
if (current_task_inst) return;
|
if (current_task_inst) return;
|
||||||
|
@ -166,7 +169,7 @@ void task_sleep(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EVENT_MSG *task_wait_event(int32_t event_number) {
|
EVENT_MSG *task_wait_event(int32_t event_number) {
|
||||||
if (current_task_inst == NULL) return NULL;
|
if (current_task_inst == NULL || current_task_inst->request_exit || current_task_inst->exited) return NULL;
|
||||||
current_task_inst->wake_up_msg = event_number;
|
current_task_inst->wake_up_msg = event_number;
|
||||||
switch_to_task(NULL);
|
switch_to_task(NULL);
|
||||||
return cur_message;
|
return cur_message;
|
||||||
|
@ -178,6 +181,14 @@ char task_quitmsg() {
|
||||||
if (current_task_inst == NULL) return 0;
|
if (current_task_inst == NULL) return 0;
|
||||||
return current_task_inst->request_exit?1:0;
|
return current_task_inst->request_exit?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void term_task_wait(int id_num) {
|
||||||
|
term_task(id_num);
|
||||||
|
while (is_running(id_num)) {
|
||||||
|
task_sleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char q_is_mastertask() {
|
char q_is_mastertask() {
|
||||||
return current_task_inst == NULL;
|
return current_task_inst == NULL;
|
||||||
}
|
}
|
||||||
|
@ -185,5 +196,8 @@ int q_current_task() {
|
||||||
return current_task_inst?current_task_inst->id:-1;
|
return current_task_inst?current_task_inst->id:-1;
|
||||||
}
|
}
|
||||||
void task_sleep_for(unsigned int time_ms) {
|
void task_sleep_for(unsigned int time_ms) {
|
||||||
|
if (current_task_inst) {
|
||||||
|
current_task_inst->_wake_up_after = std::chrono::system_clock::now() + std::chrono::milliseconds(time_ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ int add_task(int stack,TaskerFunctionName fcname,...);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void term_task(int id_num);
|
void term_task(int id_num);
|
||||||
|
void term_task_wait(int id_num);
|
||||||
///returns true, if task is running
|
///returns true, if task is running
|
||||||
char is_running(int id_num);
|
char is_running(int id_num);
|
||||||
//void suspend_task(int id_num,int msg);
|
//void suspend_task(int id_num,int msg);
|
||||||
|
|
|
@ -64,6 +64,7 @@ void display_error(const char *text);
|
||||||
///returns -1 if doesn't exists
|
///returns -1 if doesn't exists
|
||||||
char check_file_exists(const char *pathname);
|
char check_file_exists(const char *pathname);
|
||||||
FILE *fopen_icase(const char *pathname, const char *mode);
|
FILE *fopen_icase(const char *pathname, const char *mode);
|
||||||
|
const char *file_icase_find(const char *pathname);
|
||||||
|
|
||||||
int stricmp(const char *a, const char *b);
|
int stricmp(const char *a, const char *b);
|
||||||
#define MIN(a, b) ((a)<(b)?(a):(b))
|
#define MIN(a, b) ((a)<(b)?(a):(b))
|
||||||
|
|
|
@ -89,13 +89,13 @@ int DxGetResY() {
|
||||||
void setvesa_displaystart(int x,int y){
|
void setvesa_displaystart(int x,int y){
|
||||||
|
|
||||||
}
|
}
|
||||||
void StripBlt(void *data, unsigned int startline, uint32_t width) {
|
void StripBlt(const void *data, unsigned int startline, uint32_t width) {
|
||||||
|
|
||||||
unsigned short *start=startline*GetScreenPitch()+GetScreenAdr();
|
unsigned short *start=startline*GetScreenPitch()+GetScreenAdr();
|
||||||
while (width--)
|
while (width--)
|
||||||
{
|
{
|
||||||
memcpy(start,data,640*2);
|
memcpy(start,data,640*2);
|
||||||
data=(void *)(reinterpret_cast<short *>(data)+GetScreenPitch());
|
data=(void *)(reinterpret_cast<const short *>(data)+GetScreenPitch());
|
||||||
start=start+GetScreenPitch();
|
start=start+GetScreenPitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +214,12 @@ void DxDoneTurn(void *handle) {
|
||||||
sdl.swap_display_buffers(); //present hidden buffer
|
sdl.swap_display_buffers(); //present hidden buffer
|
||||||
|
|
||||||
}
|
}
|
||||||
void DxTurnLeftRight(char right, float phase, int border, int ypos, int *last) {
|
|
||||||
|
|
||||||
|
|
||||||
|
char game_display_is_quit_requested() {
|
||||||
|
return get_sdl_global_context().is_quit_requested()?1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void game_display_cancel_quit_request() {
|
||||||
|
return get_sdl_global_context().cancel_quit_request();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ void RedirectScreenBufferSecond(void);
|
||||||
char game_display_init(const INI_CONFIG_SECTION *display_section, const char *title);
|
char game_display_init(const INI_CONFIG_SECTION *display_section, const char *title);
|
||||||
void game_display_close(void);
|
void game_display_close(void);
|
||||||
void game_display_update_rect(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
|
void game_display_update_rect(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
|
||||||
|
char game_display_is_quit_requested();
|
||||||
|
void game_display_cancel_quit_request();
|
||||||
|
|
||||||
void *DxPrepareWalk(int ypos);
|
void *DxPrepareWalk(int ypos);
|
||||||
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);
|
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);
|
||||||
|
@ -49,7 +49,7 @@ void DXMouseTransform(unsigned short *x, unsigned short *y);
|
||||||
//HWND GetGameWindow();
|
//HWND GetGameWindow();
|
||||||
//void DxLockBuffers(BOOL lock);
|
//void DxLockBuffers(BOOL lock);
|
||||||
|
|
||||||
void StripBlt(void *data, unsigned int startline, uint32_t width);
|
void StripBlt(const void *data, unsigned int startline, uint32_t width);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -125,7 +125,8 @@ constexpr auto sdl_keycode_map = KeyCodeMap({
|
||||||
{SDL_SCANCODE_KP_8,0x4838,0x4800,0x8D00},
|
{SDL_SCANCODE_KP_8,0x4838,0x4800,0x8D00},
|
||||||
{SDL_SCANCODE_KP_9,0x4939,0x4900,0x8400},
|
{SDL_SCANCODE_KP_9,0x4939,0x4900,0x8400},
|
||||||
{SDL_SCANCODE_KP_0,0x5230,0x5200,0x9200},
|
{SDL_SCANCODE_KP_0,0x5230,0x5200,0x9200},
|
||||||
{SDL_SCANCODE_KP_PERIOD,0x532E,0x5300,0x9300}
|
{SDL_SCANCODE_KP_PERIOD,0x532E,0x5300,0x9300},
|
||||||
|
{SDL_SCANCODE_KP_ENTER,0x1C0D,0x1C0D,0x1C0D}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,16 +186,13 @@ void SDLContext::event_loop(std::stop_token stp) {
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
while (SDL_WaitEvent(&e)) {
|
while (SDL_WaitEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT) {
|
if (e.type == SDL_QUIT) {
|
||||||
return;
|
_quit_requested = true;
|
||||||
}
|
if (_quit_callback) _quit_callback();
|
||||||
if (e.type == exit_loop_event) {
|
} else if (e.type == exit_loop_event) {
|
||||||
return;
|
break;
|
||||||
}
|
} else if (e.type == _update_request_event) {
|
||||||
if (e.type == _update_request_event) {
|
|
||||||
update_screen();
|
update_screen();
|
||||||
}
|
} else if (e.type == SDL_WINDOWEVENT) {
|
||||||
|
|
||||||
if (e.type == SDL_WINDOWEVENT) {
|
|
||||||
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||||
_crt_effect.reset();
|
_crt_effect.reset();
|
||||||
}
|
}
|
||||||
|
@ -501,7 +498,7 @@ SDL_Rect SDLContext::to_window_rect(const SDL_Rect &winrc, const SDL_Rect &sourc
|
||||||
SDL_Point wpt1(to_window_point(winrc, pt1));
|
SDL_Point wpt1(to_window_point(winrc, pt1));
|
||||||
SDL_Point wpt2(to_window_point(winrc, pt2));
|
SDL_Point wpt2(to_window_point(winrc, pt2));
|
||||||
return {wpt1.x, wpt1.y, wpt2.x - wpt1.x, wpt2.y - wpt1.y};
|
return {wpt1.x, wpt1.y, wpt2.x - wpt1.x, wpt2.y - wpt1.y};
|
||||||
|
}
|
||||||
|
void SDLContext::set_quit_callback(std::function<void()> fn) {
|
||||||
|
_quit_callback = std::move(fn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <libs/mouse.h>
|
#include <libs/mouse.h>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ public:
|
||||||
void show_slide_transition(const SDL_Rect &visible_from, const SDL_Rect &visible_where,
|
void show_slide_transition(const SDL_Rect &visible_from, const SDL_Rect &visible_where,
|
||||||
const SDL_Rect &hidden_from, const SDL_Rect &hidden_where);
|
const SDL_Rect &hidden_from, const SDL_Rect &hidden_where);
|
||||||
|
|
||||||
|
void set_quit_callback(std::function<void()> fn);
|
||||||
MS_EVENT getMsEvent() {
|
MS_EVENT getMsEvent() {
|
||||||
std::lock_guard _(_mx);
|
std::lock_guard _(_mx);
|
||||||
MS_EVENT out = ms_event;
|
MS_EVENT out = ms_event;
|
||||||
|
@ -58,6 +60,12 @@ public:
|
||||||
bool is_keyboard_ready() const;
|
bool is_keyboard_ready() const;
|
||||||
std::uint16_t pop_keyboard_code() ;
|
std::uint16_t pop_keyboard_code() ;
|
||||||
|
|
||||||
|
bool is_quit_requested() const {
|
||||||
|
return _quit_requested;
|
||||||
|
}
|
||||||
|
void cancel_quit_request() {
|
||||||
|
_quit_requested = false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -97,6 +105,7 @@ protected:
|
||||||
int aspect_x = 4;
|
int aspect_x = 4;
|
||||||
int aspect_y = 3;
|
int aspect_y = 3;
|
||||||
bool crt_filter_enabled = false;
|
bool crt_filter_enabled = false;
|
||||||
|
std::function<void()> _quit_callback;
|
||||||
|
|
||||||
std::unique_ptr<SDL_Window, SDL_Deleter> _window;
|
std::unique_ptr<SDL_Window, SDL_Deleter> _window;
|
||||||
std::unique_ptr<SDL_Renderer, SDL_Deleter> _renderer;
|
std::unique_ptr<SDL_Renderer, SDL_Deleter> _renderer;
|
||||||
|
@ -108,12 +117,12 @@ protected:
|
||||||
|
|
||||||
std::jthread _render_thread;
|
std::jthread _render_thread;
|
||||||
|
|
||||||
bool _quit_requested = false;
|
|
||||||
bool _fullscreen_mode = false;
|
bool _fullscreen_mode = false;
|
||||||
bool _present = false;
|
bool _present = false;
|
||||||
std::atomic<bool> _key_control = false;
|
std::atomic<bool> _key_control = false;
|
||||||
std::atomic<bool> _key_shift = false;
|
std::atomic<bool> _key_shift = false;
|
||||||
std::atomic<bool> _key_capslock = false;
|
std::atomic<bool> _key_capslock = false;
|
||||||
|
std::atomic<bool> _quit_requested = false;
|
||||||
|
|
||||||
|
|
||||||
std::vector<char> _display_update_queue;
|
std::vector<char> _display_update_queue;
|
||||||
|
|
|
@ -11,7 +11,7 @@ char start_mixing() {
|
||||||
void stop_mixing() {
|
void stop_mixing() {
|
||||||
|
|
||||||
}
|
}
|
||||||
void play_sample(int channel,void *sample,int32_t size,int32_t lstart,int32_t sfreq,int type) {
|
void play_sample(int channel,const void *sample,int32_t size,int32_t lstart,int32_t sfreq,int type) {
|
||||||
|
|
||||||
}
|
}
|
||||||
void set_channel_volume(int channel,int left,int right) {
|
void set_channel_volume(int channel,int left,int right) {
|
||||||
|
@ -50,7 +50,7 @@ void mute_channel(int channel) {
|
||||||
void chan_break_loop(int channel) {
|
void chan_break_loop(int channel) {
|
||||||
|
|
||||||
}
|
}
|
||||||
void chan_break_ext(int channel,void *org_sample,int32_t size_sample) {
|
void chan_break_ext(int channel,const void *org_sample,int32_t size_sample) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ int get_snd_effect(int funct) {
|
||||||
void *PrepareVideoSound(int mixfreq, int buffsize) {
|
void *PrepareVideoSound(int mixfreq, int buffsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
char LoadNextVideoFrame(void *buffer, char *data, int size, short *xlat, short *accnums, int32_t *writepos) {
|
char LoadNextVideoFrame(void *buffer, const char *data, int size, const short *xlat, short *accnums, int32_t *writepos) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -43,4 +43,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[audio]
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue