mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
enable building on 64-bit architectures
* Include stdint.h for intptr_t types. * Check for more headers and data types in configure.ac. * Use a union of integer and string pointer to store config values, instead of type-punning string pointers to integers which won't work on 64-bit systems anyway. * Silence some "incompatible pointer types" GCC warnings, as pointers to integer and union config_u are in fact interchangeable. * Fix memcpy() size parameters and pointer progression. * Fix BMP screenshots by changing some variables from ambigious long to corresponding int types. * Silence the last remaining "cast pointer from/to integer of different size" warnings.
This commit is contained in:
parent
8a9061188b
commit
d318bee68b
@ -1894,7 +1894,7 @@ void deh_procSounds(DEHFILE *fpin, FILE* fpout, char *line)
|
||||
S_sfx[indexnum].priority = value;
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[3])) // Zero 1
|
||||
S_sfx[indexnum].link = (sfxinfo_t *)value;
|
||||
S_sfx[indexnum].link = (sfxinfo_t *)(intptr_t)value;
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[4])) // Zero 2
|
||||
S_sfx[indexnum].pitch = value;
|
||||
@ -1903,7 +1903,7 @@ void deh_procSounds(DEHFILE *fpin, FILE* fpout, char *line)
|
||||
S_sfx[indexnum].volume = value;
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[6])) // Zero 4
|
||||
S_sfx[indexnum].data = (void *) value; // killough 5/3/98: changed cast
|
||||
S_sfx[indexnum].data = (void *)(intptr_t) value; // killough 5/3/98: changed cast
|
||||
else
|
||||
if (!strcasecmp(key,deh_sfxinfo[7])) // Neg. One 1
|
||||
S_sfx[indexnum].usefulness = value;
|
||||
|
@ -1501,7 +1501,7 @@ void D_DoomMain(void)
|
||||
// killough 5/2/98: this takes a memory
|
||||
// address as an integer on the command line!
|
||||
|
||||
statcopy = (void*) atoi(myargv[p+1]);
|
||||
statcopy = (void*)(intptr_t) atoi(myargv[p+1]);
|
||||
puts("External statistics registered.");
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ extern int key_escape; // phares
|
||||
//
|
||||
int NetbufferSize (void)
|
||||
{
|
||||
return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
|
||||
return (intptr_t)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
|
||||
}
|
||||
|
||||
//
|
||||
@ -109,7 +109,7 @@ unsigned NetbufferChecksum (void)
|
||||
// return 0; // byte order problems
|
||||
//#endif
|
||||
|
||||
l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4;
|
||||
l = (NetbufferSize () - (intptr_t)&(((doomdata_t *)0)->retransmitfrom))/4;
|
||||
for (i=0 ; i<l ; i++)
|
||||
c += ((unsigned *)&netbuffer->retransmitfrom)[i] * (i+1);
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h> // [FG] include for intptr_t types
|
||||
|
||||
#ifndef __BYTEBOOL__
|
||||
#define __BYTEBOOL__
|
||||
// Fixed to use builtin bool type with C++.
|
||||
|
@ -1252,8 +1252,8 @@ static void G_DoSaveGame(void)
|
||||
|
||||
save_p = G_WriteOptions(save_p); // killough 3/1/98: save game options
|
||||
|
||||
memcpy(save_p, &leveltime, sizeof save_p); //killough 11/98: save entire word
|
||||
save_p += sizeof save_p;
|
||||
memcpy(save_p, &leveltime, sizeof leveltime); //killough 11/98: save entire word
|
||||
save_p += sizeof leveltime; // [FG] fix copy size and pointer progression
|
||||
|
||||
// killough 11/98: save revenant tracer state
|
||||
*save_p++ = (gametic-basetic) & 255;
|
||||
@ -1359,8 +1359,8 @@ static void G_DoLoadGame(void)
|
||||
|
||||
// get the times
|
||||
// killough 11/98: save entire word
|
||||
memcpy(&leveltime, save_p, sizeof save_p);
|
||||
save_p += sizeof save_p;
|
||||
memcpy(&leveltime, save_p, sizeof leveltime);
|
||||
save_p += sizeof leveltime; // [FG] fix copy size and pointer progression
|
||||
|
||||
// killough 11/98: load revenant tracer state
|
||||
basetic = gametic - (int) *save_p++;
|
||||
|
@ -1949,7 +1949,7 @@ void M_DrawSetting(setup_menu_t* s)
|
||||
|
||||
if (flags & S_YESNO)
|
||||
{
|
||||
strcpy(menu_buffer,*s->var.def->location ? "YES" : "NO");
|
||||
strcpy(menu_buffer,s->var.def->location->i ? "YES" : "NO");
|
||||
M_DrawMenuString(x,y,color);
|
||||
return;
|
||||
}
|
||||
@ -2020,7 +2020,7 @@ void M_DrawSetting(setup_menu_t* s)
|
||||
if (flags & (S_WEAP|S_CRITEM)) // weapon number or color range
|
||||
{
|
||||
sprintf(menu_buffer,"%d", *s->var.def->location);
|
||||
M_DrawMenuString(x,y, flags & S_CRITEM ? *s->var.def->location : color);
|
||||
M_DrawMenuString(x,y, flags & S_CRITEM ? s->var.def->location->i : color);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2039,7 +2039,7 @@ void M_DrawSetting(setup_menu_t* s)
|
||||
|
||||
// draw the paint chip
|
||||
|
||||
ch = *s->var.def->location;
|
||||
ch = s->var.def->location->i;
|
||||
if (!ch) // don't show this item in automap mode
|
||||
V_DrawPatchDirect (x+1,y,0,W_CacheLumpName("M_PALNO",PU_CACHE));
|
||||
else
|
||||
@ -2057,7 +2057,7 @@ void M_DrawSetting(setup_menu_t* s)
|
||||
|
||||
if (flags & S_STRING)
|
||||
{
|
||||
char *text = *(char **) s->var.def->location;
|
||||
char *text = s->var.def->location->s;
|
||||
|
||||
// Are we editing this string? If so, display a cursor under
|
||||
// the correct character.
|
||||
@ -2220,7 +2220,7 @@ void M_DrawInstructions()
|
||||
int flags = current_setup_menu[set_menu_itemon].m_flags;
|
||||
|
||||
// killough 8/15/98: warn when values are different
|
||||
if (flags & (S_NUM|S_YESNO) && def->current && *def->current!=*def->location)
|
||||
if (flags & (S_NUM|S_YESNO) && def->current && def->current->i!=def->location->i)
|
||||
{
|
||||
int allow = allow_changes() ? 8 : 0;
|
||||
if (!(setup_gather | print_warning_about_changes | demoplayback))
|
||||
@ -3612,13 +3612,13 @@ void M_ResetDefaults()
|
||||
for (l = setup_screens[setup_screen-1]; *l; l++)
|
||||
for (p = *l; !(p->m_flags & S_END); p++)
|
||||
if (p->m_flags & S_HASDEFPTR ? p->var.def == dp :
|
||||
p->var.m_key == dp->location ||
|
||||
p->m_mouse == dp->location ||
|
||||
p->m_joy == dp->location)
|
||||
p->var.m_key == &dp->location->i ||
|
||||
p->m_mouse == &dp->location->i ||
|
||||
p->m_joy == &dp->location->i)
|
||||
{
|
||||
if (dp->isstr)
|
||||
free(*(char **) dp->location),
|
||||
*(char **) dp->location = strdup((char *)dp->defaultvalue);
|
||||
free(dp->location->s),
|
||||
dp->location->s = strdup(dp->defaultvalue.s);
|
||||
else
|
||||
*dp->location = dp->defaultvalue;
|
||||
|
||||
@ -4581,7 +4581,7 @@ boolean M_Responder (event_t* ev)
|
||||
{
|
||||
if (ch == key_menu_enter)
|
||||
{
|
||||
*ptr1->var.def->location = !*ptr1->var.def->location; // killough 8/15/98
|
||||
ptr1->var.def->location->i = !ptr1->var.def->location->i; // killough 8/15/98
|
||||
|
||||
// phares 4/14/98:
|
||||
// If not in demoplayback, demorecording, or netgame,
|
||||
@ -4598,7 +4598,7 @@ boolean M_Responder (event_t* ev)
|
||||
if (allow_changes()) // killough 8/15/98
|
||||
*ptr1->var.def->current = *ptr1->var.def->location;
|
||||
else
|
||||
if (*ptr1->var.def->current != *ptr1->var.def->location)
|
||||
if (ptr1->var.def->current->i != ptr1->var.def->location->i)
|
||||
warn_about_changes(S_LEVWARN); // killough 8/15/98
|
||||
|
||||
if (ptr1->action) // killough 10/98
|
||||
@ -4615,7 +4615,7 @@ boolean M_Responder (event_t* ev)
|
||||
ch -= 0x30; // out of ascii
|
||||
if (ch < 0 || ch > 9)
|
||||
return true; // ignore
|
||||
*ptr1->var.def->location = ch;
|
||||
ptr1->var.def->location->i = ch;
|
||||
}
|
||||
if (ptr1->action) // killough 10/98
|
||||
ptr1->action();
|
||||
@ -4648,7 +4648,7 @@ boolean M_Responder (event_t* ev)
|
||||
warn_about_changes(S_BADVAL);
|
||||
else
|
||||
{
|
||||
*ptr1->var.def->location = value;
|
||||
ptr1->var.def->location->i = value;
|
||||
|
||||
// killough 8/9/98: fix numeric vars
|
||||
// killough 8/15/98: add warning message
|
||||
@ -4659,9 +4659,9 @@ boolean M_Responder (event_t* ev)
|
||||
else
|
||||
if (ptr1->var.def->current)
|
||||
if (allow_changes()) // killough 8/15/98
|
||||
*ptr1->var.def->current = value;
|
||||
ptr1->var.def->current->i = value;
|
||||
else
|
||||
if (*ptr1->var.def->current != value)
|
||||
if (ptr1->var.def->current->i != value)
|
||||
warn_about_changes(S_LEVWARN);
|
||||
|
||||
if (ptr1->action) // killough 10/98
|
||||
@ -4835,13 +4835,13 @@ boolean M_Responder (event_t* ev)
|
||||
for (i = 0; (ptr2 = weap_settings[i]); i++)
|
||||
for (; !(ptr2->m_flags & S_END); ptr2++)
|
||||
if (ptr2->m_flags & S_WEAP &&
|
||||
*ptr2->var.def->location == ch && ptr1 != ptr2)
|
||||
ptr2->var.def->location->i == ch && ptr1 != ptr2)
|
||||
{
|
||||
*ptr2->var.def->location = *ptr1->var.def->location;
|
||||
goto end;
|
||||
}
|
||||
end:
|
||||
*ptr1->var.def->location = ch;
|
||||
ptr1->var.def->location->i = ch;
|
||||
}
|
||||
|
||||
M_SelectDone(ptr1); // phares 4/17/98
|
||||
@ -4887,7 +4887,7 @@ boolean M_Responder (event_t* ev)
|
||||
|
||||
if (ch == key_menu_enter)
|
||||
{
|
||||
*ptr1->var.def->location = color_palette_x + 16*color_palette_y;
|
||||
ptr1->var.def->location->i = color_palette_x + 16*color_palette_y;
|
||||
M_SelectDone(ptr1); // phares 4/17/98
|
||||
colorbox_active = false;
|
||||
return true;
|
||||
@ -4926,7 +4926,7 @@ boolean M_Responder (event_t* ev)
|
||||
else if ((ch == key_menu_enter) ||
|
||||
(ch == key_menu_escape))
|
||||
{
|
||||
*(char **) ptr1->var.def->location = chat_string_buffer;
|
||||
ptr1->var.def->location->s = chat_string_buffer;
|
||||
M_SelectDone(ptr1); // phares 4/17/98
|
||||
}
|
||||
|
||||
@ -5011,13 +5011,13 @@ boolean M_Responder (event_t* ev)
|
||||
}
|
||||
else if (flags & S_COLOR)
|
||||
{
|
||||
int color = *ptr1->var.def->location;
|
||||
int color = ptr1->var.def->location->i;
|
||||
|
||||
if (color < 0 || color > 255) // range check the value
|
||||
color = 0; // 'no show' if invalid
|
||||
|
||||
color_palette_x = *ptr1->var.def->location & 15;
|
||||
color_palette_y = *ptr1->var.def->location >> 4;
|
||||
color_palette_x = ptr1->var.def->location->i & 15;
|
||||
color_palette_y = ptr1->var.def->location->i >> 4;
|
||||
colorbox_active = true;
|
||||
}
|
||||
else if (flags & S_STRING)
|
||||
@ -5030,7 +5030,7 @@ boolean M_Responder (event_t* ev)
|
||||
|
||||
chat_string_buffer = malloc(CHAT_STRING_BFR_SIZE);
|
||||
strncpy(chat_string_buffer,
|
||||
*(char **) ptr1->var.def->location, CHAT_STRING_BFR_SIZE);
|
||||
ptr1->var.def->location->s, CHAT_STRING_BFR_SIZE);
|
||||
|
||||
// guarantee null delimiter
|
||||
chat_string_buffer[CHAT_STRING_BFR_SIZE-1] = 0;
|
||||
@ -5038,8 +5038,8 @@ boolean M_Responder (event_t* ev)
|
||||
// set chat table pointer to working buffer
|
||||
// and free old string's memory.
|
||||
|
||||
free(*(char **) ptr1->var.def->location);
|
||||
*(char **) ptr1->var.def->location = chat_string_buffer;
|
||||
free(ptr1->var.def->location->s);
|
||||
ptr1->var.def->location->s = chat_string_buffer;
|
||||
chat_index = 0; // current cursor position in chat_string_buffer
|
||||
}
|
||||
else if (flags & S_RESET)
|
||||
|
109
Source/m_misc.c
109
Source/m_misc.c
@ -96,6 +96,13 @@ extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98
|
||||
// killough 11/98: entirely restructured to allow options to be modified
|
||||
// from wads, and to consolidate with menu code
|
||||
|
||||
// [FG] silence some "incompatible pointer types" GCC warnings here, as
|
||||
// pointers to integer and to union config_u are in fact interchangeable
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
|
||||
#endif
|
||||
|
||||
default_t defaults[] = {
|
||||
{ //jff 3/3/98
|
||||
"config_help",
|
||||
@ -404,29 +411,29 @@ default_t defaults[] = {
|
||||
|
||||
{ // killough 10/98: preloaded files
|
||||
"wadfile_1",
|
||||
(int *) &wad_files[0], NULL,
|
||||
(int) "", {0}, string, ss_none, wad_no,
|
||||
&wad_files[0], NULL,
|
||||
{.s = ""}, {0}, string, ss_none, wad_no,
|
||||
"WAD file preloaded at program startup"
|
||||
},
|
||||
|
||||
{
|
||||
"wadfile_2",
|
||||
(int *) &wad_files[1], NULL,
|
||||
(int) "", {0}, string, ss_none, wad_no,
|
||||
&wad_files[1], NULL,
|
||||
{.s = ""}, {0}, string, ss_none, wad_no,
|
||||
"WAD file preloaded at program startup"
|
||||
},
|
||||
|
||||
{
|
||||
"dehfile_1",
|
||||
(int *) &deh_files[0], NULL,
|
||||
(int) "", {0}, string, ss_none, wad_no,
|
||||
&deh_files[0], NULL,
|
||||
{.s = ""}, {0}, string, ss_none, wad_no,
|
||||
"DEH/BEX file preloaded at program startup"
|
||||
},
|
||||
|
||||
{
|
||||
"dehfile_2",
|
||||
(int *) &deh_files[1], NULL,
|
||||
(int) "", {0}, string, ss_none, wad_no,
|
||||
&deh_files[1], NULL,
|
||||
{.s = ""}, {0}, string, ss_none, wad_no,
|
||||
"DEH/BEX file preloaded at program startup"
|
||||
},
|
||||
|
||||
@ -1099,71 +1106,71 @@ default_t defaults[] = {
|
||||
|
||||
{
|
||||
"chatmacro0",
|
||||
(int *) &chat_macros[0], NULL,
|
||||
(int) HUSTR_CHATMACRO0, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[0], NULL,
|
||||
{.s = HUSTR_CHATMACRO0}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 0 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro1",
|
||||
(int *) &chat_macros[1], NULL,
|
||||
(int) HUSTR_CHATMACRO1, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[1], NULL,
|
||||
{.s = HUSTR_CHATMACRO1}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 1 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro2",
|
||||
(int *) &chat_macros[2], NULL,
|
||||
(int) HUSTR_CHATMACRO2, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[2], NULL,
|
||||
{.s = HUSTR_CHATMACRO2}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 2 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro3",
|
||||
(int *) &chat_macros[3], NULL,
|
||||
(int) HUSTR_CHATMACRO3, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[3], NULL,
|
||||
{.s = HUSTR_CHATMACRO3}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 3 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro4",
|
||||
(int *) &chat_macros[4], NULL,
|
||||
(int) HUSTR_CHATMACRO4, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[4], NULL,
|
||||
{.s = HUSTR_CHATMACRO4}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 4 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro5",
|
||||
(int *) &chat_macros[5], NULL,
|
||||
(int) HUSTR_CHATMACRO5, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[5], NULL,
|
||||
{.s = HUSTR_CHATMACRO5}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 5 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro6",
|
||||
(int *) &chat_macros[6], NULL,
|
||||
(int) HUSTR_CHATMACRO6, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[6], NULL,
|
||||
{.s = HUSTR_CHATMACRO6}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 6 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro7",
|
||||
(int *) &chat_macros[7], NULL,
|
||||
(int) HUSTR_CHATMACRO7, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[7], NULL,
|
||||
{.s = HUSTR_CHATMACRO7}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 7 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro8",
|
||||
(int *) &chat_macros[8], NULL,
|
||||
(int) HUSTR_CHATMACRO8, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[8], NULL,
|
||||
{.s = HUSTR_CHATMACRO8}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 8 key"
|
||||
},
|
||||
|
||||
{
|
||||
"chatmacro9",
|
||||
(int *) &chat_macros[9], NULL,
|
||||
(int) HUSTR_CHATMACRO9, {0}, string, ss_chat, wad_yes,
|
||||
&chat_macros[9], NULL,
|
||||
{.s = HUSTR_CHATMACRO9}, {0}, string, ss_chat, wad_yes,
|
||||
"chat string associated with 9 key"
|
||||
},
|
||||
|
||||
@ -1665,6 +1672,10 @@ default_t defaults[] = {
|
||||
{NULL} // last entry
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static char *defaultfile;
|
||||
static boolean defaults_loaded = false; // killough 10/98
|
||||
|
||||
@ -1741,7 +1752,8 @@ void M_SaveDefaults (void)
|
||||
|
||||
for (blanks = 1, line = 0, dp = defaults; ; dp++, blanks = 0)
|
||||
{
|
||||
int brackets = 0, value;
|
||||
int brackets = 0;
|
||||
config_t value;
|
||||
|
||||
for (;line < comment && comments[line].line <= dp-defaults; line++)
|
||||
if (*comments[line].text != '[' || (brackets = 1, config_help))
|
||||
@ -1773,7 +1785,7 @@ void M_SaveDefaults (void)
|
||||
|
||||
if (config_help && !brackets)
|
||||
if ((dp->isstr ?
|
||||
fprintf(f,"[(\"%s\")]", (char *) dp->defaultvalue) :
|
||||
fprintf(f,"[(\"%s\")]", (char *) dp->defaultvalue.s) :
|
||||
dp->limit.min == UL ?
|
||||
dp->limit.max == UL ?
|
||||
fprintf(f, "[?-?(%d)]", dp->defaultvalue) :
|
||||
@ -1788,16 +1800,19 @@ void M_SaveDefaults (void)
|
||||
// killough 11/98:
|
||||
// Write out original default if .wad file has modified the default
|
||||
|
||||
value = dp->modified ? dp->orig_default : (int) *dp->location;
|
||||
if (dp->isstr)
|
||||
value.s = dp->modified ? dp->orig_default.s : dp->location->s;
|
||||
else
|
||||
value.i = dp->modified ? dp->orig_default.i : dp->location->i;
|
||||
|
||||
//jff 4/10/98 kill super-hack on pointer value
|
||||
// killough 3/6/98:
|
||||
// use spaces instead of tabs for uniform justification
|
||||
|
||||
if (!dp->isstr ? fprintf(f, "%-25s %5i\n", dp->name,
|
||||
strncmp(dp->name, "key_", 4) ? value :
|
||||
I_DoomCode2ScanCode(value)) == EOF :
|
||||
fprintf(f,"%-25s \"%s\"\n", dp->name, (char *) value) == EOF)
|
||||
strncmp(dp->name, "key_", 4) ? value.i :
|
||||
I_DoomCode2ScanCode(value.i)) == EOF :
|
||||
fprintf(f,"%-25s \"%s\"\n", dp->name, (char *) value.s) == EOF)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -1856,17 +1871,17 @@ boolean M_ParseOption(const char *p, boolean wad)
|
||||
if (wad && !dp->modified) // Modified by wad
|
||||
{ // First time modified
|
||||
dp->modified = 1; // Mark it as modified
|
||||
dp->orig_default = *dp->location; // Save original default
|
||||
dp->orig_default.s = dp->location->s; // Save original default
|
||||
}
|
||||
else
|
||||
free(*(char **) dp->location); // Free old value
|
||||
free(dp->location->s); // Free old value
|
||||
|
||||
*(char **) dp->location = strdup(strparm+1); // Change default value
|
||||
dp->location->s = strdup(strparm+1); // Change default value
|
||||
|
||||
if (dp->current) // Current value
|
||||
{
|
||||
free(*(char **) dp->current); // Free old value
|
||||
*(char **) dp->current = strdup(strparm+1); // Change current value
|
||||
free(dp->current->s); // Free old value
|
||||
dp->current->s = strdup(strparm+1); // Change current value
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1886,12 +1901,12 @@ boolean M_ParseOption(const char *p, boolean wad)
|
||||
if (!dp->modified) // First time it's modified by wad
|
||||
{
|
||||
dp->modified = 1; // Mark it as modified
|
||||
dp->orig_default = *dp->location; // Save original default
|
||||
dp->orig_default.i = dp->location->i; // Save original default
|
||||
}
|
||||
if (dp->current) // Change current value
|
||||
*dp->current = parm;
|
||||
dp->current->i = parm;
|
||||
}
|
||||
*dp->location = parm; // Change default
|
||||
dp->location->i = parm; // Change default
|
||||
}
|
||||
}
|
||||
|
||||
@ -1956,8 +1971,10 @@ void M_LoadDefaults (void)
|
||||
// edit these strings (i.e. chat macros in the Chat Strings Setup screen).
|
||||
|
||||
for (dp = defaults; dp->name; dp++)
|
||||
*dp->location =
|
||||
dp->isstr ? (int) strdup((char *) dp->defaultvalue) : dp->defaultvalue;
|
||||
if (dp->isstr)
|
||||
dp->location->s = strdup(dp->defaultvalue.s);
|
||||
else
|
||||
dp->location->i = dp->defaultvalue.i;
|
||||
|
||||
// check for a custom default file
|
||||
|
||||
@ -2217,8 +2234,8 @@ boolean WritePCXfile(char *filename, byte *data, int width,
|
||||
#define BI_RGB 0L
|
||||
|
||||
typedef unsigned short uint_t;
|
||||
typedef unsigned long dword_t;
|
||||
typedef long long_t;
|
||||
typedef uint32_t dword_t; // [FG] unsigned long
|
||||
typedef int32_t long_t; // [FG] long
|
||||
typedef unsigned char ubyte_t;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -52,12 +52,21 @@ extern int screenshot_pcx; // killough 10/98
|
||||
//
|
||||
// killough 11/98: totally restructured
|
||||
|
||||
// [FG] use a union of integer and string pointer to store config values, instead
|
||||
// of type-punning string pointers to integers which won't work on 64-bit systems anyway
|
||||
|
||||
typedef union config_u
|
||||
{
|
||||
int i;
|
||||
char *s;
|
||||
} config_t;
|
||||
|
||||
typedef struct default_s
|
||||
{
|
||||
const char *const name; // name
|
||||
int *const location; // default variable
|
||||
int *const current; // possible nondefault variable
|
||||
int const defaultvalue; // built-in default value
|
||||
config_t *const location; // default variable
|
||||
config_t *const current; // possible nondefault variable
|
||||
config_t const defaultvalue; // built-in default value
|
||||
struct {int min, max;} const limit; // numerical limits
|
||||
enum {number, string} const isstr; // number or string
|
||||
ss_types const setupscreen; // setup screen this appears on
|
||||
@ -68,7 +77,7 @@ typedef struct default_s
|
||||
|
||||
struct default_s *first, *next; // hash table pointers
|
||||
int modified; // Whether it's been modified
|
||||
int orig_default; // Original default, if modified
|
||||
config_t orig_default; // Original default, if modified
|
||||
struct setup_menu_s *setup_menu; // Xref to setup menu item, if any
|
||||
} default_t;
|
||||
|
||||
|
@ -43,7 +43,7 @@ byte *save_p;
|
||||
|
||||
// Pads save_p to a 4-byte boundary
|
||||
// so that the load/save works on SGI&Gecko.
|
||||
#define PADSAVEP() do { save_p += (4 - ((int) save_p & 3)) & 3; } while (0)
|
||||
#define PADSAVEP() do { save_p += (4 - ((intptr_t) save_p & 3)) & 3; } while (0)
|
||||
//
|
||||
// P_ArchivePlayers
|
||||
//
|
||||
@ -94,7 +94,7 @@ void P_UnArchivePlayers (void)
|
||||
for (j=0 ; j<NUMPSPRITES ; j++)
|
||||
if (players[i]. psprites[j].state)
|
||||
players[i]. psprites[j].state =
|
||||
&states[ (int)players[i].psprites[j].state ];
|
||||
&states[ (size_t)players[i].psprites[j].state ];
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,10 +438,10 @@ void P_UnArchiveThinkers (void)
|
||||
PADSAVEP();
|
||||
memcpy (mobj, save_p, sizeof(mobj_t));
|
||||
save_p += sizeof(mobj_t);
|
||||
mobj->state = states + (int) mobj->state;
|
||||
mobj->state = states + (size_t) mobj->state;
|
||||
|
||||
if (mobj->player)
|
||||
(mobj->player = &players[(int) mobj->player - 1]) -> mo = mobj;
|
||||
(mobj->player = &players[(size_t) mobj->player - 1]) -> mo = mobj;
|
||||
|
||||
P_SetThingPosition (mobj);
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
@ -761,7 +761,7 @@ void P_UnArchiveSpecials (void)
|
||||
ceiling_t *ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL);
|
||||
memcpy (ceiling, save_p, sizeof(*ceiling));
|
||||
save_p += sizeof(*ceiling);
|
||||
ceiling->sector = §ors[(int)ceiling->sector];
|
||||
ceiling->sector = §ors[(size_t)ceiling->sector];
|
||||
ceiling->sector->ceilingdata = ceiling; //jff 2/22/98
|
||||
|
||||
if (ceiling->thinker.function)
|
||||
@ -778,10 +778,10 @@ void P_UnArchiveSpecials (void)
|
||||
vldoor_t *door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL);
|
||||
memcpy (door, save_p, sizeof(*door));
|
||||
save_p += sizeof(*door);
|
||||
door->sector = §ors[(int)door->sector];
|
||||
door->sector = §ors[(size_t)door->sector];
|
||||
|
||||
//jff 1/31/98 unarchive line remembered by door as well
|
||||
door->line = (int)door->line!=-1? &lines[(int)door->line] : NULL;
|
||||
door->line = (size_t)door->line!=-1? &lines[(size_t)door->line] : NULL;
|
||||
|
||||
door->sector->ceilingdata = door; //jff 2/22/98
|
||||
door->thinker.function = T_VerticalDoor;
|
||||
@ -795,7 +795,7 @@ void P_UnArchiveSpecials (void)
|
||||
floormove_t *floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
|
||||
memcpy (floor, save_p, sizeof(*floor));
|
||||
save_p += sizeof(*floor);
|
||||
floor->sector = §ors[(int)floor->sector];
|
||||
floor->sector = §ors[(size_t)floor->sector];
|
||||
floor->sector->floordata = floor; //jff 2/22/98
|
||||
floor->thinker.function = T_MoveFloor;
|
||||
P_AddThinker (&floor->thinker);
|
||||
@ -808,7 +808,7 @@ void P_UnArchiveSpecials (void)
|
||||
plat_t *plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
|
||||
memcpy (plat, save_p, sizeof(*plat));
|
||||
save_p += sizeof(*plat);
|
||||
plat->sector = §ors[(int)plat->sector];
|
||||
plat->sector = §ors[(size_t)plat->sector];
|
||||
plat->sector->floordata = plat; //jff 2/22/98
|
||||
|
||||
if (plat->thinker.function)
|
||||
@ -825,7 +825,7 @@ void P_UnArchiveSpecials (void)
|
||||
lightflash_t *flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
|
||||
memcpy (flash, save_p, sizeof(*flash));
|
||||
save_p += sizeof(*flash);
|
||||
flash->sector = §ors[(int)flash->sector];
|
||||
flash->sector = §ors[(size_t)flash->sector];
|
||||
flash->thinker.function = T_LightFlash;
|
||||
P_AddThinker (&flash->thinker);
|
||||
break;
|
||||
@ -837,7 +837,7 @@ void P_UnArchiveSpecials (void)
|
||||
strobe_t *strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
|
||||
memcpy (strobe, save_p, sizeof(*strobe));
|
||||
save_p += sizeof(*strobe);
|
||||
strobe->sector = §ors[(int)strobe->sector];
|
||||
strobe->sector = §ors[(size_t)strobe->sector];
|
||||
strobe->thinker.function = T_StrobeFlash;
|
||||
P_AddThinker (&strobe->thinker);
|
||||
break;
|
||||
@ -849,7 +849,7 @@ void P_UnArchiveSpecials (void)
|
||||
glow_t *glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
|
||||
memcpy (glow, save_p, sizeof(*glow));
|
||||
save_p += sizeof(*glow);
|
||||
glow->sector = §ors[(int)glow->sector];
|
||||
glow->sector = §ors[(size_t)glow->sector];
|
||||
glow->thinker.function = T_Glow;
|
||||
P_AddThinker (&glow->thinker);
|
||||
break;
|
||||
@ -861,7 +861,7 @@ void P_UnArchiveSpecials (void)
|
||||
fireflicker_t *flicker = Z_Malloc (sizeof(*flicker), PU_LEVEL, NULL);
|
||||
memcpy (flicker, save_p, sizeof(*flicker));
|
||||
save_p += sizeof(*flicker);
|
||||
flicker->sector = §ors[(int)flicker->sector];
|
||||
flicker->sector = §ors[(size_t)flicker->sector];
|
||||
flicker->thinker.function = T_FireFlicker;
|
||||
P_AddThinker (&flicker->thinker);
|
||||
break;
|
||||
@ -874,7 +874,7 @@ void P_UnArchiveSpecials (void)
|
||||
elevator_t *elevator = Z_Malloc (sizeof(*elevator), PU_LEVEL, NULL);
|
||||
memcpy (elevator, save_p, sizeof(*elevator));
|
||||
save_p += sizeof(*elevator);
|
||||
elevator->sector = §ors[(int)elevator->sector];
|
||||
elevator->sector = §ors[(size_t)elevator->sector];
|
||||
elevator->sector->floordata = elevator; //jff 2/22/98
|
||||
elevator->sector->ceilingdata = elevator; //jff 2/22/98
|
||||
elevator->thinker.function = T_MoveElevator;
|
||||
|
@ -63,7 +63,7 @@ static const char rcsid[] = "$Id: z_zone.c,v 1.13 1998/05/12 06:11:55 killough E
|
||||
#define CACHE_ALIGN 32
|
||||
|
||||
// size of block header
|
||||
#define HEADER_SIZE 32
|
||||
//#define HEADER_SIZE 32
|
||||
|
||||
// Minimum chunk size at which blocks are allocated
|
||||
#define CHUNK_SIZE 32
|
||||
@ -107,6 +107,11 @@ typedef struct memblock {
|
||||
|
||||
} memblock_t;
|
||||
|
||||
/* size of block header
|
||||
* cph - base on sizeof(memblock_t), which can be larger than CHUNK_SIZE on
|
||||
* 64bit architectures */
|
||||
static const size_t HEADER_SIZE = (sizeof(memblock_t)+CHUNK_SIZE-1) & ~(CHUNK_SIZE-1);
|
||||
|
||||
static memblock_t *rover; // roving pointer to memory blocks
|
||||
static memblock_t *zone; // pointer to first block
|
||||
static memblock_t *zonebase; // pointer to entire zone memory
|
||||
@ -244,7 +249,7 @@ void Z_Init(void)
|
||||
// Align on cache boundary
|
||||
|
||||
zone = (memblock_t *) ((char *) zonebase + CACHE_ALIGN -
|
||||
((unsigned) zonebase & (CACHE_ALIGN-1)));
|
||||
((uintptr_t) zonebase & (CACHE_ALIGN-1)));
|
||||
|
||||
rover = zone; // Rover points to base of zone mem
|
||||
zone->next = zone->prev = zone; // Single node
|
||||
|
@ -18,12 +18,14 @@ PKG_CHECK_MODULES([SDL_net], [SDL_net])
|
||||
AC_DEFINE([MY_SDL_VER], [1], [This is WinMBF])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_C_INLINE
|
||||
AC_C_RESTRICT
|
||||
AC_TYPE_INTPTR_T
|
||||
AC_TYPE_UINTPTR_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_TYPES([ptrdiff_t])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user