mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
review code changes, add or adapt comments where appropriate
Fixes #41.
This commit is contained in:
parent
92d8eeb7a8
commit
81c920c96c
@ -1830,7 +1830,7 @@ void deh_procPointer(DEHFILE *fpin, FILE* fpout, char *line) // done
|
||||
states[indexnum].action = deh_codeptr[value];
|
||||
if (fpout) fprintf(fpout," - applied %p from codeptr[%ld] to states[%d]\n",deh_codeptr[value],value,indexnum);
|
||||
// Write BEX-oriented line to match:
|
||||
for (i=0;i<arrlen(deh_bexptrs);i++)
|
||||
for (i=0;i<arrlen(deh_bexptrs);i++) // [FG] array size!
|
||||
{
|
||||
if (deh_bexptrs[i].cptr == deh_codeptr[value])
|
||||
{
|
||||
@ -2575,7 +2575,7 @@ boolean deh_procStringSub(char *key, char *lookfor, char *newstring, FILE *fpout
|
||||
if (!key)
|
||||
if (fpout) fprintf(fpout,
|
||||
"Assigned '%.12s%s' to'%.12s%s' at key %s\n",
|
||||
lookfor ? : "", (lookfor && strlen(lookfor) > 12) ? "..." : "",
|
||||
lookfor ? lookfor : "", (lookfor && strlen(lookfor) > 12) ? "..." : "", // [FG] NULL dereference
|
||||
newstring, (strlen(newstring) > 12) ? "..." :"",
|
||||
deh_strlookup[i].lookup);
|
||||
|
||||
|
@ -1103,6 +1103,7 @@ void FindResponseFile (void)
|
||||
size = ftell(handle);
|
||||
fseek(handle,0,SEEK_SET);
|
||||
file = malloc (size);
|
||||
// [FG] check return value
|
||||
if (!fread(file,size,1,handle))
|
||||
{
|
||||
fclose(handle);
|
||||
@ -1809,6 +1810,7 @@ void D_DoomMain(void)
|
||||
idmusnum = -1; //jff 3/17/98 insure idmus number is blank
|
||||
|
||||
// check for a driver that wants intermission stats
|
||||
// [FG] replace with -statdump implementation from Chocolate Doom
|
||||
if ((p = M_CheckParm ("-statdump")) && p<myargc-1)
|
||||
{
|
||||
atexit(StatDump);
|
||||
|
@ -40,7 +40,7 @@ void D_AddFile(char *file);
|
||||
char *D_DoomExeDir(void); // killough 2/16/98: path to executable's dir
|
||||
char *D_DoomExeName(void); // killough 10/98: executable's name
|
||||
extern char basesavegame[]; // killough 2/16/98: savegame path
|
||||
char *D_DoomPrefDir(void);
|
||||
char *D_DoomPrefDir(void); // [FG] default configuration dir
|
||||
|
||||
//jff 1/24/98 make command line copies of play modes available
|
||||
extern boolean clnomonsters; // checkparm of -nomonsters
|
||||
|
@ -459,7 +459,7 @@ void CheckAbort (void)
|
||||
I_StartTic ();
|
||||
|
||||
I_StartTic ();
|
||||
for ( ; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1) )
|
||||
for ( ; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1) ) // [FG] fix increment
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
if (ev->type == ev_keydown && ev->data1 == key_escape) // phares
|
||||
@ -716,7 +716,7 @@ void TryRunTics (void)
|
||||
// the key player does not adapt
|
||||
}
|
||||
else
|
||||
if (i < MAXPLAYERS)
|
||||
if (i < MAXPLAYERS) // [FG] avoid overflow
|
||||
{
|
||||
if (nettics[0] <= nettics[nodeforplayer[i]])
|
||||
{
|
||||
@ -752,6 +752,7 @@ void TryRunTics (void)
|
||||
M_Ticker ();
|
||||
return;
|
||||
}
|
||||
|
||||
// [FG] let the CPU sleep for 1 ms if there is no tic to proceed
|
||||
I_Sleep(1);
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ typedef struct {
|
||||
// A LineDef, as used for editing, and as input to the BSP builder.
|
||||
|
||||
typedef struct {
|
||||
// [FG] extended nodes
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
unsigned short flags;
|
||||
@ -140,6 +141,7 @@ typedef struct {
|
||||
|
||||
// SubSector, as generated by BSP.
|
||||
typedef struct {
|
||||
// [FG] extended nodes
|
||||
unsigned short numsegs;
|
||||
unsigned short firstseg; // Index of first one; segs are stored sequentially.
|
||||
} mapsubsector_t;
|
||||
@ -147,6 +149,7 @@ typedef struct {
|
||||
// LineSeg, generated by splitting LineDefs
|
||||
// using partition lines selected by BSP builder.
|
||||
typedef struct {
|
||||
// [FG] extended nodes
|
||||
unsigned short v1;
|
||||
unsigned short v2;
|
||||
short angle;
|
||||
|
@ -58,6 +58,8 @@ typedef int64_t Long64;
|
||||
#define D_MAXINT INT_MAX
|
||||
#define D_MININT INT_MIN
|
||||
|
||||
// [FG] common definitions from Chocolate Doom
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define DIR_SEPARATOR '\\'
|
||||
|
@ -242,12 +242,10 @@ int defaultskill; //note 1-based
|
||||
// killough 2/8/98: make corpse queue variable in size
|
||||
int bodyqueslot, bodyquesize, default_bodyquesize; // killough 2/8/98, 10/98
|
||||
|
||||
// Set to -1 or +1 to switch to the previous or next weapon.
|
||||
// [FG] prev/next weapon handling from Chocolate Doom
|
||||
|
||||
static int next_weapon = 0;
|
||||
|
||||
// Used for prev/next weapon keys.
|
||||
|
||||
static const struct
|
||||
{
|
||||
weapontype_t weapon;
|
||||
@ -696,6 +694,7 @@ static void G_DoLoadLevel(void)
|
||||
joyxmove = joyymove = 0;
|
||||
mousex = mousey = 0;
|
||||
sendpause = sendsave = paused = false;
|
||||
// [FG] array size!
|
||||
memset (mousearray, 0, sizeof(mousearray));
|
||||
memset (joyarray, 0, sizeof(joyarray));
|
||||
|
||||
@ -718,10 +717,7 @@ static void G_DoLoadLevel(void)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_Responder
|
||||
// Get info needed to make ticcmd_ts for the players.
|
||||
//
|
||||
// [FG] mouse and joystick button handling adapted from Chocolate Doom
|
||||
|
||||
static void SetJoyButtons(unsigned int buttons_mask)
|
||||
{
|
||||
@ -775,6 +771,11 @@ static void SetMouseButtons(unsigned int buttons_mask)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_Responder
|
||||
// Get info needed to make ticcmd_ts for the players.
|
||||
//
|
||||
|
||||
boolean G_Responder(event_t* ev)
|
||||
{
|
||||
// allow spy mode changes even during the demo
|
||||
@ -845,8 +846,7 @@ boolean G_Responder(event_t* ev)
|
||||
return true; // finale ate the event
|
||||
}
|
||||
|
||||
// If the next/previous weapon keys are pressed, set the next_weapon
|
||||
// variable to change weapons when the next ticcmd is generated.
|
||||
// [FG] prev/next weapon handling from Chocolate Doom
|
||||
|
||||
if (ev->type == ev_keydown && ev->data1 == key_prevweapon)
|
||||
{
|
||||
@ -873,8 +873,8 @@ boolean G_Responder(event_t* ev)
|
||||
return false; // always let key up events filter down
|
||||
|
||||
case ev_mouse:
|
||||
// [FG] mouse button and movement handling adapted from Chocolate Doom
|
||||
SetMouseButtons(ev->data1);
|
||||
// [FG] mouse movement handling adapted from Chocolate Doom
|
||||
if (mouseSensitivity_horiz)
|
||||
mousex = ev->data2*(mouseSensitivity_horiz+5)/10;
|
||||
if (mouseSensitivity_vert)
|
||||
@ -882,6 +882,7 @@ boolean G_Responder(event_t* ev)
|
||||
return true; // eat events
|
||||
|
||||
case ev_joystick:
|
||||
// [FG] joystick button and axis handling adapted from Chocolate Doom
|
||||
SetJoyButtons(ev->data1);
|
||||
joyxmove = ev->data2;
|
||||
joyymove = ev->data3;
|
||||
@ -1087,6 +1088,7 @@ static void G_DoCompleted(void)
|
||||
viewactive = false;
|
||||
automapactive = false;
|
||||
|
||||
// [FG] -statdump implementation from Chocolate Doom
|
||||
if (gamemode == commercial || gamemap != 8)
|
||||
{
|
||||
StatCopy(&wminfo);
|
||||
@ -1440,8 +1442,9 @@ static void G_DoSaveGame(void)
|
||||
|
||||
save_p = G_WriteOptions(save_p); // killough 3/1/98: save game options
|
||||
|
||||
// [FG] fix copy size and pointer progression
|
||||
memcpy(save_p, &leveltime, sizeof leveltime); //killough 11/98: save entire word
|
||||
save_p += sizeof leveltime; // [FG] fix copy size and pointer progression
|
||||
save_p += sizeof leveltime;
|
||||
|
||||
// killough 11/98: save revenant tracer state
|
||||
*save_p++ = (gametic-basetic) & 255;
|
||||
@ -1546,8 +1549,9 @@ static void G_DoLoadGame(void)
|
||||
|
||||
// get the times
|
||||
// killough 11/98: save entire word
|
||||
// [FG] fix copy size and pointer progression
|
||||
memcpy(&leveltime, save_p, sizeof leveltime);
|
||||
save_p += sizeof leveltime; // [FG] fix copy size and pointer progression
|
||||
save_p += sizeof leveltime;
|
||||
|
||||
// killough 11/98: load revenant tracer state
|
||||
basetic = gametic - (int) *save_p++;
|
||||
|
@ -31,7 +31,10 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h> // [FG] isatty()
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "z_zone.h"
|
||||
@ -56,6 +59,8 @@ void I_WaitVBL(int count)
|
||||
SDL_Delay((count*500)/TICRATE);
|
||||
}
|
||||
|
||||
// [FG] let the CPU sleep if there is no tic to proceed
|
||||
|
||||
void I_Sleep(int ms)
|
||||
{
|
||||
SDL_Delay(ms);
|
||||
@ -282,9 +287,8 @@ void I_Quit (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// I_Error
|
||||
//
|
||||
// [FG] returns true if stdout is a real console, false if it is a file
|
||||
|
||||
static boolean I_ConsoleStdout(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -295,6 +299,10 @@ static boolean I_ConsoleStdout(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// I_Error
|
||||
//
|
||||
|
||||
void I_Error(const char *error, ...) // killough 3/20/98: add const
|
||||
{
|
||||
boolean exit_gui_popup;
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "i_video.h"
|
||||
#include "i_savepng.h" // [FG] SavePNG()
|
||||
|
||||
// Set the application icon
|
||||
// [FG] set the application icon
|
||||
|
||||
#include "icon.c"
|
||||
|
||||
@ -75,7 +75,7 @@ int joystickSens_y;
|
||||
|
||||
extern SDL_Joystick *sdlJoystick;
|
||||
|
||||
// Get a bitmask of all currently-pressed buttons
|
||||
// [FG] adapt joystick button and axis handling from Chocolate Doom 3.0
|
||||
|
||||
static int GetButtonsState(void)
|
||||
{
|
||||
@ -95,8 +95,6 @@ static int GetButtonsState(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Read the state of an axis
|
||||
|
||||
static int GetAxisState(int axis, int sens)
|
||||
{
|
||||
int result;
|
||||
@ -300,7 +298,8 @@ int I_DoomCode2ScanCode (int a)
|
||||
return a;
|
||||
}
|
||||
|
||||
// Bit mask of mouse button state.
|
||||
// [FG] mouse button and movement handling from Chocolate Doom 3.0
|
||||
|
||||
static unsigned int mouse_button_state = 0;
|
||||
|
||||
static void UpdateMouseButtonState(unsigned int button, boolean on)
|
||||
@ -408,6 +407,8 @@ static void I_HandleMouseEvent(SDL_Event *sdlevent)
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] keyboard event handling from Chocolate Doom 3.0
|
||||
|
||||
static void I_HandleKeyboardEvent(SDL_Event *sdlevent)
|
||||
{
|
||||
// XXX: passing pointers to event for access after this function
|
||||
@ -421,10 +422,7 @@ static void I_HandleKeyboardEvent(SDL_Event *sdlevent)
|
||||
event.data1 = TranslateKey(&sdlevent->key.keysym);
|
||||
event.data2 = 0;
|
||||
event.data3 = 0;
|
||||
/*
|
||||
event.data2 = GetLocalizedKey(&sdlevent->key.keysym);
|
||||
event.data3 = GetTypedChar(&sdlevent->key.keysym);
|
||||
*/
|
||||
|
||||
if (event.data1 != 0)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
|
@ -51,7 +51,7 @@ void I_FinishUpdate (void);
|
||||
|
||||
// Wait for vertical retrace or pause a bit.
|
||||
void I_WaitVBL(int count);
|
||||
void I_Sleep(int ms);
|
||||
void I_Sleep(int ms); // [FG] let the CPU sleep
|
||||
|
||||
void I_ReadScreen (byte* scr);
|
||||
|
||||
@ -59,14 +59,14 @@ int I_DoomCode2ScanCode(int); // killough
|
||||
int I_ScanCode2DoomCode(int); // killough
|
||||
|
||||
void I_ResetScreen(void); // killough 10/98
|
||||
void I_ToggleToggleFullScreen(void);
|
||||
void I_ToggleToggleFullScreen(void); // [FG] fullscreen mode menu toggle
|
||||
|
||||
extern int use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||
extern int page_flip; // killough 8/15/98: enables page flipping (320x200)
|
||||
extern int disk_icon; // killough 10/98
|
||||
extern int hires; // killough 11/98
|
||||
|
||||
boolean I_WritePNGfile(char *filename);
|
||||
boolean I_WritePNGfile(char *filename); // [FG] screenshots in PNG format
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -715,7 +715,7 @@ boolean M_FindCheats(int key)
|
||||
for (i=0;cheat[i].cheat;i++)
|
||||
{
|
||||
ULong64 c=0, m=0;
|
||||
const char *p;
|
||||
const char *p; // [FG] char!
|
||||
for (p=cheat[i].cheat; *p; p++)
|
||||
{
|
||||
unsigned key = tolower(*p)-'a'; // convert to 0-31
|
||||
|
@ -34,7 +34,7 @@
|
||||
// killough 4/16/98: Cheat table structure
|
||||
|
||||
extern struct cheat_s {
|
||||
const char *cheat;
|
||||
const char *cheat; // [FG] char!
|
||||
const char *const deh_cheat;
|
||||
enum {
|
||||
always = 0,
|
||||
|
@ -57,6 +57,7 @@ inline static fixed_t FixedMul(fixed_t a, fixed_t b)
|
||||
|
||||
inline static fixed_t FixedDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
// [FG] avoid 31-bit shift (from Chocolate Doom)
|
||||
return (abs(a)>>14) >= abs(b) ? ((a^b) < 0 ? D_MININT : D_MAXINT) :
|
||||
(fixed_t)(((Long64) a << FRACBITS) / b);
|
||||
}
|
||||
|
@ -3729,7 +3729,7 @@ void M_ExtHelp(int choice)
|
||||
|
||||
void M_DrawExtHelp(void)
|
||||
{
|
||||
char namebfr[] = "HELPnn";
|
||||
char namebfr[] = "HELPnn"; // [FG] char array!
|
||||
|
||||
inhelpscreens = true; // killough 5/1/98
|
||||
namebfr[4] = extended_help_index/10 + 0x30;
|
||||
@ -4199,7 +4199,7 @@ boolean M_Responder (event_t* ev)
|
||||
joywait = I_GetTime() + 5;
|
||||
}
|
||||
|
||||
// [FG] Menu joystick button
|
||||
// [FG] main menu joystick button
|
||||
if (joybmainmenu > -1 && (ev->data1 & (1 << joybmainmenu)))
|
||||
{
|
||||
ch = menuactive ? key_menu_escape : key_escape;
|
||||
@ -5632,12 +5632,14 @@ void M_Init(void)
|
||||
M_InitExtendedHelp(); // init extended help screens // phares 3/30/98
|
||||
|
||||
// [FG] support the BFG Edition IWADs
|
||||
|
||||
if (bfgedition)
|
||||
{
|
||||
strcpy(OptionsMenu[scrnsize].name, "M_DISP");
|
||||
}
|
||||
|
||||
// [FG] save screenshots in PNG format
|
||||
|
||||
if (SavePNG)
|
||||
{
|
||||
const char *bmp_text, *png_text;
|
||||
|
@ -91,7 +91,7 @@ extern int forceFlipPan;
|
||||
extern int grabmouse;
|
||||
extern int cfg_scalefactor; // haleyjd 05/11/09
|
||||
extern int cfg_aspectratio; // haleyjd 05/11/09
|
||||
extern int fullscreen;
|
||||
extern int fullscreen; // [FG] save fullscren mode
|
||||
|
||||
extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98
|
||||
|
||||
@ -663,7 +663,8 @@ default_t defaults[] = {
|
||||
"key to select from menu or review past messages"
|
||||
},
|
||||
|
||||
{ // [FG] clear key bindings with the DEL key
|
||||
// [FG] clear key bindings with the DEL key
|
||||
{
|
||||
"key_menu_clear",
|
||||
(config_t *) &key_menu_clear, NULL,
|
||||
{KEYD_DEL}, {0,255}, number, ss_keys, wad_no,
|
||||
@ -964,7 +965,8 @@ default_t defaults[] = {
|
||||
"key to toggle between two most preferred weapons with ammo"
|
||||
},
|
||||
|
||||
{ // [FG] prev/next weapon keys and buttons
|
||||
// [FG] prev/next weapon keys and buttons
|
||||
{
|
||||
"key_prevweapon",
|
||||
(config_t *) &key_prevweapon, NULL,
|
||||
{0}, {0,255}, number, ss_keys, wad_no,
|
||||
@ -1090,7 +1092,8 @@ default_t defaults[] = {
|
||||
"mouse button number to use for forward motion (-1 = disable)"
|
||||
}, //jff 3/8/98 end of lower range change for -1 allowed in mouse binding
|
||||
|
||||
{ // [FG] prev/next weapon keys and buttons
|
||||
// [FG] prev/next weapon keys and buttons
|
||||
{
|
||||
"mouseb_prevweapon",
|
||||
(config_t *) &mousebprevweapon, NULL,
|
||||
{4}, {-1,MAX_MB-1}, number, ss_keys, wad_no,
|
||||
@ -1139,7 +1142,8 @@ default_t defaults[] = {
|
||||
"joystick button number to use for use/open"
|
||||
},
|
||||
|
||||
{ // [FG] strafe left/right joystick buttons
|
||||
// [FG] strafe left/right joystick buttons
|
||||
{
|
||||
"joyb_strafeleft",
|
||||
(config_t *) &joybstrafeleft, NULL,
|
||||
{4}, {-1,MAX_JSB-1}, 0, ss_keys, wad_no,
|
||||
@ -1153,7 +1157,8 @@ default_t defaults[] = {
|
||||
"joystick button number to strafe right (sideways right)"
|
||||
},
|
||||
|
||||
{ // [FG] prev/next weapon joystick buttons
|
||||
// [FG] prev/next weapon joystick buttons
|
||||
{
|
||||
"joyb_prevweapon",
|
||||
(config_t *) &joybprevweapon, NULL,
|
||||
{2}, {-1,MAX_JSB-1}, 0, ss_keys, wad_no,
|
||||
@ -1167,14 +1172,16 @@ default_t defaults[] = {
|
||||
"joystick button number to cycle to the next weapon"
|
||||
},
|
||||
|
||||
{ // [FG] automap joystick button
|
||||
// [FG] automap joystick button
|
||||
{
|
||||
"joyb_automap",
|
||||
(config_t *) &joybautomap, NULL,
|
||||
{-1}, {-1,MAX_JSB-1}, 0, ss_keys, wad_no,
|
||||
"joystick button number to open the automap"
|
||||
},
|
||||
|
||||
{ // [FG] main menu joystick button
|
||||
// [FG] main menu joystick button
|
||||
{
|
||||
"joyb_mainmenu",
|
||||
(config_t *) &joybmainmenu, NULL,
|
||||
{-1}, {-1,MAX_JSB-1}, 0, ss_keys, wad_no,
|
||||
@ -1751,6 +1758,7 @@ default_t defaults[] = {
|
||||
"1 to perform aspect ratio correction"
|
||||
},
|
||||
|
||||
// [FG] save fullscren mode
|
||||
{
|
||||
"fullscreen",
|
||||
(config_t *) &fullscreen, NULL,
|
||||
@ -2439,6 +2447,7 @@ boolean WriteBMPfile(char *filename, byte *data, int width,
|
||||
}
|
||||
|
||||
// [FG] save screenshots in PNG format
|
||||
|
||||
boolean WritePNGfile(char *filename, byte *data, int width,
|
||||
int height, byte *palette)
|
||||
{
|
||||
@ -2467,7 +2476,7 @@ void M_ScreenShot (void)
|
||||
|
||||
do
|
||||
sprintf(lbmname, //jff 3/30/98 pcx or bmp?
|
||||
screenshot_pcx ? "doom%02d.pcx" : (SavePNG ? "doom%02d.png" : "doom%02d.bmp"), shot++);
|
||||
screenshot_pcx ? "doom%02d.pcx" : (SavePNG ? "doom%02d.png" : "doom%02d.bmp"), shot++); // [FG] PNG
|
||||
while (!access(lbmname,0) && --tries);
|
||||
|
||||
if (tries)
|
||||
@ -2485,7 +2494,7 @@ void M_ScreenShot (void)
|
||||
|
||||
// killough 10/98: detect failure and remove file if error
|
||||
// killough 11/98: add hires support
|
||||
if (!(success = (screenshot_pcx ? WritePCXfile : (SavePNG ? WritePNGfile : WriteBMPfile))
|
||||
if (!(success = (screenshot_pcx ? WritePCXfile : (SavePNG ? WritePNGfile : WriteBMPfile)) // [FG] PNG
|
||||
(lbmname,linear, SCREENWIDTH<<hires, SCREENHEIGHT<<hires,pal)))
|
||||
{
|
||||
int t = errno;
|
||||
|
@ -14,7 +14,7 @@
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Miscellaneous helper functions from Chocolate Doom.
|
||||
// [FG] miscellaneous helper functions from Chocolate Doom.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -13,7 +13,7 @@
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Miscellaneous helper functions from Chocolate Doom.
|
||||
// [FG] miscellaneous helper functions from Chocolate Doom.
|
||||
//
|
||||
|
||||
#ifndef __M_MISC2__
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef __M_SWAP__
|
||||
#define __M_SWAP__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomtype.h" // [FG] inline
|
||||
|
||||
// Endianess handling.
|
||||
// WAD files are stored little endian.
|
||||
|
@ -601,6 +601,7 @@ int MidiToMIDI(UBYTE *mid,MIDI *mididata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// [FG] disable dead static code
|
||||
#if 0
|
||||
//#ifdef STANDALONE /* this code unused by BOOM provided for future portability */
|
||||
// /* it also provides a MUS to MID file converter*/
|
||||
@ -758,6 +759,7 @@ int main(int argc,char **argv)
|
||||
musst = fopen(musfile,"rb");
|
||||
if (musst)
|
||||
{
|
||||
// [FG] check return value
|
||||
if(!fread(&MUSh,sizeof(MUSheader),1,musst))
|
||||
{
|
||||
printf("Error reading MUS file\n");
|
||||
|
@ -246,7 +246,7 @@ static boolean P_CheckMissileRange(mobj_t *actor)
|
||||
static boolean P_IsOnLift(const mobj_t *actor)
|
||||
{
|
||||
const sector_t *sec = actor->subsector->sector;
|
||||
line_t line = {0};
|
||||
line_t line = {0}; // [FG] initialize
|
||||
int l;
|
||||
|
||||
// Short-circuit: it's on a lift which is active.
|
||||
@ -2577,6 +2577,7 @@ void A_LineEffect(mobj_t *mo)
|
||||
line_t junk = *lines; // Fake linedef set to 1st
|
||||
if ((junk.special = (short)mo->state->misc1)) // Linedef type
|
||||
{
|
||||
// [FG] made static
|
||||
static player_t player; // Remember player status
|
||||
player_t *oldplayer = mo->player; // Remember player status
|
||||
mo->player = &player; // Fake player
|
||||
|
@ -164,12 +164,13 @@ void P_LoadSegs (int lump)
|
||||
int side, linedef;
|
||||
line_t *ldef;
|
||||
|
||||
// [FG] extended nodes
|
||||
li->v1 = &vertexes[(unsigned short)SHORT(ml->v1)];
|
||||
li->v2 = &vertexes[(unsigned short)SHORT(ml->v2)];
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<16;
|
||||
li->offset = (SHORT(ml->offset))<<16;
|
||||
linedef = (unsigned short)SHORT(ml->linedef);
|
||||
linedef = (unsigned short)SHORT(ml->linedef); // [FG] extended nodes
|
||||
ldef = &lines[linedef];
|
||||
li->linedef = ldef;
|
||||
side = SHORT(ml->side);
|
||||
@ -204,6 +205,7 @@ void P_LoadSubsectors (int lump)
|
||||
|
||||
for (i=0; i<numsubsectors; i++)
|
||||
{
|
||||
// [FG] extended nodes
|
||||
subsectors[i].numlines = (unsigned short)SHORT(((mapsubsector_t *) data)[i].numsegs );
|
||||
subsectors[i].firstline = (unsigned short)SHORT(((mapsubsector_t *) data)[i].firstseg);
|
||||
}
|
||||
@ -311,7 +313,7 @@ void P_LoadNodes (int lump)
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
int k;
|
||||
no->children[j] = (unsigned short)SHORT(mn->children[j]);
|
||||
no->children[j] = (unsigned short)SHORT(mn->children[j]); // [FG] extended nodes
|
||||
|
||||
// [FG] extended nodes
|
||||
if (no->children[j] == 0xFFFF)
|
||||
@ -407,6 +409,7 @@ void P_LoadLineDefs (int lump)
|
||||
line_t *ld = lines+i;
|
||||
vertex_t *v1, *v2;
|
||||
|
||||
// [FG] extended nodes
|
||||
ld->flags = (unsigned short)SHORT(mld->flags);
|
||||
ld->special = SHORT(mld->special);
|
||||
ld->tag = SHORT(mld->tag);
|
||||
|
@ -54,7 +54,7 @@ typedef struct {
|
||||
|
||||
int P_DivlineSide(fixed_t x, fixed_t y, const divline_t *node)
|
||||
{
|
||||
fixed_t left = 0, right = 0;
|
||||
fixed_t left = 0, right = 0; // [FG] initialize
|
||||
return
|
||||
!node->dx ? x == node->x ? 2 : x <= node->x ? node->dy > 0 : node->dy < 0 :
|
||||
!node->dy ? x == node->y ? 2 : y <= node->y ? node->dx < 0 : node->dx > 0 :
|
||||
|
@ -71,6 +71,7 @@ typedef struct
|
||||
//
|
||||
typedef PACKED_STRUCT (
|
||||
{
|
||||
// [FG] signed char!
|
||||
signed char istexture; //jff 3/23/98 make char for comparison
|
||||
char endname[9]; // if false, it is a flat
|
||||
char startname[9];
|
||||
|
@ -772,7 +772,7 @@ void R_InitTranMap(int progress)
|
||||
char fname[PATH_MAX+1], *D_DoomPrefDir(void);
|
||||
struct {
|
||||
unsigned char pct;
|
||||
unsigned char playpal[256*3];
|
||||
unsigned char playpal[256*3]; // [FG] a palette has 256 colors saved as byte triples
|
||||
} cache;
|
||||
FILE *cachefp = fopen(strcat(strcpy(fname, D_DoomPrefDir()),
|
||||
"/tranmap.dat"),"r+b");
|
||||
@ -781,7 +781,7 @@ void R_InitTranMap(int progress)
|
||||
|
||||
// Use cached translucency filter if it's available
|
||||
|
||||
if (!cachefp ? cachefp = fopen(fname,"w+b") , 1 :
|
||||
if (!cachefp ? cachefp = fopen(fname,"w+b") , 1 : // [FG] open for writing and reading
|
||||
fread(&cache, 1, sizeof cache, cachefp) != sizeof cache ||
|
||||
cache.pct != tran_filter_pct ||
|
||||
memcmp(cache.playpal, playpal, sizeof cache.playpal) ||
|
||||
@ -853,7 +853,7 @@ void R_InitTranMap(int progress)
|
||||
if (cachefp) // write out the cached translucency map
|
||||
{
|
||||
cache.pct = tran_filter_pct;
|
||||
memcpy(cache.playpal, playpal, sizeof cache.playpal);
|
||||
memcpy(cache.playpal, playpal, sizeof cache.playpal); // [FG] a palette has 256 colors saved as byte triples
|
||||
fseek(cachefp, 0, SEEK_SET);
|
||||
fwrite(&cache, 1, sizeof cache, cachefp);
|
||||
fwrite(main_tranmap, 256, 256, cachefp);
|
||||
|
@ -181,9 +181,11 @@ typedef struct line_s
|
||||
{
|
||||
vertex_t *v1, *v2; // Vertices, from v1 to v2.
|
||||
fixed_t dx, dy; // Precalculated v2 - v1 for side checking.
|
||||
// [FG] extended nodes
|
||||
unsigned short flags; // Animation related.
|
||||
short special;
|
||||
short tag;
|
||||
// [FG] extended nodes
|
||||
unsigned short sidenum[2]; // Visual appearance: SideDefs.
|
||||
fixed_t bbox[4]; // A bounding box, for the linedef's extent
|
||||
slopetype_t slopetype; // To aid move clipping.
|
||||
@ -206,7 +208,7 @@ typedef struct line_s
|
||||
typedef struct subsector_s
|
||||
{
|
||||
sector_t *sector;
|
||||
int numlines, firstline;
|
||||
int numlines, firstline; // [FG] extended nodes
|
||||
} subsector_t;
|
||||
|
||||
// phares 3/14/98
|
||||
@ -262,6 +264,7 @@ typedef struct
|
||||
{
|
||||
fixed_t x, y, dx, dy; // Partition line.
|
||||
fixed_t bbox[2][4]; // Bounding box for each child.
|
||||
// [FG] extended nodes
|
||||
int children[2]; // If NF_SUBSECTOR its a subsector.
|
||||
} node_t;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "version.h"
|
||||
|
||||
// [FG] allow to build reproducibly
|
||||
#ifndef BUILD_DATE
|
||||
#define BUILD_DATE __DATE__
|
||||
#endif
|
||||
|
@ -181,6 +181,7 @@ static void W_AddFile(const char *name) // killough 1/31/98: static, const
|
||||
else
|
||||
{
|
||||
// WAD file
|
||||
// [FG] check return value
|
||||
if (!read(handle, &header, sizeof(header)))
|
||||
I_Error("Wad file %s doesn't have IWAD or PWAD id\n", filename);
|
||||
if (strncmp(header.identification,"IWAD",4) &&
|
||||
@ -191,6 +192,7 @@ static void W_AddFile(const char *name) // killough 1/31/98: static, const
|
||||
length = header.numlumps*sizeof(filelump_t);
|
||||
fileinfo2free = fileinfo = malloc(length); // killough
|
||||
lseek(handle, header.infotableofs, SEEK_SET);
|
||||
// [FG] check return value
|
||||
if (!read(handle, fileinfo, length))
|
||||
I_Error("Error reading lump directory from %s\n", filename);
|
||||
numlumps += header.numlumps;
|
||||
@ -320,7 +322,7 @@ unsigned W_LumpNameHash(const char *s)
|
||||
// between different resources such as flats, sprites, colormaps
|
||||
//
|
||||
|
||||
int (W_CheckNumForName)(register const char *name, register int name_space)
|
||||
int (W_CheckNumForName)(register const char *name, register int name_space) // [FG] namespace is reserved in C++
|
||||
{
|
||||
// Hash function maps the name to one of possibly numlump chains.
|
||||
// It has been tuned so that the average chain length never exceeds 2.
|
||||
|
Loading…
x
Reference in New Issue
Block a user