diff options
author | Simon Howard | 2008-10-01 17:31:28 +0000 |
---|---|---|
committer | Simon Howard | 2008-10-01 17:31:28 +0000 |
commit | bf5e84859e2aca7f543f88a4a93bb971332aa989 (patch) | |
tree | 377a3eac2ccbfdc6859f7b28ac83cc589d9a1c01 /src | |
parent | fde2f7883fbd50ea4b56c0cc35f15161ff3ab649 (diff) | |
download | chocolate-doom-bf5e84859e2aca7f543f88a4a93bb971332aa989.tar.gz chocolate-doom-bf5e84859e2aca7f543f88a4a93bb971332aa989.tar.bz2 chocolate-doom-bf5e84859e2aca7f543f88a4a93bb971332aa989.zip |
Merge Hexen fixed_t and angle definitions to common code, plus byte
swapping macros, bounding box checking, read/write file, screenshot and
command line argument code. Update Heretic code to use ANG1_X rather
than the new (correct) ANG1 definition.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1311
Diffstat (limited to 'src')
35 files changed, 146 insertions, 618 deletions
diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c index 3f752195..376704fe 100644 --- a/src/heretic/p_enemy.c +++ b/src/heretic/p_enemy.c @@ -1245,7 +1245,7 @@ void A_MummyAttack2(mobj_t * actor) void A_MummyFX1Seek(mobj_t * actor) { - P_SeekerMissile(actor, ANG1 * 10, ANG1 * 20); + P_SeekerMissile(actor, ANG1_X * 10, ANG1_X * 20); } //---------------------------------------------------------------------------- @@ -1326,8 +1326,8 @@ void A_Srcr1Attack(mobj_t * actor) { momz = mo->momz; angle = mo->angle; - P_SpawnMissileAngle(actor, MT_SRCRFX1, angle - ANG1 * 3, momz); - P_SpawnMissileAngle(actor, MT_SRCRFX1, angle + ANG1 * 3, momz); + P_SpawnMissileAngle(actor, MT_SRCRFX1, angle - ANG1_X * 3, momz); + P_SpawnMissileAngle(actor, MT_SRCRFX1, angle + ANG1_X * 3, momz); } if (actor->health < actor->info->spawnhealth / 3) { // Maybe attack again @@ -1892,7 +1892,7 @@ void A_WhirlwindSeek(mobj_t * actor) { return; } - P_SeekerMissile(actor, ANG1 * 10, ANG1 * 30); + P_SeekerMissile(actor, ANG1_X * 10, ANG1_X * 30); } //---------------------------------------------------------------------------- diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c index dc0b81ea..d3261093 100644 --- a/src/heretic/p_pspr.c +++ b/src/heretic/p_pspr.c @@ -1465,7 +1465,7 @@ void A_FireSkullRodPL2(player_t * player, pspdef_t * psp) void A_SkullRodPL2Seek(mobj_t * actor) { - P_SeekerMissile(actor, ANG1 * 10, ANG1 * 30); + P_SeekerMissile(actor, ANG1_X * 10, ANG1_X * 30); } //---------------------------------------------------------------------------- @@ -1634,7 +1634,7 @@ void A_PhoenixPuff(mobj_t * actor) mobj_t *puff; angle_t angle; - P_SeekerMissile(actor, ANG1 * 5, ANG1 * 10); + P_SeekerMissile(actor, ANG1_X * 5, ANG1_X * 10); puff = P_SpawnMobj(actor->x, actor->y, actor->z, MT_PHOENIXPUFF); angle = actor->angle + ANG90; angle >>= ANGLETOFINESHIFT; diff --git a/src/hexen/Makefile.am b/src/hexen/Makefile.am index 60577b34..93567c57 100644 --- a/src/hexen/Makefile.am +++ b/src/hexen/Makefile.am @@ -1,3 +1,4 @@ +AM_CFLAGS=-I.. @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ noinst_LIBRARIES=libhexen.a @@ -64,4 +65,3 @@ i_ibm.c \ i_sound.c i_sound.h libhexen_a_SOURCES=$(SOURCE_FILES) -libhexen_a_CFLAGS=-I.. diff --git a/src/hexen/a_action.c b/src/hexen/a_action.c index 1361106d..cb3ba817 100644 --- a/src/hexen/a_action.c +++ b/src/hexen/a_action.c @@ -206,7 +206,7 @@ void A_PotteryCheck(mobj_t * actor) if (P_CheckSight(actor, pmo) && (abs(R_PointToAngle2(pmo->x, pmo->y, actor->x, actor->y) - - pmo->angle) <= ANGLE_45)) + pmo->angle) <= ANG45)) { // Previous state (pottery bit waiting state) P_SetMobjState(actor, actor->state - &states[0] - 1); } @@ -228,7 +228,7 @@ void A_PotteryCheck(mobj_t * actor) pmo->y, actor->x, actor->y) - - pmo->angle) <= ANGLE_45)) + pmo->angle) <= ANG45)) { // Previous state (pottery bit waiting state) P_SetMobjState(actor, actor->state - &states[0] - 1); return; @@ -925,7 +925,7 @@ void A_Quake(mobj_t * actor) P_DamageMobj(victim, NULL, NULL, HITDICE(1)); } // Thrust player around - an = victim->angle + ANGLE_1 * P_Random(); + an = victim->angle + ANG1 * P_Random(); P_ThrustMobj(victim, an, richters << (FRACBITS - 1)); } } @@ -1292,11 +1292,11 @@ void A_BatMove(mobj_t * actor) if (P_Random() < 128) { - newangle = actor->angle + ANGLE_1 * actor->args[4]; + newangle = actor->angle + ANG1 * actor->args[4]; } else { - newangle = actor->angle - ANGLE_1 * actor->args[4]; + newangle = actor->angle - ANG1 * actor->args[4]; } // Adjust momentum vector to new direction diff --git a/src/hexen/am_map.c b/src/hexen/am_map.c index 6678f325..a0a1703e 100644 --- a/src/hexen/am_map.c +++ b/src/hexen/am_map.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "i_swap.h" #include "p_local.h" #include "am_map.h" #include "am_data.h" diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index 7527d7f6..25819f02 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "m_argv.h" #include "p_local.h" #include <stdlib.h> // for atoi() diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 45e739ee..1fcceee3 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -24,6 +24,7 @@ #include <string.h> #include "h2def.h" +#include "m_misc.h" #include "p_local.h" #include "soundst.h" @@ -1024,7 +1025,8 @@ void G_Ticker(void) G_DoPlayDemo(); break; case ga_screenshot: - M_ScreenShot(); + V_ScreenShot("HEXEN%02i.pcx"); + P_SetMessage(&players[consoleplayer], "SCREEN SHOT", false); gameaction = ga_nothing; break; case ga_leavemap: diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 3518ea37..603b2f47 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -33,6 +33,7 @@ #include <stdlib.h> #include <time.h> #include "h2def.h" +#include "m_argv.h" #include "p_local.h" #include "soundst.h" @@ -836,22 +837,6 @@ void CleanExit(void) //========================================================================== // -// FixedDiv -// -//========================================================================== - -fixed_t FixedDiv(fixed_t a, fixed_t b) -{ - if ((abs(a) >> 14) >= abs(b)) - { - return ((a ^ b) < 0 ? INT_MIN : INT_MAX); - } - return (FixedDiv2(a, b)); -} - - -//========================================================================== -// // CreateSavePath // //========================================================================== diff --git a/src/hexen/h2def.h b/src/hexen/h2def.h index 61e0fc70..c688519e 100644 --- a/src/hexen/h2def.h +++ b/src/hexen/h2def.h @@ -36,6 +36,14 @@ #define strncasecmp strnicmp #endif +// for fixed_t: + +#include "m_fixed.h" + +// angle definitions: + +#include "tables.h" + #define VERSION 110 #define VERSION_TEXT "v1.1" @@ -140,27 +148,8 @@ extern byte *destview, *destscreen; // PC direct to screen pointers #define MINIMUM_HEAP_SIZE 0x800000 // 8 meg #define MAXIMUM_HEAP_SIZE 0x2000000 // 32 meg -#define FRACBITS 16 -#define FRACUNIT (1<<FRACBITS) -typedef int fixed_t; - typedef unsigned int uint; -//#define ANGLE_1 0x01000000 -#define ANGLE_45 0x20000000 -#define ANGLE_90 0x40000000 -#define ANGLE_180 0x80000000 -#define ANGLE_MAX 0xffffffff -#define ANGLE_1 (ANGLE_45/45) -#define ANGLE_60 (ANGLE_180/3) - -#define ANG45 0x20000000 -#define ANG90 0x40000000 -#define ANG180 0x80000000 -#define ANG270 0xc0000000 - -typedef unsigned angle_t; - typedef enum { sk_baby, @@ -745,9 +734,6 @@ extern event_t events[MAXEVENTS]; extern int eventhead; extern int eventtail; -extern fixed_t finesine[5 * FINEANGLES / 4]; -extern fixed_t *finecosine; - extern gameaction_t gameaction; extern boolean paused; @@ -859,40 +845,6 @@ extern boolean autostart; =============================================================================== */ - -fixed_t FixedMul(fixed_t a, fixed_t b); -fixed_t FixedDiv(fixed_t a, fixed_t b); -fixed_t FixedDiv2(fixed_t a, fixed_t b); - -#ifdef __WATCOMC__ -#pragma aux FixedMul = \ - "imul ebx", \ - "shrd eax,edx,16" \ - parm [eax] [ebx] \ - value [eax] \ - modify exact [eax edx] - -#pragma aux FixedDiv2 = \ - "cdq", \ - "shld edx,eax,16", \ - "sal eax,16", \ - "idiv ebx" \ - parm [eax] [ebx] \ - value [eax] \ - modify exact [eax edx] -#endif - -#ifdef __BIG_ENDIAN__ -short ShortSwap(short); -long LongSwap(long); -#define SHORT(x) ShortSwap(x) -#define LONG(x) LongSwap(x) -#else -#define SHORT(x) (x) -#define LONG(x) (x) -#endif - - #include "w_wad.h" #include "z_zone.h" @@ -1171,14 +1123,8 @@ int R_CheckTextureNumForName(char *name); //---- //MISC //---- -extern int myargc; -extern char **myargv; extern int localQuakeHappening[MAXPLAYERS]; -int M_CheckParm(char *check); -// returns the position of the given parameter in the arg list (0 if not found) -boolean M_ParmExists(char *check); - void M_ExtractFileBase(char *path, char *dest); void M_ForceUppercase(char *text); @@ -1195,20 +1141,7 @@ extern int prndindex; void M_ClearRandom(void); // fix randoms for demos -void M_FindResponseFile(void); - -void M_ClearBox(fixed_t * box); -void M_AddToBox(fixed_t * box, fixed_t x, fixed_t y); -// bounding box functions - -boolean M_WriteFile(char const *name, void *source, int length); -int M_ReadFile(char const *name, byte ** buffer); -int M_ReadFileCLib(char const *name, byte ** buffer); - -void M_ScreenShot(void); - void M_LoadDefaults(char *fileName); - void M_SaveDefaults(void); int M_DrawText(int x, int y, boolean direct, char *string); @@ -1220,7 +1153,6 @@ int M_DrawText(int x, int y, boolean direct, char *string); void SC_Open(char *name); void SC_OpenLump(char *name); void SC_OpenFile(char *name); -void SC_OpenFileCLib(char *name); void SC_Close(void); boolean SC_GetString(void); void SC_MustGetString(void); diff --git a/src/hexen/i_ibm.c b/src/hexen/i_ibm.c index c458d0bf..e5fda74b 100644 --- a/src/hexen/i_ibm.c +++ b/src/hexen/i_ibm.c @@ -28,6 +28,7 @@ #include <stdarg.h> #include <graph.h> #include "h2def.h" +#include "m_argv.h" #include "r_local.h" #include "p_local.h" // for P_AproxDistance #include "sounds.h" diff --git a/src/hexen/i_sound.c b/src/hexen/i_sound.c index bd22304c..1f89c932 100644 --- a/src/hexen/i_sound.c +++ b/src/hexen/i_sound.c @@ -25,6 +25,7 @@ #include <stdio.h> #include "h2def.h" +#include "m_argv.h" #include "dmx.h" #include "sounds.h" #include "i_sound.h" diff --git a/src/hexen/info.c b/src/hexen/info.c index aa4621d4..95202cf7 100644 --- a/src/hexen/info.c +++ b/src/hexen/info.c @@ -21,6 +21,7 @@ // //----------------------------------------------------------------------------- #include "h2def.h" +#include "i_swap.h" // generated by stateco char *sprnames[NUMSPRITES] = { diff --git a/src/hexen/m_misc.c b/src/hexen/m_misc.c index 6955cfb8..0d38941a 100644 --- a/src/hexen/m_misc.c +++ b/src/hexen/m_misc.c @@ -34,6 +34,7 @@ #endif #include <ctype.h> #include "h2def.h" +#include "m_argv.h" #include "p_local.h" #include "soundst.h" @@ -50,59 +51,17 @@ // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static int ReadFile(char const *name, byte ** buffer, int mallocType); - // EXTERNAL DATA DECLARATIONS ---------------------------------------------- extern char *SavePath; // PUBLIC DATA DEFINITIONS ------------------------------------------------- -int myargc; -char **myargv; - // PRIVATE DATA DEFINITIONS ------------------------------------------------ // CODE -------------------------------------------------------------------- //========================================================================== // -// M_CheckParm -// -// Checks for the given parameter in the program's command line arguments. -// Returns the argument number (1 to argc-1) or 0 if not present. -// -//========================================================================== - -int M_CheckParm(char *check) -{ - int i; - - for (i = 1; i < myargc; i++) - { - if (!strcasecmp(check, myargv[i])) - { - return i; - } - } - return 0; -} - -//========================================================================== -// -// M_ParmExists -// -// Returns true if the given parameter exists in the program's command -// line arguments, false if not. -// -//========================================================================== - -boolean M_ParmExists(char *check) -{ - return M_CheckParm(check) != 0 ? true : false; -} - -//========================================================================== -// // M_ExtractFileBase // //========================================================================== @@ -185,206 +144,6 @@ void M_ClearRandom(void) rndindex = prndindex = 0; } - -void M_ClearBox(fixed_t * box) -{ - box[BOXTOP] = box[BOXRIGHT] = INT_MIN; - box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; -} - -void M_AddToBox(fixed_t * box, fixed_t x, fixed_t y) -{ - if (x < box[BOXLEFT]) - box[BOXLEFT] = x; - else if (x > box[BOXRIGHT]) - box[BOXRIGHT] = x; - if (y < box[BOXBOTTOM]) - box[BOXBOTTOM] = y; - else if (y > box[BOXTOP]) - box[BOXTOP] = y; -} - -/* -================== -= -= M_WriteFile -= -================== -*/ - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -boolean M_WriteFile(char const *name, void *source, int length) -{ - int handle, count; - - handle = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - if (handle == -1) - return false; - count = write(handle, source, length); - close(handle); - - if (count < length) - return false; - - return true; -} - -//========================================================================== -// -// M_ReadFile -// -// Read a file into a buffer allocated using Z_Malloc(). -// -//========================================================================== - -int M_ReadFile(char const *name, byte ** buffer) -{ - return ReadFile(name, buffer, MALLOC_ZONE); -} - -//========================================================================== -// -// M_ReadFileCLib -// -// Read a file into a buffer allocated using malloc(). -// -//========================================================================== - -int M_ReadFileCLib(char const *name, byte ** buffer) -{ - return ReadFile(name, buffer, MALLOC_CLIB); -} - -//========================================================================== -// -// ReadFile -// -//========================================================================== - -static int ReadFile(char const *name, byte ** buffer, int mallocType) -{ - int handle, count, length; - struct stat fileinfo; - byte *buf; - - handle = open(name, O_RDONLY | O_BINARY, 0666); - if (handle == -1) - { - I_Error("Couldn't read file %s", name); - } - if (fstat(handle, &fileinfo) == -1) - { - I_Error("Couldn't read file %s", name); - } - length = fileinfo.st_size; - if (mallocType == MALLOC_ZONE) - { // Use zone memory allocation - buf = Z_Malloc(length, PU_STATIC, NULL); - } - else - { // Use c library memory allocation - buf = malloc(length); - if (buf == NULL) - { - I_Error("Couldn't malloc buffer %d for file %s.", length, name); - } - } - count = read(handle, buf, length); - close(handle); - if (count < length) - { - I_Error("Couldn't read file %s", name); - } - *buffer = buf; - return length; -} - -//--------------------------------------------------------------------------- -// -// PROC M_FindResponseFile -// -//--------------------------------------------------------------------------- - -#define MAXARGVS 100 - -void M_FindResponseFile(void) -{ - int i; - - for (i = 1; i < myargc; i++) - { - if (myargv[i][0] == '@') - { - FILE *handle; - int size; - int k; - int index; - int indexinfile; - char *infile; - char *file; - char *moreargs[20]; - char *firstargv; - - // READ THE RESPONSE FILE INTO MEMORY - handle = fopen(&myargv[i][1], "rb"); - if (!handle) - { - printf("\nNo such response file!"); - exit(1); - } - ST_Message("Found response file %s!\n", &myargv[i][1]); - fseek(handle, 0, SEEK_END); - size = ftell(handle); - fseek(handle, 0, SEEK_SET); - file = malloc(size); - fread(file, size, 1, handle); - fclose(handle); - - // KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG - for (index = 0, k = i + 1; k < myargc; k++) - moreargs[index++] = myargv[k]; - - firstargv = myargv[0]; - myargv = malloc(sizeof(char *) * MAXARGVS); - memset(myargv, 0, sizeof(char *) * MAXARGVS); - myargv[0] = firstargv; - - infile = file; - indexinfile = k = 0; - indexinfile++; // SKIP PAST ARGV[0] (KEEP IT) - do - { - myargv[indexinfile++] = infile + k; - while (k < size && - ((*(infile + k) >= ' ' + 1) && (*(infile + k) <= 'z'))) - k++; - *(infile + k) = 0; - while (k < size && - ((*(infile + k) <= ' ') || (*(infile + k) > 'z'))) - k++; - } - while (k < size); - - for (k = 0; k < index; k++) - myargv[indexinfile++] = moreargs[k]; - myargc = indexinfile; - // DISPLAY ARGS - if (M_CheckParm("-debug")) - { - ST_Message("%d command-line args:\n", myargc); - for (k = 1; k < myargc; k++) - { - ST_Message("%s\n", myargv[k]); - } - } - break; - } - } -} - //--------------------------------------------------------------------------- // // PROC M_ForceUppercase @@ -734,157 +493,3 @@ void M_LoadDefaults(char *fileName) #endif } -/* -============================================================================== - - SCREEN SHOTS - -============================================================================== -*/ - - -typedef struct -{ - char manufacturer; - char version; - char encoding; - char bits_per_pixel; - unsigned short xmin, ymin, xmax, ymax; - unsigned short hres, vres; - unsigned char palette[48]; - char reserved; - char color_planes; - unsigned short bytes_per_line; - unsigned short palette_type; - char filler[58]; - unsigned char data; // unbounded -} pcx_t; - -/* -============== -= -= WritePCXfile -= -============== -*/ - -void WritePCXfile(char *filename, byte * data, int width, int height, - byte * palette) -{ - int i, length; - pcx_t *pcx; - byte *pack; - - pcx = Z_Malloc(width * height * 2 + 1000, PU_STATIC, NULL); - - pcx->manufacturer = 0x0a; // PCX id - pcx->version = 5; // 256 color - pcx->encoding = 1; // uncompressed - pcx->bits_per_pixel = 8; // 256 color - pcx->xmin = 0; - pcx->ymin = 0; - pcx->xmax = SHORT(width - 1); - pcx->ymax = SHORT(height - 1); - pcx->hres = SHORT(width); - pcx->vres = SHORT(height); - memset(pcx->palette, 0, sizeof(pcx->palette)); - pcx->color_planes = 1; // chunky image - pcx->bytes_per_line = SHORT(width); - pcx->palette_type = SHORT(2); // not a grey scale - memset(pcx->filler, 0, sizeof(pcx->filler)); - -// -// pack the image -// - pack = &pcx->data; - - for (i = 0; i < width * height; i++) - if ((*data & 0xc0) != 0xc0) - *pack++ = *data++; - else - { - *pack++ = 0xc1; - *pack++ = *data++; - } - -// -// write the palette -// - *pack++ = 0x0c; // palette ID byte - for (i = 0; i < 768; i++) - *pack++ = *palette++; - -// -// write output file -// - length = pack - (byte *) pcx; - M_WriteFile(filename, pcx, length); - - Z_Free(pcx); -} - - -//============================================================================== - -/* -================== -= -= M_ScreenShot -= -================== -*/ - -void M_ScreenShot(void) -{ - int i; - byte *linear; - char lbmname[12]; - byte *pal; - -#ifdef _WATCOMC_ - extern byte *pcscreen; -#endif -// -// munge planar buffer to linear -// -#ifdef _WATCOMC_ - linear = pcscreen; -#else - linear = screen; -#endif -// -// find a file name to save it to -// - strcpy(lbmname, "HEXEN00.pcx"); - - for (i = 0; i <= 99; i++) - { - lbmname[5] = i / 10 + '0'; - lbmname[6] = i % 10 + '0'; - if (access(lbmname, 0) == -1) - break; // file doesn't exist - } - if (i == 100) - I_Error("M_ScreenShot: Couldn't create a PCX"); - -// -// save the pcx file -// -#ifdef __WATCOMC__ - pal = (byte *) Z_Malloc(768, PU_STATIC, NULL); - outp(0x3c7, 0); - for (i = 0; i < 768; i++) - { - *(pal + i) = inp(0x3c9) << 2; - } -#else - pal = (byte *) W_CacheLumpName("PLAYPAL", PU_CACHE); -#endif - - WritePCXfile(lbmname, linear, SCREENWIDTH, SCREENHEIGHT, pal); - - P_SetMessage(&players[consoleplayer], "SCREEN SHOT", false); -#ifdef __WATCOMC__ - Z_Free(pal); -#endif -} diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c index cb603e99..24cbefaf 100644 --- a/src/hexen/p_enemy.c +++ b/src/hexen/p_enemy.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "i_swap.h" #include "p_local.h" #include "soundst.h" @@ -2640,7 +2641,7 @@ void A_BishopMissileWeave(mobj_t * actor) void A_BishopMissileSeek(mobj_t * actor) { - P_SeekerMissile(actor, ANGLE_1 * 2, ANGLE_1 * 3); + P_SeekerMissile(actor, ANG1 * 2, ANG1 * 3); } //============================================================================ @@ -2838,7 +2839,7 @@ static void DragonSeek(mobj_t * actor, angle_t thresh, angle_t turnMax) if (abs(actor->angle - R_PointToAngle2(actor->x, actor->y, target->x, - target->y)) < ANGLE_45 / 2) + target->y)) < ANG45 / 2) { oldTarget = actor->target; actor->target = target; @@ -2860,7 +2861,7 @@ static void DragonSeek(mobj_t * actor, angle_t thresh, angle_t turnMax) if (actor->target && P_Random() < 200) { bestArg = -1; - bestAngle = ANGLE_MAX; + bestAngle = ANG_MAX; angleToTarget = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); @@ -2935,7 +2936,7 @@ void A_DragonFlight(mobj_t * actor) { angle_t angle; - DragonSeek(actor, 4 * ANGLE_1, 8 * ANGLE_1); + DragonSeek(actor, 4 * ANG1, 8 * ANG1); if (actor->target) { if (!(actor->target->flags & MF_SHOOTABLE)) @@ -2945,13 +2946,13 @@ void A_DragonFlight(mobj_t * actor) } angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); - if (abs(actor->angle - angle) < ANGLE_45 / 2 + if (abs(actor->angle - angle) < ANG45 / 2 && P_CheckMeleeRange(actor)) { P_DamageMobj(actor->target, actor, actor, HITDICE(8)); S_StartSound(actor, SFX_DRAGON_ATTACK); } - else if (abs(actor->angle - angle) <= ANGLE_1 * 20) + else if (abs(actor->angle - angle) <= ANG1 * 20) { P_SetMobjState(actor, actor->info->missilestate); S_StartSound(actor, SFX_DRAGON_ATTACK); @@ -3646,9 +3647,9 @@ void A_FiredChase(mobj_t * actor) ang = R_PointToAngle2(actor->x, actor->y, target->x, target->y); if (P_Random() < 128) - ang += ANGLE_90; + ang += ANG90; else - ang -= ANGLE_90; + ang -= ANG90; ang >>= ANGLETOFINESHIFT; actor->momx = FixedMul(8 * FRACUNIT, finecosine[ang]); actor->momy = FixedMul(8 * FRACUNIT, finesine[ang]); @@ -3892,8 +3893,8 @@ void A_IceGuyMissileExplode(mobj_t * actor) #define SORC_FIRING_SPELL 6 #define BALL1_ANGLEOFFSET 0 -#define BALL2_ANGLEOFFSET (ANGLE_MAX/3) -#define BALL3_ANGLEOFFSET ((ANGLE_MAX/3)*2) +#define BALL2_ANGLEOFFSET (ANG_MAX/3) +#define BALL3_ANGLEOFFSET ((ANG_MAX/3)*2) void A_SorcBallOrbit(mobj_t * actor); void A_SorcSpinBalls(mobj_t * actor); @@ -3922,7 +3923,7 @@ void A_SorcSpinBalls(mobj_t * actor) actor->args[0] = 0; // Currently no defense actor->args[3] = SORC_NORMAL; actor->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed - actor->special1 = ANGLE_1; + actor->special1 = ANG1; z = actor->z - actor->floorclip + actor->info->height; mo = P_SpawnMobj(actor->x, actor->y, z, MT_SORCBALL1); @@ -4172,7 +4173,7 @@ void A_SorcUpdateBallAngle(mobj_t * actor) { if (actor->type == MT_SORCBALL1) { - actor->target->special1 += ANGLE_1 * actor->target->args[4]; + actor->target->special1 += ANG1 * actor->target->args[4]; } } @@ -4207,8 +4208,8 @@ void A_CastSorcererSpell(mobj_t * actor) mo->target = parent; break; case MT_SORCBALL3: // Reinforcements - ang1 = actor->angle - ANGLE_45; - ang2 = actor->angle + ANGLE_45; + ang1 = actor->angle - ANG45; + ang2 = actor->angle + ANG45; if (actor->health < (actor->info->spawnhealth / 3)) { // Spawn 2 at a time mo = P_SpawnMissileAngle(parent, MT_SORCFX3, ang1, @@ -4242,7 +4243,7 @@ void A_SpawnReinforcements(mobj_t *actor) mobj_t *mo; angle_t ang; - ang = ANGLE_1 * P_Random(); + ang = ANG1 * P_Random(); mo = P_SpawnMissileAngle(actor, MT_SORCFX3, ang, 5*FRACUNIT); if (mo) mo->target = parent; } @@ -4255,8 +4256,8 @@ void A_SorcOffense1(mobj_t * actor) angle_t ang1, ang2; mobj_t *parent = (mobj_t *) actor->target; - ang1 = actor->angle + ANGLE_1 * 70; - ang2 = actor->angle - ANGLE_1 * 70; + ang1 = actor->angle + ANG1 * 70; + ang2 = actor->angle - ANG1 * 70; mo = P_SpawnMissileAngle(parent, MT_SORCFX1, ang1, 0); if (mo) { @@ -4289,7 +4290,7 @@ void A_SorcOffense2(mobj_t * actor) index = actor->args[4] << 5; actor->args[4] += 15; delta = (finesine[index]) * SORCFX4_SPREAD_ANGLE; - delta = (delta >> FRACBITS) * ANGLE_1; + delta = (delta >> FRACBITS) * ANG1; ang1 = actor->angle + delta; mo = P_SpawnMissileAngle(parent, MT_SORCFX4, ang1, 0); if (mo) @@ -4347,7 +4348,7 @@ void A_SpawnFizzle(mobj_t * actor) void A_SorcFX1Seek(mobj_t * actor) { A_BounceCheck(actor); - P_SeekerMissile(actor, ANGLE_1 * 2, ANGLE_1 * 6); + P_SeekerMissile(actor, ANG1 * 2, ANG1 * 6); } @@ -4414,7 +4415,7 @@ void A_SorcFX2Orbit(mobj_t * actor) // Move to new position based on angle if (actor->args[0]) // Counter clock-wise { - actor->special1 += ANGLE_1 * 10; + actor->special1 += ANG1 * 10; angle = ((angle_t) actor->special1) >> ANGLETOFINESHIFT; x = parent->x + FixedMul(dist, finecosine[angle]); y = parent->y + FixedMul(dist, finesine[angle]); @@ -4425,7 +4426,7 @@ void A_SorcFX2Orbit(mobj_t * actor) } else // Clock wise { - actor->special1 -= ANGLE_1 * 10; + actor->special1 -= ANG1 * 10; angle = ((angle_t) actor->special1) >> ANGLETOFINESHIFT; x = parent->x + FixedMul(dist, finecosine[angle]); y = parent->y + FixedMul(dist, finesine[angle]); @@ -4629,9 +4630,9 @@ void A_FastChase(mobj_t * actor) ang = R_PointToAngle2(actor->x, actor->y, target->x, target->y); if (P_Random() < 128) - ang += ANGLE_90; + ang += ANG90; else - ang -= ANGLE_90; + ang -= ANG90; ang >>= ANGLETOFINESHIFT; actor->momx = FixedMul(13 * FRACUNIT, finecosine[ang]); actor->momy = FixedMul(13 * FRACUNIT, finesine[ang]); @@ -4979,27 +4980,27 @@ void A_KoraxBonePop(mobj_t * actor) x = actor->x, y = actor->y, z = actor->z; // Spawn 6 spirits equalangularly - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT1, ANGLE_60 * 0, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT1, ANG60 * 0, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT2, ANGLE_60 * 1, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT2, ANG60 * 1, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT3, ANGLE_60 * 2, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT3, ANG60 * 2, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT4, ANGLE_60 * 3, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT4, ANG60 * 3, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT5, ANGLE_60 * 4, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT5, ANG60 * 4, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); - mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT6, ANGLE_60 * 5, + mo = P_SpawnMissileAngle(actor, MT_KORAX_SPIRIT6, ANG60 * 5, 5 * FRACUNIT); if (mo) KSpiritInit(mo, actor); @@ -5101,7 +5102,7 @@ void A_KoraxCommand(mobj_t * actor) S_StartSound(actor, SFX_KORAX_COMMAND); // Shoot stream of lightning to ceiling - ang = (actor->angle - ANGLE_90) >> ANGLETOFINESHIFT; + ang = (actor->angle - ANG90) >> ANGLETOFINESHIFT; x = actor->x + FixedMul(KORAX_COMMAND_OFFSET, finecosine[ang]); y = actor->y + FixedMul(KORAX_COMMAND_OFFSET, finesine[ang]); z = actor->z + KORAX_COMMAND_HEIGHT; @@ -5139,7 +5140,7 @@ void A_KoraxCommand(mobj_t * actor) } -#define KORAX_DELTAANGLE (85*ANGLE_1) +#define KORAX_DELTAANGLE (85*ANG1) #define KORAX_ARM_EXTENSION_SHORT (40*FRACUNIT) #define KORAX_ARM_EXTENSION_LONG (55*FRACUNIT) @@ -5346,8 +5347,8 @@ void A_KSpiritRoam(mobj_t * actor) { if (actor->special1) { - A_KSpiritSeeker(actor, actor->args[0] * ANGLE_1, - actor->args[0] * ANGLE_1 * 2); + A_KSpiritSeeker(actor, actor->args[0] * ANG1, + actor->args[0] * ANG1 * 2); } A_KSpiritWeave(actor); if (P_Random() < 50) diff --git a/src/hexen/p_map.c b/src/hexen/p_map.c index 27c8386f..e573ef07 100644 --- a/src/hexen/p_map.c +++ b/src/hexen/p_map.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "m_bbox.h" #include "p_local.h" #include "soundst.h" diff --git a/src/hexen/p_maputl.c b/src/hexen/p_maputl.c index 3c92717c..e15fe3a0 100644 --- a/src/hexen/p_maputl.c +++ b/src/hexen/p_maputl.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "m_bbox.h" #include "p_local.h" static mobj_t *RoughBlockCheck(mobj_t * mo, int index); diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c index 45c43b89..4a840dfd 100644 --- a/src/hexen/p_mobj.c +++ b/src/hexen/p_mobj.c @@ -274,9 +274,9 @@ int P_FaceMobj(mobj_t * source, mobj_t * target, angle_t * delta) if (angle2 > angle1) { diff = angle2 - angle1; - if (diff > ANGLE_180) + if (diff > ANG180) { - *delta = ANGLE_MAX - diff; + *delta = ANG_MAX - diff; return (0); } else @@ -288,9 +288,9 @@ int P_FaceMobj(mobj_t * source, mobj_t * target, angle_t * delta) else { diff = angle1 - angle2; - if (diff > ANGLE_180) + if (diff > ANG180) { - *delta = ANGLE_MAX - diff; + *delta = ANG_MAX - diff; return (1); } else @@ -494,7 +494,7 @@ void P_XYMovement(mobj_t * mo) angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y) + - ANGLE_1 * ((P_Random() % 16) - 8); + ANG1 * ((P_Random() % 16) - 8); speed = P_AproxDistance(mo->momx, mo->momy); speed = FixedMul(speed, 0.75 * FRACUNIT); mo->angle = angle; @@ -550,13 +550,13 @@ void P_XYMovement(mobj_t * mo) case MT_SORCBOSS: // Deflection if (P_Random() < 128) - angle += ANGLE_45; + angle += ANG45; else - angle -= ANGLE_45; + angle -= ANG45; break; default: // Reflection - angle += ANGLE_1 * ((P_Random() % 16) - 8); + angle += ANG1 * ((P_Random() % 16) - 8); break; } diff --git a/src/hexen/p_pspr.c b/src/hexen/p_pspr.c index b5c4cecd..bc524388 100644 --- a/src/hexen/p_pspr.c +++ b/src/hexen/p_pspr.c @@ -672,7 +672,7 @@ void P_BulletSlope (mobj_t *mo) // //============================================================================ -#define MAX_ANGLE_ADJUST (5*ANGLE_1) +#define MAX_ANGADJUST (5*ANG1) void AdjustPlayerAngle(mobj_t * pmo) { @@ -681,9 +681,9 @@ void AdjustPlayerAngle(mobj_t * pmo) angle = R_PointToAngle2(pmo->x, pmo->y, linetarget->x, linetarget->y); difference = (int) angle - (int) pmo->angle; - if (abs(difference) > MAX_ANGLE_ADJUST) + if (abs(difference) > MAX_ANGADJUST) { - pmo->angle += difference > 0 ? MAX_ANGLE_ADJUST : -MAX_ANGLE_ADJUST; + pmo->angle += difference > 0 ? MAX_ANGADJUST : -MAX_ANGADJUST; } else { @@ -1182,8 +1182,8 @@ void A_MStaffAttack(player_t * player, pspdef_t * psp) angle = pmo->angle; MStaffSpawn(pmo, angle); - MStaffSpawn(pmo, angle - ANGLE_1 * 5); - MStaffSpawn(pmo, angle + ANGLE_1 * 5); + MStaffSpawn(pmo, angle - ANG1 * 5); + MStaffSpawn(pmo, angle + ANG1 * 5); S_StartSound(player->mo, SFX_MAGE_STAFF_FIRE); if (player == &players[consoleplayer]) { @@ -1263,7 +1263,7 @@ void A_MStaffTrack(mobj_t * actor) { actor->special1 = (int) P_RoughMonsterSearch(actor, 10); } - P_SeekerMissile(actor, ANGLE_1 * 2, ANGLE_1 * 10); + P_SeekerMissile(actor, ANG1 * 2, ANG1 * 10); } @@ -1296,8 +1296,8 @@ void A_MStaffAttack2(mobj_t * actor) angle_t angle; angle = actor->angle; MStaffSpawn2(actor, angle); - MStaffSpawn2(actor, angle - ANGLE_1 * 5); - MStaffSpawn2(actor, angle + ANGLE_1 * 5); + MStaffSpawn2(actor, angle - ANG1 * 5); + MStaffSpawn2(actor, angle + ANG1 * 5); S_StartSound(actor, SFX_MAGE_STAFF_FIRE); } @@ -1753,15 +1753,15 @@ void A_CFlameAttack(player_t *player, pspdef_t *psp) P_AimLineAttack(pmo, angle, CFLAMERANGE); // Correctly set linetarget if(!linetarget) { - angle += ANGLE_1*2; + angle += ANG1*2; P_AimLineAttack(pmo, angle, CFLAMERANGE); if(!linetarget) { - angle -= ANGLE_1*4; + angle -= ANG1*4; P_AimLineAttack(pmo, angle, CFLAMERANGE); if(!linetarget) { - angle += ANGLE_1*2; + angle += ANG1*2; } } } @@ -1885,7 +1885,7 @@ void A_CHolyAttack2(mobj_t * actor) break; } mo->z = actor->z; - mo->angle = actor->angle + (ANGLE_45 + ANGLE_45 / 2) - ANGLE_45 * j; + mo->angle = actor->angle + (ANG45 + ANG45 / 2) - ANG45 * j; P_ThrustMobj(mo, mo->angle, mo->info->speed); mo->target = actor->target; mo->args[0] = 10; // initial turn value @@ -2106,8 +2106,8 @@ void A_CHolySeek(mobj_t * actor) } if (actor->special1) { - CHolySeekerMissile(actor, actor->args[0] * ANGLE_1, - actor->args[0] * ANGLE_1 * 2); + CHolySeekerMissile(actor, actor->args[0] * ANG1, + actor->args[0] * ANG1 * 2); if (!((leveltime + 7) & 15)) { actor->args[0] = 5 + (P_Random() / 20); diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index 75939ecb..0863226a 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -27,6 +27,9 @@ #include <math.h> #include <stdlib.h> #include "h2def.h" +#include "m_argv.h" +#include "m_bbox.h" +#include "i_swap.h" #include "p_local.h" #include "soundst.h" diff --git a/src/hexen/p_spec.c b/src/hexen/p_spec.c index f7a820ca..eb221438 100644 --- a/src/hexen/p_spec.c +++ b/src/hexen/p_spec.c @@ -680,7 +680,7 @@ boolean P_ExecuteLineSpecial(int special, byte * args, line_t * line, case 72: // Thrust Mobj if (!side) // Only thrust on side 0 { - P_ThrustMobj(mo, args[0] * (ANGLE_90 / 64), + P_ThrustMobj(mo, args[0] * (ANG90 / 64), args[1] << FRACBITS); buttonSuccess = 1; } diff --git a/src/hexen/p_user.c b/src/hexen/p_user.c index cc6ca8b2..2086bdd2 100644 --- a/src/hexen/p_user.c +++ b/src/hexen/p_user.c @@ -384,7 +384,7 @@ void P_DeathThink(player_t * player) if (player->attacker && player->attacker != player->mo) { // Watch killer dir = P_FaceMobj(player->mo, player->attacker, &delta); - if (delta < ANGLE_1 * 10) + if (delta < ANG1 * 10) { // Looking at killer, so fade damage and poison counters if (player->damagecount) { @@ -396,9 +396,9 @@ void P_DeathThink(player_t * player) } } delta = delta / 8; - if (delta > ANGLE_1 * 5) + if (delta > ANG1 * 5) { - delta = ANGLE_1 * 5; + delta = ANG1 * 5; } if (dir) { // Turn clockwise diff --git a/src/hexen/po_man.c b/src/hexen/po_man.c index 71c1db97..ff06b198 100644 --- a/src/hexen/po_man.c +++ b/src/hexen/po_man.c @@ -25,6 +25,8 @@ // HEADER FILES ------------------------------------------------------------ #include "h2def.h" +#include "m_bbox.h" +#include "i_swap.h" #include "p_local.h" #include "r_local.h" @@ -153,14 +155,14 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean } else { - pe->dist = args[2] * (ANGLE_90 / 64); // Angle + pe->dist = args[2] * (ANG90 / 64); // Angle } } else { - pe->dist = ANGLE_MAX - 1; + pe->dist = ANG_MAX - 1; } - pe->speed = (args[1] * direction * (ANGLE_90 / 64)) >> 3; + pe->speed = (args[1] * direction * (ANG90 / 64)) >> 3; poly->specialdata = pe; SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE + poly->seqType); @@ -185,12 +187,12 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean } else { - pe->dist = args[2] * (ANGLE_90 / 64); // Angle + pe->dist = args[2] * (ANG90 / 64); // Angle } } else { - pe->dist = ANGLE_MAX - 1; + pe->dist = ANG_MAX - 1; } poly = GetPolyobj(polyNum); if (poly != NULL) @@ -202,7 +204,7 @@ boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean I_Error("EV_RotatePoly: Invalid polyobj num: %d\n", polyNum); } direction = -direction; - pe->speed = (args[1] * direction * (ANGLE_90 / 64)) >> 3; + pe->speed = (args[1] * direction * (ANG90 / 64)) >> 3; polyNum = mirror; SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE + poly->seqType); @@ -288,7 +290,7 @@ boolean EV_MovePoly(line_t * line, byte * args, boolean timesEight, boolean pe->speed = args[1] * (FRACUNIT / 8); poly->specialdata = pe; - an = args[2] * (ANGLE_90 / 64); + an = args[2] * (ANG90 / 64); pe->angle = an >> ANGLETOFINESHIFT; pe->xSpeed = FixedMul(pe->speed, finecosine[pe->angle]); @@ -317,7 +319,7 @@ boolean EV_MovePoly(line_t * line, byte * args, boolean timesEight, boolean pe->dist = args[3] * FRACUNIT; // Distance } pe->speed = args[1] * (FRACUNIT / 8); - an = an + ANGLE_180; // reverse the angle + an = an + ANG180; // reverse the angle pe->angle = an >> ANGLETOFINESHIFT; pe->xSpeed = FixedMul(pe->speed, finecosine[pe->angle]); pe->ySpeed = FixedMul(pe->speed, finesine[pe->angle]); @@ -365,7 +367,7 @@ void T_PolyDoor(polydoor_t * pd) pd->dist = pd->totalDist; pd->close = true; pd->tics = pd->waitTics; - pd->direction = (ANGLE_MAX >> ANGLETOFINESHIFT) - + pd->direction = (ANG_MAX >> ANGLETOFINESHIFT) - pd->direction; pd->xSpeed = -pd->xSpeed; pd->ySpeed = -pd->ySpeed; @@ -391,7 +393,7 @@ void T_PolyDoor(polydoor_t * pd) else { // open back up pd->dist = pd->totalDist - pd->dist; - pd->direction = (ANGLE_MAX >> ANGLETOFINESHIFT) - + pd->direction = (ANG_MAX >> ANGLETOFINESHIFT) - pd->direction; pd->xSpeed = -pd->xSpeed; pd->ySpeed = -pd->ySpeed; @@ -493,7 +495,7 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type) pd->speed = args[1] * (FRACUNIT / 8); pd->totalDist = args[3] * FRACUNIT; // Distance pd->dist = pd->totalDist; - an = args[2] * (ANGLE_90 / 64); + an = args[2] * (ANG90 / 64); pd->direction = an >> ANGLETOFINESHIFT; pd->xSpeed = FixedMul(pd->speed, finecosine[pd->direction]); pd->ySpeed = FixedMul(pd->speed, finesine[pd->direction]); @@ -504,8 +506,8 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type) { pd->waitTics = args[3]; pd->direction = 1; // ADD: PODOOR_SWINGL, PODOOR_SWINGR - pd->speed = (args[1] * pd->direction * (ANGLE_90 / 64)) >> 3; - pd->totalDist = args[2] * (ANGLE_90 / 64); + pd->speed = (args[1] * pd->direction * (ANG90 / 64)) >> 3; + pd->totalDist = args[2] * (ANG90 / 64); pd->dist = pd->totalDist; SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE + poly->seqType); @@ -533,7 +535,7 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type) pd->speed = args[1] * (FRACUNIT / 8); pd->totalDist = args[3] * FRACUNIT; // Distance pd->dist = pd->totalDist; - an = an + ANGLE_180; // reverse the angle + an = an + ANG180; // reverse the angle pd->direction = an >> ANGLETOFINESHIFT; pd->xSpeed = FixedMul(pd->speed, finecosine[pd->direction]); pd->ySpeed = FixedMul(pd->speed, finesine[pd->direction]); @@ -544,8 +546,8 @@ boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type) { pd->waitTics = args[3]; pd->direction = -1; // ADD: same as above - pd->speed = (args[1] * pd->direction * (ANGLE_90 / 64)) >> 3; - pd->totalDist = args[2] * (ANGLE_90 / 64); + pd->speed = (args[1] * pd->direction * (ANG90 / 64)) >> 3; + pd->totalDist = args[2] * (ANG90 / 64); pd->dist = pd->totalDist; SN_StartSequence((mobj_t *) & poly->startSpot, SEQ_DOOR_STONE + poly->seqType); @@ -616,7 +618,7 @@ static void ThrustMobj(mobj_t * mobj, seg_t * seg, polyobj_t * po) { return; } - thrustAngle = (seg->angle - ANGLE_90) >> ANGLETOFINESHIFT; + thrustAngle = (seg->angle - ANG90) >> ANGLETOFINESHIFT; pe = po->specialdata; if (pe) diff --git a/src/hexen/r_bsp.c b/src/hexen/r_bsp.c index 539040be..0e140a1c 100644 --- a/src/hexen/r_bsp.c +++ b/src/hexen/r_bsp.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "m_bbox.h" #include "r_local.h" seg_t *curline; diff --git a/src/hexen/r_data.c b/src/hexen/r_data.c index 915bce35..61c3f1cd 100644 --- a/src/hexen/r_data.c +++ b/src/hexen/r_data.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "i_swap.h" #include "r_local.h" #include "p_local.h" diff --git a/src/hexen/r_local.h b/src/hexen/r_local.h index 136558fe..ee66196c 100644 --- a/src/hexen/r_local.h +++ b/src/hexen/r_local.h @@ -324,7 +324,6 @@ extern angle_t clipangle; extern int viewangletox[FINEANGLES / 2]; extern angle_t xtoviewangle[SCREENWIDTH + 1]; -extern fixed_t finetangent[FINEANGLES / 2]; extern fixed_t rw_distance; extern angle_t rw_normalangle; diff --git a/src/hexen/r_main.c b/src/hexen/r_main.c index d61b5114..270b7386 100644 --- a/src/hexen/r_main.c +++ b/src/hexen/r_main.c @@ -24,6 +24,7 @@ #include <math.h> #include "h2def.h" +#include "m_bbox.h" #include "r_local.h" int viewangleoffset; @@ -66,14 +67,6 @@ int viewangletox[FINEANGLES / 2]; // that maps back to x ranges from clipangle to -clipangle angle_t xtoviewangle[SCREENWIDTH + 1]; -// the finetangentgent[angle+FINEANGLES/4] table holds the fixed_t tangent -// values for view angles, ranging from INT_MIN to 0 to INT_MAX. -// fixed_t finetangent[FINEANGLES/2]; - -// fixed_t finesine[5*FINEANGLES/4]; -fixed_t *finecosine = &finesine[FINEANGLES / 4]; - - lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; lighttable_t *scalelightfixed[MAXLIGHTSCALE]; lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; @@ -220,8 +213,6 @@ int R_PointOnSegSide(fixed_t x, fixed_t y, seg_t * line) #define DBITS (FRACBITS-SLOPEBITS) -extern int tantoangle[SLOPERANGE + 1]; // get from tables.c - // int tantoangle[SLOPERANGE+1]; int SlopeDiv(unsigned num, unsigned den) diff --git a/src/hexen/r_things.c b/src/hexen/r_things.c index b460d6a7..09cde03c 100644 --- a/src/hexen/r_things.c +++ b/src/hexen/r_things.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <stdlib.h> #include "h2def.h" +#include "i_swap.h" #include "r_local.h" void R_DrawColumn(void); diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c index fe74cf17..343a04c8 100644 --- a/src/hexen/sb_bar.c +++ b/src/hexen/sb_bar.c @@ -25,6 +25,7 @@ // HEADER FILES ------------------------------------------------------------ #include "h2def.h" +#include "m_bbox.h" #include "p_local.h" #include "soundst.h" diff --git a/src/hexen/sc_man.c b/src/hexen/sc_man.c index 418c88af..63afb3cb 100644 --- a/src/hexen/sc_man.c +++ b/src/hexen/sc_man.c @@ -27,6 +27,7 @@ #include <string.h> #include <stdlib.h> #include "h2def.h" +#include "m_misc.h" // MACROS ------------------------------------------------------------------ @@ -35,7 +36,6 @@ #define ASCII_QUOTE (34) #define LUMP_SCRIPT 1 #define FILE_ZONE_SCRIPT 2 -#define FILE_CLIB_SCRIPT 3 // TYPES ------------------------------------------------------------------- @@ -124,20 +124,6 @@ void SC_OpenFile(char *name) //========================================================================== // -// SC_OpenFileCLib -// -// Loads a script (from a file) and prepares it for parsing. Uses C -// library function calls for memory allocation and de-allocation. -// -//========================================================================== - -void SC_OpenFileCLib(char *name) -{ - OpenScript(name, FILE_CLIB_SCRIPT); -} - -//========================================================================== -// // OpenScript // //========================================================================== @@ -158,12 +144,6 @@ static void OpenScript(char *name, int type) M_ExtractFileBase(name, ScriptName); ScriptFreeCLib = false; // De-allocate using Z_Free() } - else - { // File script - clib - ScriptSize = M_ReadFileCLib(name, (byte **) & ScriptBuffer); - M_ExtractFileBase(name, ScriptName); - ScriptFreeCLib = true; // De-allocate using free() - } ScriptPtr = ScriptBuffer; ScriptEndPtr = ScriptPtr + ScriptSize; sc_Line = 1; diff --git a/src/hexen/sv_save.c b/src/hexen/sv_save.c index 7a2134f7..132b28c9 100644 --- a/src/hexen/sv_save.c +++ b/src/hexen/sv_save.c @@ -25,6 +25,8 @@ // HEADER FILES ------------------------------------------------------------ #include "h2def.h" +#include "m_misc.h" +#include "i_swap.h" #include "p_local.h" // MACROS ------------------------------------------------------------------ diff --git a/src/hexen/v_video.c b/src/hexen/v_video.c index 8d88c944..11cca066 100644 --- a/src/hexen/v_video.c +++ b/src/hexen/v_video.c @@ -23,6 +23,7 @@ #include "h2def.h" +#include "i_swap.h" #define SC_INDEX 0x3c4 diff --git a/src/hexen/xddefs.h b/src/hexen/xddefs.h index bad776d3..2c7d4690 100644 --- a/src/hexen/xddefs.h +++ b/src/hexen/xddefs.h @@ -129,14 +129,6 @@ typedef struct short offset; } mapseg_t; -enum -{ // bbox coordinates - BOXTOP, - BOXBOTTOM, - BOXLEFT, - BOXRIGHT -}; - #define NF_SUBSECTOR 0x8000 typedef struct { diff --git a/src/m_argv.c b/src/m_argv.c index bcfaa3da..63c86e26 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -60,6 +60,18 @@ int M_CheckParm (char *check) return 0; } +// +// M_ParmExists +// +// Returns true if the given parameter exists in the program's command +// line arguments, false if not. +// + +boolean M_ParmExists(char *check) +{ + return M_CheckParm(check) != 0; +} + #define MAXARGVS 100 static void LoadResponseFile(int argv_index) diff --git a/src/m_argv.h b/src/m_argv.h index 315bb97b..a1881c18 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -40,4 +40,8 @@ int M_CheckParm (char* check); void M_FindResponseFile(void); +// Parameter has been specified? + +boolean M_ParmExists(char *check); + #endif diff --git a/src/tables.h b/src/tables.h index 78057751..544631d5 100644 --- a/src/tables.h +++ b/src/tables.h @@ -64,13 +64,19 @@ extern const fixed_t finetangent[FINEANGLES/2]; // Binary Angle Measument, BAM. -#define ANG1 0x01000000 #define ANG45 0x20000000 #define ANG90 0x40000000 #define ANG180 0x80000000 #define ANG270 0xc0000000 #define ANG_MAX 0xffffffff +#define ANG1 (ANG45 / 45) +#define ANG60 (ANG180 / 3) + +// Heretic code uses this definition as though it represents one +// degree, but it is not! This is actually ~1.40 degrees. + +#define ANG1_X 0x01000000 #define SLOPERANGE 2048 #define SLOPEBITS 11 |