windows release build, fix book crash, fix lock, fix finale

This commit is contained in:
Ondrej Novak 2025-02-08 20:08:01 +01:00
parent 3d8ee275e4
commit d13297e4f4
24 changed files with 158 additions and 63 deletions

View file

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <malloc.h>
#include <string.h>

View file

@ -764,7 +764,7 @@ void draw_medium_map(void)
{
int xr, yr;
int xp, yp;
int xc,yc,x,y;
int xc=0,yc=0,x=0,y=0;
int j,i,k,layer;
//char c=" ";

View file

@ -1363,7 +1363,7 @@ extern char att_player;
void mob_hit(TMOB *mm,int dostal)
{
int ch;
int mob_dostal,mob_dostal_pocet;
int mob_dostal=0,mob_dostal_pocet=0;
if (mm->vlajky & MOB_PASSABLE) return;
if (dostal>mm->vlastnosti[VLS_MAXHIT]) dostal=mm->vlastnosti[VLS_MAXHIT];

View file

@ -592,7 +592,7 @@ void global_map_point(EVENT_MSG *msg,void **_)
}
}
void unwire_global_map()
void unwire_global_map(void)
{
purge_index_tab();
send_message(E_DONE,E_MOUSE,global_map_point);
@ -601,7 +601,7 @@ void unwire_global_map()
}
void wire_global_map()
void wire_global_map(void)
{
unwire_proc();
schovej_mysku();
@ -614,14 +614,14 @@ void wire_global_map()
change_click_map(NULL,0);
}
static void *old_wire_save;
static void (*old_wire_save)(void);
static int old_viewsector;
static void empty_unwire()
static void empty_unwire(void)
{
}
static void unwire_automap_file()
static void unwire_automap_file(void)
{
load_map_automap(level_fname);
wire_proc=old_wire_save;

View file

@ -1207,7 +1207,7 @@ static void play_wav(int wav,int sector)
static void play_random_sound(int sector,int dir,int pos)
{
int seed;
int v;
int v=0;
seed=rand();
srand(sector+dir);
@ -1264,7 +1264,7 @@ void fletna_glob_add_note(uint8_t note)
if (strlen(globFletnaStr)<250) strcat(globFletnaStr,globNotes[note]);
}
static char compareMelody(const char *m1,const char *m2)
static int compareMelody(const char *m1,const char *m2)
{
while (*m1 && *m2)
{

View file

@ -803,7 +803,7 @@ char uloz_sip(int id,int xa,int ya,int xr,int yr);
char info_box_drawed=0;
void *info_box_below=NULL;
void *inv_keyboard(EVENT_MSG *msg,void **usr);
void inv_keyboard(EVENT_MSG *msg,void **usr);
T_CLK_MAP clk_inv_view[]=
{
@ -1742,7 +1742,7 @@ void inv_item_info_box(EVENT_MSG *msg,void **data)
}
}
void unwire_inv_mode()
void unwire_inv_mode(void)
{
send_message(E_DONE,E_KEYBOARD,inv_keyboard);
send_message(E_DONE,E_MOUSE,inv_item_info_box);
@ -2189,7 +2189,7 @@ char human_click(int id,int xa,int ya,int xr,int yr)
}
void *inv_keyboard(EVENT_MSG *msg,void **usr)
void inv_keyboard(EVENT_MSG *msg,void **usr)
{
char c;
@ -2215,7 +2215,6 @@ void *inv_keyboard(EVENT_MSG *msg,void **usr)
break;
}
}
return &inv_keyboard;
}
@ -2241,9 +2240,9 @@ static int fly_count; //vyuziti mapy
void draw_fly_items(int celx,int cely,int sector,int side)
{
LETICI_VEC *p;
int xpos,ypos;
int xpos=0,ypos=0;
const short *pic;
short picnum;char turn,smr;
short picnum;char turn=0,smr=0;
TITEM *it;
int i;
@ -2385,8 +2384,8 @@ char shop_keeper_click(int id, int xa, int ya,int xr,int yr);
char shop_block_click(int id, int xa, int ya,int xr,int yr);
char shop_change_player(int id, int xa, int ya,int xr,int yr);
char _exit_shop(int id, int xa, int ya,int xr,int yr);
void unwire_shop();
void wire_shop();
void unwire_shop(void);
void wire_shop(void);
@ -2960,7 +2959,7 @@ static void shop_keyboard_proc(EVENT_MSG *msg, void **_) {
static int old_inv_view_mode;
void unwire_shop()
void unwire_shop(void)
{
send_message(E_DONE,E_MOUSE,shop_mouse_event);
send_message(E_DONE,E_KEYBOARD, shop_keyboard_proc);
@ -2969,7 +2968,7 @@ void unwire_shop()
inv_view_mode=old_inv_view_mode;
}
void wire_shop()
void wire_shop(void)
{
int32_t size;
static TSHOP *last_shop=NULL;

View file

@ -283,12 +283,12 @@ static char read_set(TMPFILE_RD *txt,char *var,char *set)
do
c=temp_storage_getc(txt);
while (c<33);
if (c=='"') temp_storage_scanf(txt,"%[^\"]%c%c",set,&d,&d);
else if (c=='\'') temp_storage_scanf(txt,"%[^']%c%c",set,&d,&d);
if (c=='"') temp_storage_scanf(txt,"%[^\"]%c%c",set,&d,&c);
else if (c=='\'') temp_storage_scanf(txt,"%[^']%c%c",set,&d,&c);
else
{
temp_storage_ungetc(txt);
temp_storage_scanf(txt,"%[^> ]%c",set,&d);
temp_storage_scanf(txt,"%[^> ]%c",set,&c);
}
while(c<33 && c!=EOF) c=temp_storage_getc(txt);
if (c!='>') temp_storage_ungetc(txt);
@ -308,7 +308,7 @@ static char read_set(TMPFILE_RD *txt,char *var,char *set)
return c;
}
static int get_data_handle(char *filename,void *dec)
static int get_data_handle(char *filename,ABLOCK_DECODEPROC dec)
{
int i;
@ -492,7 +492,7 @@ static void read_text(TMPFILE_RD *txt)
static void seek_section(TMPFILE_RD *txt,int sect_number)
{
int c=0,i;
int c=0,i=0;
winconv=0;
do

View file

@ -739,7 +739,7 @@ void call_macro_ex(int side, int flags, int runatside) {
z = mrec.action_list;
if (z->general.flags & flags) {
int jmp_to = -1;
char force_cancel = 0;
char cancel_enabled = 1;
int stindex = z - first_macro;
if (!z->general.once || !macro_state_block.states[stindex]) {
macro_state_block.states[stindex] = 1;
@ -789,14 +789,14 @@ void call_macro_ex(int side, int flags, int runatside) {
enter_shop(z->text.textindex);
break;
case MA_CLOCK:
force_cancel = decode_lock(z->clock.znak, z->clock.string,
cancel_enabled = decode_lock(z->clock.znak, z->clock.string,
z->clock.codenum);
break;
case MA_CACTN:
cancel_action(z->cactn.sector, z->cactn.dir);
break;
case MA_LOCK:
force_cancel = if_lock(side, z->lock.key_id,
cancel_enabled = if_lock(side, z->lock.key_id,
z->lock.thieflevel, &z->lock);
break;
case MA_SWAPS:
@ -879,7 +879,7 @@ void call_macro_ex(int side, int flags, int runatside) {
if (jmp_to != -1) {
mrec = go_macro(runatside, jmp_to);
program_counter = jmp_to;
} else if (z->general.cancel || force_cancel) {
} else if (z->general.cancel && cancel_enabled) {
break;
} else {
program_counter++;

View file

@ -672,7 +672,7 @@ static void kill_timer(void)
timer_tree.next=NULL;
}
void *user_timer(EVENT_MSG *msg,void **usr)
void user_timer(EVENT_MSG *msg,void **usr)
{
int x;
static int lastvalue=0;
@ -685,7 +685,6 @@ void *user_timer(EVENT_MSG *msg,void **usr)
lastvalue+=x;
if (x) send_message(E_TIMER,x);
}
return &user_timer;
}
void do_timer(void)
@ -1305,7 +1304,7 @@ static void game_big_circle(char enforced)
char s[13];
purge_playlist();
s[12]=0;strcopy_n(s,loadlevel.name,12);
strcopy_n(s,loadlevel.name,sizeof(s));
err=load_map(s);
if (!enforced)
{
@ -1363,7 +1362,7 @@ static void game_big_circle(char enforced)
enter_game();
leave_current_map();
s[12]=0;strcopy_n(s,loadlevel.name,12);
strcopy_n(s,loadlevel.name,sizeof(s));
if (s[0]!=0)err=load_map(s);
memset(GlobEventList,0,sizeof(GlobEventList));
@ -1384,9 +1383,9 @@ static void new_game(int argc, char *argv[])
load_shops();
open_story_file();
if (argc<2)
strcopy_n(loadlevel.name,default_map,12);
strcopy_n(loadlevel.name,default_map,sizeof(loadlevel.name));
else
strcopy_n(loadlevel.name,argv[1],12);
strcopy_n(loadlevel.name,argv[1],sizeof(loadlevel.name));
if (argc>2)
{
sscanf(argv[2],"%d",&sect);

View file

@ -733,7 +733,7 @@ void wire_end_game()
if (mname != NULL) {
cur_group = postavy[i].groupnum;
TMA_LOADLEV lv;
strcopy_n(lv.name,mname, sizeof(lv.name)-1);
strcopy_n(lv.name,mname, sizeof(lv.name));
lv.start_pos = -postavy[i].sektor;
lv.dir = postavy[i].direction;
macro_load_another_map(&lv);
@ -1968,7 +1968,7 @@ void fix_group_direction()
if (postavy[i].used && postavy[i].groupnum==g && !postavy[i].programovano) postavy[i].direction=viewdir;
}
void souboje_turn(char smer)
void souboje_turn(int smer)
{
if (pass_zavora) return;
norefresh=1;

View file

@ -49,15 +49,15 @@ void temp_storage_store(const char *name, const void *data, int32_t size) {
int32_t temp_storage_find(const char *name) {
auto iter = temp_fsystem.find(std::string_view(name));
if (iter == temp_fsystem.end()) return -1;
return iter->second.size();
return static_cast<int32_t>(iter->second.size());
}
int32_t temp_storage_retrieve(const char *name, void *data, int32_t size) {
auto iter = temp_fsystem.find(std::string_view(name));
if (iter == temp_fsystem.end()) return -1;
size = std::min<int32_t>(size, iter->second.size());
size = std::min<int32_t>(size, static_cast<int32_t>(iter->second.size()));
std::copy(iter->second.begin(), iter->second.end(), reinterpret_cast<uint8_t *>(data));
return iter->second.size();
return static_cast<int32_t>(iter->second.size());
}
@ -109,7 +109,7 @@ uint32_t temp_storage_read(void *data, uint32_t size, TMPFILE_RD *f) {
d = d.substr(p.size());
auto b = reinterpret_cast<uint8_t *>(data);
std::copy(p.begin(), p.end(), b);
return p.size();
return static_cast<uint32_t>(p.size());
}
void temp_storage_skip(TMPFILE_RD *f, int bytes) {
@ -136,7 +136,7 @@ char *temp_storage_gets(char *buff, size_t sz, TMPFILE_RD *f) {
if (pos > d.size()) pos = d.size(); else ++pos;
if (pos == 0) return NULL;
if (pos > sz - 1) pos = sz - 1;
temp_storage_read(buff, pos, f);
temp_storage_read(buff, static_cast<int32_t>(pos), f);
buff[pos] = 0;
return buff;
}

View file

@ -359,7 +359,7 @@ static reload_mobs()
{
extern char reset_mobiles;
reset_mobiles=1;
strcopy_n(loadlevel.name,level_fname,12);
strcopy_n(loadlevel.name,level_fname,sizeof(loadlevel.name));
loadlevel.start_pos=viewsector;
loadlevel.name[12]=0;
loadlevel.dir=viewdir;