From 8cdc173252c479b8a7448da9ccd48f32eeb0c427 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 17 Sep 2008 19:56:12 +0000 Subject: Remove definitions from heretic/doomdef.h that are in common code. Replace "shareware" variable with gamemode, as in doom code. Merge angle definitions into common code. Subversion-branch: /branches/raven-branch Subversion-revision: 1240 --- src/heretic/am_map.c | 5 ++- src/heretic/ct_chat.c | 1 + src/heretic/d_main.c | 19 ++++++--- src/heretic/d_net.c | 1 + src/heretic/doomdef.h | 102 +++++++------------------------------------------ src/heretic/f_finale.c | 2 +- src/heretic/g_game.c | 1 + src/heretic/m_misc.c | 2 +- src/heretic/mn_menu.c | 5 ++- src/heretic/p_enemy.c | 8 ++-- src/heretic/p_mobj.c | 8 ++-- src/heretic/p_pspr.c | 6 +-- src/heretic/p_switch.c | 2 +- src/heretic/p_user.c | 2 +- src/heretic/r_draw.c | 4 +- src/heretic/r_local.h | 1 - src/heretic/r_main.c | 13 ------- src/heretic/r_things.c | 2 +- src/heretic/sb_bar.c | 8 ++-- 19 files changed, 60 insertions(+), 132 deletions(-) (limited to 'src/heretic') diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c index 9fcc2714..90807644 100644 --- a/src/heretic/am_map.c +++ b/src/heretic/am_map.c @@ -23,11 +23,14 @@ // AM_map.c +#include + #include "doomdef.h" #include "p_local.h" #include "am_map.h" #include "am_data.h" -#include + +#include "doomkeys.h" vertex_t KeyPoints[NUMKEYS]; diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index d83325b4..16635ba2 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -27,6 +27,7 @@ #include #include #include "doomdef.h" +#include "doomkeys.h" #include "p_local.h" #include "s_sound.h" diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 283bd50d..e274044c 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -35,7 +35,8 @@ #include "p_local.h" #include "s_sound.h" -boolean shareware = false; // true if only episode 1 present +GameMission_t gamemission = heretic; +GameMode_t gamemode = indetermined; boolean ExtendedWAD = false; // true if episodes 4 and 5 present boolean nomonsters; // checkparm of -nomonsters @@ -378,7 +379,7 @@ void D_DoAdvanceDemo(void) case 5: pagetic = 200; gamestate = GS_DEMOSCREEN; - if (shareware) + if (gamemode == shareware) { pagename = "ORDER"; } @@ -919,11 +920,17 @@ void D_DoomMain(void) if (W_CheckNumForName("E2M1") == -1) { // Can't find episode 2 maps, must be the shareware WAD - shareware = true; + gamemode = shareware; } - else if (W_CheckNumForName("EXTENDED") != -1) - { // Found extended lump, must be the extended WAD - ExtendedWAD = true; + else + { + gamemode = registered; + + // Is this the extended WAD? + if (W_CheckNumForName("EXTENDED") != -1) + { + ExtendedWAD = true; + } } #ifdef __WATCOMC__ diff --git a/src/heretic/d_net.c b/src/heretic/d_net.c index 50cd7b63..bd94746a 100644 --- a/src/heretic/d_net.c +++ b/src/heretic/d_net.c @@ -25,6 +25,7 @@ // This version has the fixed ticdup code #include "doomdef.h" +#include "doomkeys.h" #define NCMD_EXIT 0x80000000 #define NCMD_RETRANSMIT 0x40000000 diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index 969448c6..bdf78a19 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -53,46 +53,18 @@ // WAD file access #include "w_wad.h" -extern byte *destview, *destscreen; // PC direct to screen pointers +// fixed_t +#include "m_fixed.h" -// -// most key data are simple ascii (uppercased) -// -#define KEY_RIGHTARROW 0xae -#define KEY_LEFTARROW 0xac -#define KEY_UPARROW 0xad -#define KEY_DOWNARROW 0xaf -#define KEY_ESCAPE 27 -#define KEY_ENTER 13 -#define KEY_F1 (0x80+0x3b) -#define KEY_F2 (0x80+0x3c) -#define KEY_F3 (0x80+0x3d) -#define KEY_F4 (0x80+0x3e) -#define KEY_F5 (0x80+0x3f) -#define KEY_F6 (0x80+0x40) -#define KEY_F7 (0x80+0x41) -#define KEY_F8 (0x80+0x42) -#define KEY_F9 (0x80+0x43) -#define KEY_F10 (0x80+0x44) -#define KEY_F11 (0x80+0x57) -#define KEY_F12 (0x80+0x58) - -#define KEY_BACKSPACE 127 -#define KEY_PAUSE 0xff - -#define KEY_EQUALS 0x3d -#define KEY_MINUS 0x2d - -#define KEY_RSHIFT (0x80+0x36) -#define KEY_RCTRL (0x80+0x1d) -#define KEY_RALT (0x80+0x38) - -#define KEY_LALT KEY_RALT - - -#define FINEANGLES 8192 -#define FINEMASK (FINEANGLES-1) -#define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000 +// angle_t +#include "tables.h" + +// events +#include "d_event.h" + +#include "d_mode.h" + +extern byte *destview, *destscreen; // PC direct to screen pointers #define SAVEGAMENAME "hticsav" #define SAVEGAMENAMECD "c:\\heretic.cd\\hticsav" @@ -110,48 +82,6 @@ extern byte *destview, *destscreen; // PC direct to screen pointers #define TICRATE 35 // number of tics / second #define TICSPERSEC 35 -#define FRACBITS 16 -#define FRACUNIT (1< #include #include "doomdef.h" +#include "doomkeys.h" #include "p_local.h" #include "s_sound.h" diff --git a/src/heretic/m_misc.c b/src/heretic/m_misc.c index dd39ec1e..4d9f6b5d 100644 --- a/src/heretic/m_misc.c +++ b/src/heretic/m_misc.c @@ -52,7 +52,7 @@ boolean M_ValidEpisodeMap(int episode, int map) { return false; } - if (shareware) + if (gamemode == shareware) { // Shareware version checks if (episode != 1) { diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 8d828daa..6423ebdf 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -25,6 +25,7 @@ #include #include "doomdef.h" +#include "doomkeys.h" #include "p_local.h" #include "r_local.h" #include "s_sound.h" @@ -882,7 +883,7 @@ static boolean SCSaveGame(int option) static boolean SCEpisode(int option) { - if (shareware && option > 1) + if (gamemode == shareware && option > 1) { P_SetMessage(&players[consoleplayer], "ONLY AVAILABLE IN THE REGISTERED VERSION", true); @@ -1045,7 +1046,7 @@ boolean MN_Responder(event_t * event) key = event->data1; if (InfoType) { - if (shareware) + if (gamemode == shareware) { InfoType = (InfoType + 1) % 5; } diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c index 714ce724..c33f7834 100644 --- a/src/heretic/p_enemy.c +++ b/src/heretic/p_enemy.c @@ -1241,7 +1241,7 @@ void A_MummyAttack2(mobj_t * actor) void A_MummyFX1Seek(mobj_t * actor) { - P_SeekerMissile(actor, ANGLE_1 * 10, ANGLE_1 * 20); + P_SeekerMissile(actor, ANG1 * 10, ANG1 * 20); } //---------------------------------------------------------------------------- @@ -1322,8 +1322,8 @@ void A_Srcr1Attack(mobj_t * actor) { momz = mo->momz; angle = mo->angle; - P_SpawnMissileAngle(actor, MT_SRCRFX1, angle - ANGLE_1 * 3, momz); - P_SpawnMissileAngle(actor, MT_SRCRFX1, angle + ANGLE_1 * 3, momz); + P_SpawnMissileAngle(actor, MT_SRCRFX1, angle - ANG1 * 3, momz); + P_SpawnMissileAngle(actor, MT_SRCRFX1, angle + ANG1 * 3, momz); } if (actor->health < actor->info->spawnhealth / 3) { // Maybe attack again @@ -1888,7 +1888,7 @@ void A_WhirlwindSeek(mobj_t * actor) { return; } - P_SeekerMissile(actor, ANGLE_1 * 10, ANGLE_1 * 30); + P_SeekerMissile(actor, ANG1 * 10, ANG1 * 30); } //---------------------------------------------------------------------------- diff --git a/src/heretic/p_mobj.c b/src/heretic/p_mobj.c index 839e9744..15a39773 100644 --- a/src/heretic/p_mobj.c +++ b/src/heretic/p_mobj.c @@ -180,7 +180,7 @@ 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; return (0); @@ -194,7 +194,7 @@ 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; return (1); @@ -1129,13 +1129,13 @@ void P_SpawnMapThing(mapthing_t * mthing) case MT_ARTISUPERHEAL: case MT_ARTITELEPORT: case MT_ITEMSHIELD2: - if (shareware) + if (gamemode == shareware) { // Don't place on map in shareware version return; } break; case MT_WMACE: - if (!shareware) + if (gamemode != shareware) { // Put in the mace spot list P_AddMaceSpot(mthing); return; diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c index 79976b5c..7ded5b26 100644 --- a/src/heretic/p_pspr.c +++ b/src/heretic/p_pspr.c @@ -1298,7 +1298,7 @@ void A_DeathBallImpact(mobj_t * ball) newAngle = true; break; } - angle += ANGLE_45 / 2; + angle += ANG45 / 2; } } if (newAngle) @@ -1463,7 +1463,7 @@ void A_FireSkullRodPL2(player_t * player, pspdef_t * psp) void A_SkullRodPL2Seek(mobj_t * actor) { - P_SeekerMissile(actor, ANGLE_1 * 10, ANGLE_1 * 30); + P_SeekerMissile(actor, ANG1 * 10, ANG1 * 30); } //---------------------------------------------------------------------------- @@ -1632,7 +1632,7 @@ void A_PhoenixPuff(mobj_t * actor) mobj_t *puff; angle_t angle; - P_SeekerMissile(actor, ANGLE_1 * 5, ANGLE_1 * 10); + P_SeekerMissile(actor, ANG1 * 5, ANG1 * 10); puff = P_SpawnMobj(actor->x, actor->y, actor->z, MT_PHOENIXPUFF); angle = actor->angle + ANG90; angle >>= ANGLETOFINESHIFT; diff --git a/src/heretic/p_switch.c b/src/heretic/p_switch.c index 29b057e7..7c4f8c02 100644 --- a/src/heretic/p_switch.c +++ b/src/heretic/p_switch.c @@ -111,7 +111,7 @@ void P_InitSwitchList(void) int episode; episode = 1; - if (!shareware) + if (gamemode != shareware) episode = 2; for (index = 0, i = 0; i < MAXSWITCHES; i++) diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c index 67ae00d7..3c880b88 100644 --- a/src/heretic/p_user.c +++ b/src/heretic/p_user.c @@ -620,7 +620,7 @@ void P_PlayerThink(player_t * player) if (player->weaponowned[newweapon] && newweapon != player->readyweapon) { - if (WeaponInShareware[newweapon] || !shareware) + if (WeaponInShareware[newweapon] || gamemode != shareware) { player->pendingweapon = newweapon; } diff --git a/src/heretic/r_draw.c b/src/heretic/r_draw.c index f955b127..aac9e88d 100644 --- a/src/heretic/r_draw.c +++ b/src/heretic/r_draw.c @@ -425,7 +425,7 @@ void R_DrawViewBorder(void) if (scaledviewwidth == SCREENWIDTH) return; - if (shareware) + if (gamemode == shareware) { src = W_CacheLumpName("FLOOR04", PU_CACHE); } @@ -489,7 +489,7 @@ void R_DrawTopBorder(void) if (scaledviewwidth == SCREENWIDTH) return; - if (shareware) + if (gamemode == shareware) { src = W_CacheLumpName("FLOOR04", PU_CACHE); } diff --git a/src/heretic/r_local.h b/src/heretic/r_local.h index 38945bad..fa0efacd 100644 --- a/src/heretic/r_local.h +++ b/src/heretic/r_local.h @@ -269,7 +269,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/heretic/r_main.c b/src/heretic/r_main.c index 7628e595..7137615a 100644 --- a/src/heretic/r_main.c +++ b/src/heretic/r_main.c @@ -70,14 +70,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]; @@ -222,11 +214,6 @@ int R_PointOnSegSide(fixed_t x, fixed_t y, seg_t * line) #define SLOPEBITS 11 #define DBITS (FRACBITS-SLOPEBITS) - -extern int tantoangle[SLOPERANGE + 1]; // get from tables.c - -// int tantoangle[SLOPERANGE+1]; - int SlopeDiv(unsigned num, unsigned den) { unsigned ans; diff --git a/src/heretic/r_things.c b/src/heretic/r_things.c index de51504b..1c7f1889 100644 --- a/src/heretic/r_things.c +++ b/src/heretic/r_things.c @@ -203,7 +203,7 @@ void R_InitSpriteDefs(char **namelist) { //continue; sprites[i].numframes = 0; - if (shareware) + if (gamemode == shareware) continue; I_Error("R_InitSprites: No lumps found for sprite %s", namelist[i]); diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 6414bb8f..3b6434b3 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -1275,7 +1275,7 @@ static void CheatWeaponsFunc(player_t * player, Cheat_t * cheat) { player->weaponowned[i] = true; } - if (shareware) + if (gamemode == shareware) { player->weaponowned[wp_skullrod] = false; player->weaponowned[wp_phoenixrod] = false; @@ -1377,7 +1377,8 @@ static void CheatArtifact3Func(player_t * player, Cheat_t * cheat) { // All artifacts for (i = arti_none + 1; i < NUMARTIFACTS; i++) { - if (shareware && (i == arti_superhealth || i == arti_teleport)) + if (gamemode == shareware + && (i == arti_superhealth || i == arti_teleport)) { continue; } @@ -1391,7 +1392,8 @@ static void CheatArtifact3Func(player_t * player, Cheat_t * cheat) else if (type > arti_none && type < NUMARTIFACTS && count > 0 && count < 10) { - if (shareware && (type == arti_superhealth || type == arti_teleport)) + if (gamemode == shareware + && (type == arti_superhealth || type == arti_teleport)) { P_SetMessage(player, TXT_CHEATARTIFACTSFAIL, false); return; -- cgit v1.2.3