From 7eb158bf7216a063f54df0dec9954a29b95a5ec0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 20 Jul 2020 23:21:27 +0200 Subject: [PATCH] - properly tabified everything. --- source/games/duke/src/2d_d.cpp | 100 +- source/games/duke/src/actors.cpp | 4 +- source/games/duke/src/actors_r.cpp | 10 +- source/games/duke/src/ccmds.cpp | 354 ++-- source/games/duke/src/constants.h | 404 ++-- source/games/duke/src/d_menu.cpp | 4 +- source/games/duke/src/dispatch.cpp | 72 +- source/games/duke/src/duke3d.h | 40 +- source/games/duke/src/flags_d.cpp | 440 ++-- source/games/duke/src/flags_r.cpp | 94 +- source/games/duke/src/game.cpp | 258 +-- source/games/duke/src/game_misc.cpp | 8 +- source/games/duke/src/gameexec.cpp | 34 +- source/games/duke/src/inlines.h | 120 +- source/games/duke/src/interpolate.cpp | 64 +- source/games/duke/src/names.h | 64 +- source/games/duke/src/noise.cpp | 36 +- source/games/duke/src/player_r.cpp | 198 +- source/games/duke/src/prediction.cpp | 762 +++---- source/games/duke/src/premap_d.cpp | 736 +++---- source/games/duke/src/premap_r.cpp | 1340 ++++++------ source/games/duke/src/savegame.cpp | 852 ++++---- source/games/duke/src/sbar.h | 22 +- source/games/duke/src/sbar_d.cpp | 534 ++--- source/games/duke/src/sbar_r.cpp | 562 ++--- source/games/duke/src/sounds.cpp | 4 +- source/games/duke/src/sounds.h | 36 +- source/games/duke/src/spawn_r.cpp | 2724 ++++++++++++------------- source/games/duke/src/types.h | 306 +-- 29 files changed, 5091 insertions(+), 5091 deletions(-) diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index e51e24c3e..ba0d0e467 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -52,73 +52,73 @@ BEGIN_DUKE_NS void InitFonts_d() { - GlyphSet fontdata; + GlyphSet fontdata; - // Small font - for (int i = 0; i < 95; i++) - { - auto tile = tileGetTexture(STARTALPHANUM + i); + // Small font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(STARTALPHANUM + i); if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) { fontdata.Insert('!' + i, tile); tile->SetOffsetsNotForFont(); } - } - SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); - fontdata.Clear(); + } + SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); + fontdata.Clear(); - // Big font + // Big font - // This font is VERY messy... - fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11)); - fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11)); - for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i)); - for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i)); - fontdata.Insert('.', tileGetTexture(BIGPERIOD)); - fontdata.Insert(',', tileGetTexture(BIGCOMMA)); - fontdata.Insert('!', tileGetTexture(BIGX)); - fontdata.Insert('?', tileGetTexture(BIGQ)); - fontdata.Insert(';', tileGetTexture(BIGSEMI)); - fontdata.Insert(':', tileGetTexture(BIGCOLIN)); - fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68)); - fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68)); - fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69)); - fontdata.Insert('`', tileGetTexture(BIGAPPOS)); - fontdata.Insert('"', tileGetTexture(BIGAPPOS)); - fontdata.Insert('\'', tileGetTexture(BIGAPPOS)); + // This font is VERY messy... + fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11)); + fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11)); + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i)); + for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i)); + fontdata.Insert('.', tileGetTexture(BIGPERIOD)); + fontdata.Insert(',', tileGetTexture(BIGCOMMA)); + fontdata.Insert('!', tileGetTexture(BIGX)); + fontdata.Insert('?', tileGetTexture(BIGQ)); + fontdata.Insert(';', tileGetTexture(BIGSEMI)); + fontdata.Insert(':', tileGetTexture(BIGCOLIN)); + fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68)); + fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69)); + fontdata.Insert('`', tileGetTexture(BIGAPPOS)); + fontdata.Insert('"', tileGetTexture(BIGAPPOS)); + fontdata.Insert('\'', tileGetTexture(BIGAPPOS)); // The texture offsets in this font are useless for font printing. This should only apply to these glyphs, not for international extensions, though. GlyphSet::Iterator it(fontdata); GlyphSet::Pair* pair; while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont(); - BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); - fontdata.Clear(); + BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); + fontdata.Clear(); - // Tiny font - for (int i = 0; i < 95; i++) - { - auto tile = tileGetTexture(MINIFONT + i); - if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) - fontdata.Insert('!' + i, tile); - } - fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. - SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 3, false, false, false, &fontdata); + // Tiny font + for (int i = 0; i < 95; i++) + { + auto tile = tileGetTexture(MINIFONT + i); + if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) + fontdata.Insert('!' + i, tile); + } + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 3, false, false, false, &fontdata); SmallFont2->SetKerning(1); fontdata.Clear(); - // SBAR index font - for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); - fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); - fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); - fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); - fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. - IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + // SBAR index font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); + fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); + fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); + fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); - fontdata.Clear(); + fontdata.Clear(); - // digital font - for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); - fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. - DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); + // digital font + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); + fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. + DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); } @@ -1064,7 +1064,7 @@ public: void PrintPaused_d() { - BigText(160, 100, GStrings("Game Paused")); + BigText(160, 100, GStrings("Game Paused")); } void PrintLevelName_d(double alpha) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index c0986b96b..14a8231ee 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -58,8 +58,8 @@ int adjustfall(spritetype* s, int c); void RANDOMSCRAP(spritetype *s, int i) { - int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); - int v = isRR() ? 16 : 48; + int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); + int v = isRR() ? 16 : 48; EGS(s->sectnum, s->x + (r7 & 255) - 128, s->y + (r6 & 255) - 128, s->z - (8 << 8) - (r5 & 8191), TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), i, 5); } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 57feaac4f..c0d79ec8f 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -186,7 +186,7 @@ void addweapon_r(struct player_struct* p, int weapon) case SLINGBLADE_WEAPON: if (!isRRRA()) break; case KNEE_WEAPON: - case DYNAMITE_WEAPON: + case DYNAMITE_WEAPON: case TRIPBOMB_WEAPON: case THROWINGDYNAMITE_WEAPON: break; @@ -4050,10 +4050,10 @@ void moveeffectors_r(void) //STATNUM 3 int adjustfall(spritetype *s, int c) { - if ((s->picnum == BIKERB || s->picnum == CHEERB) && c == gc) - c = gc>>2; - else if (s->picnum == BIKERBV2 && c == gc) - c = gc>>3; + if ((s->picnum == BIKERB || s->picnum == CHEERB) && c == gc) + c = gc>>2; + else if (s->picnum == BIKERBV2 && c == gc) + c = gc>>3; return c; } diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 54746f534..2ea58ef3f 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -46,229 +46,229 @@ bool cheatInventory(cheatseq_t* s); static void dowarp(MapRecord *map) { - ud.m_monsters_off = ud.monsters_off = 0; + ud.m_monsters_off = ud.monsters_off = 0; - ud.m_respawn_items = 0; - ud.m_respawn_inventory = 0; + ud.m_respawn_items = 0; + ud.m_respawn_inventory = 0; - ud.multimode = 1; + ud.multimode = 1; - if (ps[myconnectindex].gm & MODE_GAME) - { - ready2send = 0; - donewgame(map, ud.m_player_skill); - ps[myconnectindex].gm = MODE_RESTART; - } - else startnewgame(map, ud.m_player_skill); + if (ps[myconnectindex].gm & MODE_GAME) + { + ready2send = 0; + donewgame(map, ud.m_player_skill); + ps[myconnectindex].gm = MODE_RESTART; + } + else startnewgame(map, ud.m_player_skill); } static int ccmd_levelwarp(CCmdFuncPtr parm) { - if (parm->numparms != 2) - return CCMD_SHOWHELP; - int e = atoi(parm->parms[0]); - int m = atoi(parm->parms[1]); - if (e == 0 || m == 0) - { - Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]); - return CCMD_OK; - } - auto map = FindMapByLevelNum(levelnum(e - 1, m - 1)); - if (!map) - { - Printf(TEXTCOLOR_RED "Level not found!: E%sL%s\n", parm->parms[0], parm->parms[1]); - return CCMD_OK; - } - dowarp(map); + if (parm->numparms != 2) + return CCMD_SHOWHELP; + int e = atoi(parm->parms[0]); + int m = atoi(parm->parms[1]); + if (e == 0 || m == 0) + { + Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]); + return CCMD_OK; + } + auto map = FindMapByLevelNum(levelnum(e - 1, m - 1)); + if (!map) + { + Printf(TEXTCOLOR_RED "Level not found!: E%sL%s\n", parm->parms[0], parm->parms[1]); + return CCMD_OK; + } + dowarp(map); - return CCMD_OK; + return CCMD_OK; } static int ccmd_map(CCmdFuncPtr parm) { - if (parm->numparms != 1) - { - return CCMD_SHOWHELP; - } - FString mapname = parm->parms[0]; + if (parm->numparms != 1) + { + return CCMD_SHOWHELP; + } + FString mapname = parm->parms[0]; - if (!fileSystem.Lookup(mapname, "MAP")) - { - Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); - return CCMD_OK; - } + if (!fileSystem.Lookup(mapname, "MAP")) + { + Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); + return CCMD_OK; + } // Check if the map is already defined. - auto map = FindMapByName(mapname); - if (map == nullptr) - { - // got a user map - if (VOLUMEONE) - { - Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n"); - return CCMD_OK; - } - DefaultExtension(mapname, ".map"); - if (mapname[0] != '/') mapname.Insert(0, "/"); - map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr); - } - if (numplayers > 1) - { - return CCMD_OK; - } + auto map = FindMapByName(mapname); + if (map == nullptr) + { + // got a user map + if (VOLUMEONE) + { + Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n"); + return CCMD_OK; + } + DefaultExtension(mapname, ".map"); + if (mapname[0] != '/') mapname.Insert(0, "/"); + map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr); + } + if (numplayers > 1) + { + return CCMD_OK; + } - dowarp(map); - return CCMD_OK; + dowarp(map); + return CCMD_OK; } static int ccmd_activatecheat(CCmdFuncPtr parm) { - if (parm->numparms != 1) - return CCMD_SHOWHELP; + if (parm->numparms != 1) + return CCMD_SHOWHELP; - PlaybackCheat(parm->parms[0]); - return CCMD_OK; + PlaybackCheat(parm->parms[0]); + return CCMD_OK; } static int ccmd_god(CCmdFuncPtr) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) - cheatGod(nullptr); - else - Printf("god: Not in a single-player game.\n"); + if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + cheatGod(nullptr); + else + Printf("god: Not in a single-player game.\n"); - return CCMD_OK; + return CCMD_OK; } static int ccmd_noclip(CCmdFuncPtr) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) - { - cheatClip(nullptr); - } - else - { - Printf("noclip: Not in a single-player game.\n"); - } + if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + { + cheatClip(nullptr); + } + else + { + Printf("noclip: Not in a single-player game.\n"); + } - return CCMD_OK; + return CCMD_OK; } static int ccmd_restartmap(CCmdFuncPtr) { - if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1) - ps[myconnectindex].gm = MODE_RESTART; + if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1) + ps[myconnectindex].gm = MODE_RESTART; - return CCMD_OK; + return CCMD_OK; } int getlabelvalue(const char* text); static int ccmd_spawn(CCmdFuncPtr parm) { - int x = 0, y = 0, z = 0; - unsigned int cstat = 0, picnum = 0; - unsigned int pal = 0; - int ang = 0; - int set = 0, idx; + int x = 0, y = 0, z = 0; + unsigned int cstat = 0, picnum = 0; + unsigned int pal = 0; + int ang = 0; + int set = 0, idx; - if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) { - Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); - return CCMD_OK; - } + if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) { + Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); + return CCMD_OK; + } - switch (parm->numparms) { - case 7: // x,y,z - x = atol(parm->parms[4]); - y = atol(parm->parms[5]); - z = atol(parm->parms[6]); - set |= 8; - case 4: // ang - ang = atol(parm->parms[3]) & 2047; set |= 4; - case 3: // cstat - cstat = (unsigned short)atol(parm->parms[2]); set |= 2; - case 2: // pal - pal = (unsigned char)atol(parm->parms[1]); set |= 1; - case 1: // tile number - if (isdigit(parm->parms[0][0])) { - picnum = (unsigned short)atol(parm->parms[0]); - } - else { - picnum = getlabelvalue(parm->parms[0]); - if (picnum < 0) { - Printf("spawn: Invalid tile label given\n"); - return CCMD_OK; - } - } + switch (parm->numparms) { + case 7: // x,y,z + x = atol(parm->parms[4]); + y = atol(parm->parms[5]); + z = atol(parm->parms[6]); + set |= 8; + case 4: // ang + ang = atol(parm->parms[3]) & 2047; set |= 4; + case 3: // cstat + cstat = (unsigned short)atol(parm->parms[2]); set |= 2; + case 2: // pal + pal = (unsigned char)atol(parm->parms[1]); set |= 1; + case 1: // tile number + if (isdigit(parm->parms[0][0])) { + picnum = (unsigned short)atol(parm->parms[0]); + } + else { + picnum = getlabelvalue(parm->parms[0]); + if (picnum < 0) { + Printf("spawn: Invalid tile label given\n"); + return CCMD_OK; + } + } - if (picnum >= MAXTILES) { - Printf("spawn: Invalid tile number\n"); - return CCMD_OK; - } - break; - default: - return CCMD_SHOWHELP; - } + if (picnum >= MAXTILES) { + Printf("spawn: Invalid tile number\n"); + return CCMD_OK; + } + break; + default: + return CCMD_SHOWHELP; + } - idx = fi.spawn(ps[myconnectindex].i, (short)picnum); - if (set & 1) sprite[idx].pal = (char)pal; - if (set & 2) sprite[idx].cstat = (short)cstat; - if (set & 4) sprite[idx].ang = ang; - if (set & 8) { - if (setsprite(idx, x, y, z) < 0) { - Printf("spawn: Sprite can't be spawned into null space\n"); - deletesprite(idx); - } - } + idx = fi.spawn(ps[myconnectindex].i, (short)picnum); + if (set & 1) sprite[idx].pal = (char)pal; + if (set & 2) sprite[idx].cstat = (short)cstat; + if (set & 4) sprite[idx].ang = ang; + if (set & 8) { + if (setsprite(idx, x, y, z) < 0) { + Printf("spawn: Sprite can't be spawned into null space\n"); + deletesprite(idx); + } + } - return CCMD_OK; + return CCMD_OK; } // Strangely enough JFDuke does not have a 'give' CCMD, so this is based on the version in EDuke32. static int ccmd_give(CCmdFuncPtr parm) { - if (numplayers != 1 || (ps[myconnectindex].gm & MODE_GAME) == 0 || - ps[myconnectindex].dead_flag != 0) - { - Printf("give: Cannot give while dead or not in a single-player game.\n"); - return CCMD_OK; - } + if (numplayers != 1 || (ps[myconnectindex].gm & MODE_GAME) == 0 || + ps[myconnectindex].dead_flag != 0) + { + Printf("give: Cannot give while dead or not in a single-player game.\n"); + return CCMD_OK; + } - if (parm->numparms != 1) return CCMD_SHOWHELP; + if (parm->numparms != 1) return CCMD_SHOWHELP; - cheatseq_t* cs = (cheatseq_t*)(intptr_t)1; - if (!stricmp(parm->parms[0], "all")) - { - cheatStuff(cs); - } - else if (!stricmp(parm->parms[0], "health")) - { - sprite[ps[myconnectindex].i].extra = max_player_health<<1; - } - else if (!stricmp(parm->parms[0], "weapons")) - { - cheatWeapons(cs); - } - else if (!stricmp(parm->parms[0], "ammo")) - { - int maxw = VOLUMEONE ? SHRINKER_WEAPON : MAX_WEAPONS; - for (int i = maxw; i >= PISTOL_WEAPON; i--) - addammo(i, &ps[myconnectindex], max_ammo_amount[i]); - } - else if (!stricmp(parm->parms[0], "armor")) - { - ps[myconnectindex].shield_amount = 100; - } - else if (!stricmp(parm->parms[0], "keys")) - { - cheatKeys(cs); - } - else if (!stricmp(parm->parms[0], "inventory")) - { - cheatInventory(cs); - } - else return CCMD_SHOWHELP; - return CCMD_OK; + cheatseq_t* cs = (cheatseq_t*)(intptr_t)1; + if (!stricmp(parm->parms[0], "all")) + { + cheatStuff(cs); + } + else if (!stricmp(parm->parms[0], "health")) + { + sprite[ps[myconnectindex].i].extra = max_player_health<<1; + } + else if (!stricmp(parm->parms[0], "weapons")) + { + cheatWeapons(cs); + } + else if (!stricmp(parm->parms[0], "ammo")) + { + int maxw = VOLUMEONE ? SHRINKER_WEAPON : MAX_WEAPONS; + for (int i = maxw; i >= PISTOL_WEAPON; i--) + addammo(i, &ps[myconnectindex], max_ammo_amount[i]); + } + else if (!stricmp(parm->parms[0], "armor")) + { + ps[myconnectindex].shield_amount = 100; + } + else if (!stricmp(parm->parms[0], "keys")) + { + cheatKeys(cs); + } + else if (!stricmp(parm->parms[0], "inventory")) + { + cheatInventory(cs); + } + else return CCMD_SHOWHELP; + return CCMD_OK; } @@ -276,18 +276,18 @@ static int ccmd_give(CCmdFuncPtr parm) int registerosdcommands(void) { C_RegisterFunction("map","map : warp to the given map, identified by its name", ccmd_map); - C_RegisterFunction("levelwarp","levelwarp : warp to episode 'e' and map 'm'", ccmd_levelwarp); + C_RegisterFunction("levelwarp","levelwarp : warp to episode 'e' and map 'm'", ccmd_levelwarp); - C_RegisterFunction("give","give : gives requested item", ccmd_give); - C_RegisterFunction("god","god: toggles god mode", ccmd_god); - C_RegisterFunction("activatecheat","activatecheat : activates a cheat code", ccmd_activatecheat); + C_RegisterFunction("give","give : gives requested item", ccmd_give); + C_RegisterFunction("god","god: toggles god mode", ccmd_god); + C_RegisterFunction("activatecheat","activatecheat : activates a cheat code", ccmd_activatecheat); - C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip); - C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap); + C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip); + C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap); - C_RegisterFunction("spawn","spawn [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); + C_RegisterFunction("spawn","spawn [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); - return 0; + return 0; } END_DUKE_NS diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index eaf0d43e5..7e07cb55f 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -43,9 +43,9 @@ enum GameFunction_t enum { - TICRATE = 120, - REALGAMETICSPERSEC = 30, // The number of game state updates per second: - TICSPERFRAME = (TICRATE/REALGAMETICSPERSEC) // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division.) + TICRATE = 120, + REALGAMETICSPERSEC = 30, // The number of game state updates per second: + TICSPERFRAME = (TICRATE/REALGAMETICSPERSEC) // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division.) }; // tile names which are identical for all games. @@ -63,172 +63,172 @@ enum GPSPEED = 10, FOF = 13, - TILE_VIEWSCR = (MAXTILES-5) + TILE_VIEWSCR = (MAXTILES-5) }; // the available palettes. These are indices into the global table of translations. enum basepal_t { - BASEPAL = 0, - WATERPAL, - SLIMEPAL, - TITLEPAL, - DREALMSPAL, - ENDINGPAL, // 5 - ANIMPAL, // not used anymore. The anim code now generates true color textures. - DRUGPAL, - BASEPALCOUNT + BASEPAL = 0, + WATERPAL, + SLIMEPAL, + TITLEPAL, + DREALMSPAL, + ENDINGPAL, // 5 + ANIMPAL, // not used anymore. The anim code now generates true color textures. + DRUGPAL, + BASEPALCOUNT }; // sector effector lotags, from EDuke32. The original code used numeric literals for these, substitution is not complete. enum { - SE_0_ROTATING_SECTOR = 0, - SE_1_PIVOT = 1, - SE_2_EARTHQUAKE = 2, - SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3, - SE_4_RANDOM_LIGHTS = 4, - SE_5_BOSS = 5, - SE_6_SUBWAY = 6, + SE_0_ROTATING_SECTOR = 0, + SE_1_PIVOT = 1, + SE_2_EARTHQUAKE = 2, + SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3, + SE_4_RANDOM_LIGHTS = 4, + SE_5_BOSS = 5, + SE_6_SUBWAY = 6, - SE_7_TELEPORT = 7, - SE_8_UP_OPEN_DOOR_LIGHTS = 8, - SE_9_DOWN_OPEN_DOOR_LIGHTS = 9, - SE_10_DOOR_AUTO_CLOSE = 10, - SE_11_SWINGING_DOOR = 11, - SE_12_LIGHT_SWITCH = 12, - SE_13_EXPLOSIVE = 13, - SE_14_SUBWAY_CAR = 14, - SE_15_SLIDING_DOOR = 15, - SE_16_REACTOR = 16, - SE_17_WARP_ELEVATOR = 17, - SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18, - SE_19_EXPLOSION_LOWERS_CEILING = 19, - SE_20_STRETCH_BRIDGE = 20, - SE_21_DROP_FLOOR = 21, - SE_22_TEETH_DOOR = 22, - SE_23_ONE_WAY_TELEPORT = 23, - SE_24_CONVEYOR = 24, - SE_25_PISTON = 25, - SE_26 = 26, - SE_27_DEMO_CAM = 27, - SE_28_LIGHTNING = 28, - SE_29_WAVES = 29, - SE_30_TWO_WAY_TRAIN = 30, - SE_31_FLOOR_RISE_FALL = 31, - SE_32_CEILING_RISE_FALL = 32, - SE_33_QUAKE_DEBRIS = 33, - SE_34 = 34, - SE_35 = 35, - SE_36_PROJ_SHOOTER = 36, - SE_47_LIGHT_SWITCH = 47, - SE_48_LIGHT_SWITCH = 48, - SE_49_POINT_LIGHT = 49, - SE_50_SPOT_LIGHT = 50, - SE_130 = 130, - SE_131 = 131, + SE_7_TELEPORT = 7, + SE_8_UP_OPEN_DOOR_LIGHTS = 8, + SE_9_DOWN_OPEN_DOOR_LIGHTS = 9, + SE_10_DOOR_AUTO_CLOSE = 10, + SE_11_SWINGING_DOOR = 11, + SE_12_LIGHT_SWITCH = 12, + SE_13_EXPLOSIVE = 13, + SE_14_SUBWAY_CAR = 14, + SE_15_SLIDING_DOOR = 15, + SE_16_REACTOR = 16, + SE_17_WARP_ELEVATOR = 17, + SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18, + SE_19_EXPLOSION_LOWERS_CEILING = 19, + SE_20_STRETCH_BRIDGE = 20, + SE_21_DROP_FLOOR = 21, + SE_22_TEETH_DOOR = 22, + SE_23_ONE_WAY_TELEPORT = 23, + SE_24_CONVEYOR = 24, + SE_25_PISTON = 25, + SE_26 = 26, + SE_27_DEMO_CAM = 27, + SE_28_LIGHTNING = 28, + SE_29_WAVES = 29, + SE_30_TWO_WAY_TRAIN = 30, + SE_31_FLOOR_RISE_FALL = 31, + SE_32_CEILING_RISE_FALL = 32, + SE_33_QUAKE_DEBRIS = 33, + SE_34 = 34, + SE_35 = 35, + SE_36_PROJ_SHOOTER = 36, + SE_47_LIGHT_SWITCH = 47, + SE_48_LIGHT_SWITCH = 48, + SE_49_POINT_LIGHT = 49, + SE_50_SPOT_LIGHT = 50, + SE_130 = 130, + SE_131 = 131, }; // sector lotags, also from EDuke32, for the same reason as above. enum { - ST_0_NO_EFFECT = 0, - ST_1_ABOVE_WATER = 1, - ST_2_UNDERWATER = 2, - ST_3 = 3, - // ^^^ maybe not complete substitution in code - ST_9_SLIDING_ST_DOOR = 9, - ST_15_WARP_ELEVATOR = 15, - ST_16_PLATFORM_DOWN = 16, - ST_17_PLATFORM_UP = 17, - ST_18_ELEVATOR_DOWN = 18, - ST_19_ELEVATOR_UP = 19, - ST_20_CEILING_DOOR = 20, - ST_21_FLOOR_DOOR = 21, - ST_22_SPLITTING_DOOR = 22, - ST_23_SWINGING_DOOR = 23, - ST_25_SLIDING_DOOR = 25, - ST_26_SPLITTING_ST_DOOR = 26, - ST_27_STRETCH_BRIDGE = 27, - ST_28_DROP_FLOOR = 28, - ST_29_TEETH_DOOR = 29, - ST_30_ROTATE_RISE_BRIDGE = 30, - ST_31_TWO_WAY_TRAIN = 31, - // left: ST 32767, 65534, 65535 + ST_0_NO_EFFECT = 0, + ST_1_ABOVE_WATER = 1, + ST_2_UNDERWATER = 2, + ST_3 = 3, + // ^^^ maybe not complete substitution in code + ST_9_SLIDING_ST_DOOR = 9, + ST_15_WARP_ELEVATOR = 15, + ST_16_PLATFORM_DOWN = 16, + ST_17_PLATFORM_UP = 17, + ST_18_ELEVATOR_DOWN = 18, + ST_19_ELEVATOR_UP = 19, + ST_20_CEILING_DOOR = 20, + ST_21_FLOOR_DOOR = 21, + ST_22_SPLITTING_DOOR = 22, + ST_23_SWINGING_DOOR = 23, + ST_25_SLIDING_DOOR = 25, + ST_26_SPLITTING_ST_DOOR = 26, + ST_27_STRETCH_BRIDGE = 27, + ST_28_DROP_FLOOR = 28, + ST_29_TEETH_DOOR = 29, + ST_30_ROTATE_RISE_BRIDGE = 30, + ST_31_TWO_WAY_TRAIN = 31, + // left: ST 32767, 65534, 65535 }; // These actually existed in the original source but were never used. Weird. enum dukeinv_t { - GET_STEROIDS, // 0 - GET_SHIELD, - GET_SCUBA, - GET_HOLODUKE, - GET_JETPACK, - GET_DUMMY1, // 5 - GET_ACCESS, - GET_HEATS, - GET_DUMMY2, - GET_FIRSTAID, - GET_BOOTS, // 10 - GET_MAX + GET_STEROIDS, // 0 + GET_SHIELD, + GET_SCUBA, + GET_HOLODUKE, + GET_JETPACK, + GET_DUMMY1, // 5 + GET_ACCESS, + GET_HEATS, + GET_DUMMY2, + GET_FIRSTAID, + GET_BOOTS, // 10 + GET_MAX }; // Again from EDuke - only numeric literals were used in the original source. // these are not in the same order as the above, and it can't be changed for compat reasons. lame! enum dukeinvicon_t { - ICON_NONE, // 0 - ICON_FIRSTAID, - ICON_STEROIDS, - ICON_HOLODUKE, - ICON_JETPACK, - ICON_HEATS, // 5 - ICON_SCUBA, - ICON_BOOTS, - ICON_MAX + ICON_NONE, // 0 + ICON_FIRSTAID, + ICON_STEROIDS, + ICON_HOLODUKE, + ICON_JETPACK, + ICON_HEATS, // 5 + ICON_SCUBA, + ICON_BOOTS, + ICON_MAX }; enum ESyncBits_ : uint32_t { - SKB_JUMP = 1 << 0, - SKB_CROUCH = 1 << 1, - SKB_FIRE = 1 << 2, - SKB_AIM_UP = 1 << 3, - SKB_AIM_DOWN = 1 << 4, - SKB_RUN = 1 << 5, - SKB_LOOK_LEFT = 1 << 6, - SKB_LOOK_RIGHT = 1 << 7, + SKB_JUMP = 1 << 0, + SKB_CROUCH = 1 << 1, + SKB_FIRE = 1 << 2, + SKB_AIM_UP = 1 << 3, + SKB_AIM_DOWN = 1 << 4, + SKB_RUN = 1 << 5, + SKB_LOOK_LEFT = 1 << 6, + SKB_LOOK_RIGHT = 1 << 7, SKB_FIRST_WEAPON_BIT = 1 << 8, - SKB_STEROIDS = 1 << 12, - SKB_LOOK_UP = 1 << 13, - SKB_LOOK_DOWN = 1 << 14, - SKB_NIGHTVISION = 1 << 15, - SKB_MEDKIT = 1 << 16, - SKB_MULTIFLAG = 1 << 17, - SKB_CENTER_VIEW = 1 << 18, - SKB_HOLSTER = 1 << 19, - SKB_INV_LEFT = 1 << 20, - SKB_PAUSE = 1 << 21, - SKB_QUICK_KICK = 1 << 22, - SKB_AIMMODE = 1 << 23, - SKB_HOLODUKE = 1 << 24, - SKB_JETPACK = 1 << 25, - SKB_GAMEQUIT = 1 << 26, - SKB_INV_RIGHT = 1 << 27, - SKB_TURNAROUND = 1 << 28, - SKB_OPEN = 1 << 29, - SKB_INVENTORY = 1 << 30, - SKB_ESCAPE = 1u << 31, + SKB_STEROIDS = 1 << 12, + SKB_LOOK_UP = 1 << 13, + SKB_LOOK_DOWN = 1 << 14, + SKB_NIGHTVISION = 1 << 15, + SKB_MEDKIT = 1 << 16, + SKB_MULTIFLAG = 1 << 17, + SKB_CENTER_VIEW = 1 << 18, + SKB_HOLSTER = 1 << 19, + SKB_INV_LEFT = 1 << 20, + SKB_PAUSE = 1 << 21, + SKB_QUICK_KICK = 1 << 22, + SKB_AIMMODE = 1 << 23, + SKB_HOLODUKE = 1 << 24, + SKB_JETPACK = 1 << 25, + SKB_GAMEQUIT = 1 << 26, + SKB_INV_RIGHT = 1 << 27, + SKB_TURNAROUND = 1 << 28, + SKB_OPEN = 1 << 29, + SKB_INVENTORY = 1 << 30, + SKB_ESCAPE = 1u << 31, - SKB_WEAPONMASK_BITS = (15u * SKB_FIRST_WEAPON_BIT), - SKB_INTERFACE_BITS = (SKB_WEAPONMASK_BITS | SKB_STEROIDS | SKB_NIGHTVISION | SKB_MEDKIT | SKB_QUICK_KICK | \ - SKB_HOLSTER | SKB_INV_LEFT | SKB_PAUSE | SKB_HOLODUKE | SKB_JETPACK | SKB_INV_RIGHT | \ - SKB_TURNAROUND | SKB_OPEN | SKB_INVENTORY | SKB_ESCAPE), + SKB_WEAPONMASK_BITS = (15u * SKB_FIRST_WEAPON_BIT), + SKB_INTERFACE_BITS = (SKB_WEAPONMASK_BITS | SKB_STEROIDS | SKB_NIGHTVISION | SKB_MEDKIT | SKB_QUICK_KICK | \ + SKB_HOLSTER | SKB_INV_LEFT | SKB_PAUSE | SKB_HOLODUKE | SKB_JETPACK | SKB_INV_RIGHT | \ + SKB_TURNAROUND | SKB_OPEN | SKB_INVENTORY | SKB_ESCAPE), - SKB_NONE = 0, - SKB_ALL = ~0u + SKB_NONE = 0, + SKB_ALL = ~0u }; @@ -336,23 +336,23 @@ enum enum amoveflags_t { - face_player = 1, - geth = 2, - getv = 4, - random_angle = 8, - face_player_slow = 16, - spin = 32, - face_player_smart = 64, - fleeenemy = 128, - jumptoplayer_only = 256, - justjump1 = 256, - jumptoplayer = 257, - seekplayer = 512, - furthestdir = 1024, - dodgebullet = 4096, - justjump2 = 8192, - windang = 16384, - antifaceplayerslow = 32768 + face_player = 1, + geth = 2, + getv = 4, + random_angle = 8, + face_player_slow = 16, + spin = 32, + face_player_smart = 64, + fleeenemy = 128, + jumptoplayer_only = 256, + justjump1 = 256, + jumptoplayer = 257, + seekplayer = 512, + furthestdir = 1024, + dodgebullet = 4096, + justjump2 = 8192, + windang = 16384, + antifaceplayerslow = 32768 }; enum @@ -363,28 +363,28 @@ enum enum sflags_t { - SFLAG_SHADOW = 0x00000001, - SFLAG_NVG = 0x00000002, - SFLAG_INVENTORY = 0x00000004, - SFLAG_ADULT = 0x00000008, - SFLAG_SHRINKAUTOAIM = 0x00000010, - SFLAG_BADGUY = 0x00000020, - SFLAG_NOPAL = 0x00000040, - SFLAG_FORCEAUTOAIM = 0x00000080, - SFLAG_USEACTIVATOR = 0x00000200, - SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked - SFLAG_BADGUYSTAYPUT = 0x00008000, - SFLAG_GREENSLIMEFOOD = 0x00800000, - SFLAG_NODAMAGEPUSH = 0x00100000, - SFLAG_NOWATERDIP = 0x00200000, - SFLAG_INTERNAL_BADGUY = 0x08000000, // a separate flag is needed for the internal ones because SFLAG_BADGUY has additional semantics. - SFLAG_KILLCOUNT = 0x10000000, - SFLAG_NOCANSEECHECK = 0x20000000, + SFLAG_SHADOW = 0x00000001, + SFLAG_NVG = 0x00000002, + SFLAG_INVENTORY = 0x00000004, + SFLAG_ADULT = 0x00000008, + SFLAG_SHRINKAUTOAIM = 0x00000010, + SFLAG_BADGUY = 0x00000020, + SFLAG_NOPAL = 0x00000040, + SFLAG_FORCEAUTOAIM = 0x00000080, + SFLAG_USEACTIVATOR = 0x00000200, + SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked + SFLAG_BADGUYSTAYPUT = 0x00008000, + SFLAG_GREENSLIMEFOOD = 0x00800000, + SFLAG_NODAMAGEPUSH = 0x00100000, + SFLAG_NOWATERDIP = 0x00200000, + SFLAG_INTERNAL_BADGUY = 0x08000000, // a separate flag is needed for the internal ones because SFLAG_BADGUY has additional semantics. + SFLAG_KILLCOUNT = 0x10000000, + SFLAG_NOCANSEECHECK = 0x20000000, }; enum { - TFLAG_WALLSWITCH = 1 + TFLAG_WALLSWITCH = 1 }; enum @@ -437,58 +437,58 @@ enum enum miscConstants { - MAXSLEEPDIST = 16384, - SLEEPTIME = 1536, - ZOFFSET6 = (4 << 8), - FOURSLEIGHT = (1 << 8), + MAXSLEEPDIST = 16384, + SLEEPTIME = 1536, + ZOFFSET6 = (4 << 8), + FOURSLEIGHT = (1 << 8), - MOVEFIFOSIZ =256, - HORIZ_MIN =-99, - HORIZ_MAX =299, - AUTO_AIM_ANGLE =48, - PHEIGHT_DUKE =(38<<8), - PHEIGHT_RR =(40<<8), + MOVEFIFOSIZ =256, + HORIZ_MIN =-99, + HORIZ_MAX =299, + AUTO_AIM_ANGLE =48, + PHEIGHT_DUKE =(38<<8), + PHEIGHT_RR =(40<<8), - MAXMINECARTS = 16, - MAXJAILDOORS = 32, - MAXLIGHTNINSECTORS = 64, - MAXTORCHSECTORS = 64, - MAXGEOSECTORS = 64, + MAXMINECARTS = 16, + MAXJAILDOORS = 32, + MAXLIGHTNINSECTORS = 64, + MAXTORCHSECTORS = 64, + MAXGEOSECTORS = 64, - DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, + DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, }; enum { - MUS_INTRO = 0, - MUS_BRIEFING = 1, - MUS_LOADING = 2, + MUS_INTRO = 0, + MUS_BRIEFING = 1, + MUS_LOADING = 2, }; enum { - // Control flags for WW2GI weapons. - TRIPBOMB_TRIPWIRE = 1, - TRIPBOMB_TIMER = 2 + // Control flags for WW2GI weapons. + TRIPBOMB_TRIPWIRE = 1, + TRIPBOMB_TIMER = 2 }; // World tour enum EFlamethrowerState { - kHitTypeMask = 0xC000, - //kHitIndexMask = 0x3FFF, - kHitSector = 0x4000, - kHitWall = 0x8000, - kHitSprite = 0xC000, + kHitTypeMask = 0xC000, + //kHitIndexMask = 0x3FFF, + kHitSector = 0x4000, + kHitWall = 0x8000, + kHitSprite = 0xC000, }; enum gamemode_t { - MODE_MENU = 0x00000001, - MODE_DEMO = 0x00000002, - MODE_GAME = 0x00000004, - MODE_EOL = 0x00000008, - MODE_TYPE = 0x00000010, - MODE_RESTART = 0x00000020, + MODE_MENU = 0x00000001, + MODE_DEMO = 0x00000002, + MODE_GAME = 0x00000004, + MODE_EOL = 0x00000008, + MODE_TYPE = 0x00000010, + MODE_RESTART = 0x00000020, }; diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index d6f40f333..fce63f5be 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -148,7 +148,7 @@ class DukeMainMenu : public DukeListMenu DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x+5, origin.Y + 24, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.36, DTA_ScaleY, 0.36, DTA_CenterOffsetRel, true, TAG_DONE); } else - { + { DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE); if (PLUTOPAK) { @@ -156,7 +156,7 @@ class DukeMainMenu : public DukeListMenu PalEntry pe(255, light, light, light); DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE); } - } + } } }; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 40eabf691..b48c9480b 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -9,7 +9,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -61,16 +61,16 @@ bool ceilingspace_d(int sectnum); bool ceilingspace_r(int sectnum); bool floorspace_d(int sectnum); bool floorspace_r(int sectnum); -void addweapon_d(struct player_struct *p, int weapon); -void addweapon_r(struct player_struct *p, int weapon); +void addweapon_d(struct player_struct* p, int weapon); +void addweapon_r(struct player_struct* p, int weapon); void hitradius_d(short i, int r, int hp1, int hp2, int hp3, int hp4); void hitradius_r(short i, int r, int hp1, int hp2, int hp3, int hp4); int movesprite_d(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype); int movesprite_r(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype); -void lotsofmoney_d(spritetype *s, short n); -void lotsofmail_d(spritetype *s, short n); -void lotsofpaper_d(spritetype *s, short n); -void lotsoffeathers_r(spritetype *s, short n); +void lotsofmoney_d(spritetype* s, short n); +void lotsofmail_d(spritetype* s, short n); +void lotsofpaper_d(spritetype* s, short n); +void lotsoffeathers_r(spritetype* s, short n); void guts_d(spritetype* s, short gtype, short n, short p); void guts_r(spritetype* s, short gtype, short n, short p); void gutsdir_d(spritetype* s, short gtype, short n, short p); @@ -132,7 +132,7 @@ void SetDispatcher() Logo_d, InitFonts_d, PrintPaused_d, - + think_d, initactorflags_d, isadoorwall_d, @@ -145,20 +145,20 @@ void SetDispatcher() checkplayerhurt_d, checkhitceiling_d, checkhitsprite_d, - checksectors_d, + checksectors_d, - ceilingspace_d, - floorspace_d, - addweapon_d, - hitradius_d, - movesprite_d, - lotsofmoney_d, - lotsofmail_d, - lotsofpaper_d, - guts_d, - gutsdir_d, - ifhitsectors_d, - ifhitbyweapon_d, + ceilingspace_d, + floorspace_d, + addweapon_d, + hitradius_d, + movesprite_d, + lotsofmoney_d, + lotsofmail_d, + lotsofpaper_d, + guts_d, + gutsdir_d, + ifhitsectors_d, + ifhitbyweapon_d, fall_d, spawnweapondebris_d, respawnhitag_d, @@ -178,13 +178,13 @@ void SetDispatcher() animatesprites_d, }; } - else + else { fi = { Logo_r, InitFonts_r, PrintPaused_r, - + think_r, initactorflags_r, isadoorwall_r, @@ -197,20 +197,20 @@ void SetDispatcher() checkplayerhurt_r, checkhitceiling_r, checkhitsprite_r, - checksectors_r, + checksectors_r, - ceilingspace_r, - floorspace_r, - addweapon_r, - hitradius_r, - movesprite_r, - lotsoffeathers_r, - lotsoffeathers_r, - lotsoffeathers_r, - guts_r, - gutsdir_r, - ifhitsectors_r, - ifhitbyweapon_r, + ceilingspace_r, + floorspace_r, + addweapon_r, + hitradius_r, + movesprite_r, + lotsoffeathers_r, + lotsoffeathers_r, + lotsoffeathers_r, + guts_r, + gutsdir_r, + ifhitsectors_r, + ifhitbyweapon_r, fall_r, spawnweapondebris_r, respawnhitag_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 23823d8cb..8787dd085 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -64,13 +64,13 @@ struct GameInterface : ::GameInterface struct Dispatcher { - // global stuff - void (*ShowLogo)(const CompletionFunc& completion); - void (*InitFonts)(); + // global stuff + void (*ShowLogo)(const CompletionFunc& completion); + void (*InitFonts)(); void (*PrintPaused)(); // sectors_?.cpp - void (*think)(); + void (*think)(); void (*initactorflags)(); bool (*isadoorwall)(int dapic); void (*animatewalls)(); @@ -79,7 +79,7 @@ struct Dispatcher bool (*checkhitswitch)(int snum, int w, int switchtype); void (*activatebysector)(int sect, int j); void (*checkhitwall)(int spr, int dawallnum, int x, int y, int z, int atwith); - void (*checkplayerhurt)(struct player_struct* p, int j); + void (*checkplayerhurt)(struct player_struct* p, int j); bool (*checkhitceiling)(int sn); void (*checkhitsprite)(int i, int sn); void (*checksectors)(int low); @@ -97,24 +97,24 @@ struct Dispatcher int (*ifhitsectors)(int sectnum); int (*ifhitbyweapon)(int sectnum); void (*fall)(int g_i, int g_p); - bool (*spawnweapondebris)(int picnum, int dnum); - void (*respawnhitag)(spritetype* g_sp); - void (*checktimetosleep)(int g_i); - void (*move)(int g_i, int g_p, int g_x); + bool (*spawnweapondebris)(int picnum, int dnum); + void (*respawnhitag)(spritetype* g_sp); + void (*checktimetosleep)(int g_i); + void (*move)(int g_i, int g_p, int g_x); int (*spawn)(int j, int pn); - void (*check_fta_sounds)(int i); + void (*check_fta_sounds)(int i); - // player - void (*incur_damage)(struct player_struct* p); - void (*shoot)(int, int); - void (*selectweapon)(int snum, int j); - int (*doincrements)(struct player_struct* p); - void (*checkweapons)(struct player_struct* p); - void (*processinput)(int snum); - void (*displayweapon)(int snum); - void (*displaymasks)(int snum); + // player + void (*incur_damage)(struct player_struct* p); + void (*shoot)(int, int); + void (*selectweapon)(int snum, int j); + int (*doincrements)(struct player_struct* p); + void (*checkweapons)(struct player_struct* p); + void (*processinput)(int snum); + void (*displayweapon)(int snum); + void (*displaymasks)(int snum); - void (*animatesprites)(int x, int y, int a, int smoothratio); + void (*animatesprites)(int x, int y, int a, int smoothratio); }; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 08a4fe1a7..095793569 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -41,42 +41,42 @@ BEGIN_DUKE_NS void initactorflags_d() { setflag(SFLAG_INTERNAL_BADGUY, { - SHARK, - RECON, - DRONE, - LIZTROOPONTOILET, - LIZTROOPJUSTSIT, - LIZTROOPSTAYPUT, - LIZTROOPSHOOT, - LIZTROOPJETPACK, - LIZTROOPDUCKING, - LIZTROOPRUNNING, - LIZTROOP, - OCTABRAIN, - COMMANDER, - COMMANDERSTAYPUT, - PIGCOP, - EGG, - PIGCOPSTAYPUT, - PIGCOPDIVE, - LIZMAN, - LIZMANSPITTING, - LIZMANFEEDING, - LIZMANJUMP, - ORGANTIC, - BOSS1, - BOSS2, - BOSS3, - BOSS4, - GREENSLIME, - GREENSLIME+1, - GREENSLIME+2, - GREENSLIME+3, - GREENSLIME+4, - GREENSLIME+5, - GREENSLIME+6, - GREENSLIME+7, - RAT, + SHARK, + RECON, + DRONE, + LIZTROOPONTOILET, + LIZTROOPJUSTSIT, + LIZTROOPSTAYPUT, + LIZTROOPSHOOT, + LIZTROOPJETPACK, + LIZTROOPDUCKING, + LIZTROOPRUNNING, + LIZTROOP, + OCTABRAIN, + COMMANDER, + COMMANDERSTAYPUT, + PIGCOP, + EGG, + PIGCOPSTAYPUT, + PIGCOPDIVE, + LIZMAN, + LIZMANSPITTING, + LIZMANFEEDING, + LIZMANJUMP, + ORGANTIC, + BOSS1, + BOSS2, + BOSS3, + BOSS4, + GREENSLIME, + GREENSLIME+1, + GREENSLIME+2, + GREENSLIME+3, + GREENSLIME+4, + GREENSLIME+5, + GREENSLIME+6, + GREENSLIME+7, + RAT, ROTATEGUN }); // Some flags taken from RedNukem's init code. This is a good start as any to reduce the insane dependency on tile numbers for making decisions in the play code. A lot more will be added here later. @@ -90,197 +90,197 @@ void initactorflags_d() } settileflag(TFLAG_WALLSWITCH, { - HANDPRINTSWITCH, - HANDPRINTSWITCH+1, - ALIENSWITCH, - ALIENSWITCH+1, - MULTISWITCH, - MULTISWITCH+1, - MULTISWITCH+2, - MULTISWITCH+3, - ACCESSSWITCH, - ACCESSSWITCH2, - PULLSWITCH, - PULLSWITCH+1, - HANDSWITCH, - HANDSWITCH+1, - SLOTDOOR, - SLOTDOOR+1, - LIGHTSWITCH, - LIGHTSWITCH+1, - SPACELIGHTSWITCH, - SPACELIGHTSWITCH+1, - SPACEDOORSWITCH, - SPACEDOORSWITCH+1, - FRANKENSTINESWITCH, - FRANKENSTINESWITCH+1, - LIGHTSWITCH2, - LIGHTSWITCH2+1, - POWERSWITCH1, - POWERSWITCH1+1, - LOCKSWITCH1, - LOCKSWITCH1+1, - POWERSWITCH2, - POWERSWITCH2+1, - DIPSWITCH, - DIPSWITCH+1, - DIPSWITCH2, - DIPSWITCH2+1, - TECHSWITCH, - TECHSWITCH+1, - DIPSWITCH3, + HANDPRINTSWITCH, + HANDPRINTSWITCH+1, + ALIENSWITCH, + ALIENSWITCH+1, + MULTISWITCH, + MULTISWITCH+1, + MULTISWITCH+2, + MULTISWITCH+3, + ACCESSSWITCH, + ACCESSSWITCH2, + PULLSWITCH, + PULLSWITCH+1, + HANDSWITCH, + HANDSWITCH+1, + SLOTDOOR, + SLOTDOOR+1, + LIGHTSWITCH, + LIGHTSWITCH+1, + SPACELIGHTSWITCH, + SPACELIGHTSWITCH+1, + SPACEDOORSWITCH, + SPACEDOORSWITCH+1, + FRANKENSTINESWITCH, + FRANKENSTINESWITCH+1, + LIGHTSWITCH2, + LIGHTSWITCH2+1, + POWERSWITCH1, + POWERSWITCH1+1, + LOCKSWITCH1, + LOCKSWITCH1+1, + POWERSWITCH2, + POWERSWITCH2+1, + DIPSWITCH, + DIPSWITCH+1, + DIPSWITCH2, + DIPSWITCH2+1, + TECHSWITCH, + TECHSWITCH+1, + DIPSWITCH3, DIPSWITCH3+1}); - setflag(SFLAG_INVENTORY, { - FIRSTAID, - STEROIDS, - HEATSENSOR, - BOOTS, - JETPACK, - HOLODUKE, - AIRTANK }); + setflag(SFLAG_INVENTORY, { + FIRSTAID, + STEROIDS, + HEATSENSOR, + BOOTS, + JETPACK, + HOLODUKE, + AIRTANK }); - setflag(SFLAG_ADULT, { - FEM1, - FEM2, - FEM3, - FEM4, - FEM5, - FEM6, - FEM7, - FEM8, - FEM9, - FEM10, - MAN, - MAN2, - WOMAN, - NAKED1, - PODFEM1, - FEMMAG1, - FEMMAG2, - FEMPIC1, - FEMPIC2, - FEMPIC3, - FEMPIC4, - FEMPIC5, - FEMPIC6, - FEMPIC7, - BLOODYPOLE, - FEM6PAD, - STATUE, - STATUEFLASH, - OOZ, - OOZ2, - WALLBLOOD1, - WALLBLOOD2, - WALLBLOOD3, - WALLBLOOD4, - WALLBLOOD5, - WALLBLOOD7, - WALLBLOOD8, - SUSHIPLATE1, - SUSHIPLATE2, - SUSHIPLATE3, - SUSHIPLATE4, - FETUS, - FETUSJIB, - FETUSBROKE, - HOTMEAT, - FOODOBJECT16, - DOLPHIN1, - DOLPHIN2, - TOUGHGAL, - TAMPON, - XXXSTACY, - 4946, - 4947, - 693, - 2254, - 4560, - 4561, - 4562, - 4498, - 4957 }); + setflag(SFLAG_ADULT, { + FEM1, + FEM2, + FEM3, + FEM4, + FEM5, + FEM6, + FEM7, + FEM8, + FEM9, + FEM10, + MAN, + MAN2, + WOMAN, + NAKED1, + PODFEM1, + FEMMAG1, + FEMMAG2, + FEMPIC1, + FEMPIC2, + FEMPIC3, + FEMPIC4, + FEMPIC5, + FEMPIC6, + FEMPIC7, + BLOODYPOLE, + FEM6PAD, + STATUE, + STATUEFLASH, + OOZ, + OOZ2, + WALLBLOOD1, + WALLBLOOD2, + WALLBLOOD3, + WALLBLOOD4, + WALLBLOOD5, + WALLBLOOD7, + WALLBLOOD8, + SUSHIPLATE1, + SUSHIPLATE2, + SUSHIPLATE3, + SUSHIPLATE4, + FETUS, + FETUSJIB, + FETUSBROKE, + HOTMEAT, + FOODOBJECT16, + DOLPHIN1, + DOLPHIN2, + TOUGHGAL, + TAMPON, + XXXSTACY, + 4946, + 4947, + 693, + 2254, + 4560, + 4561, + 4562, + 4498, + 4957 }); - setflag(SFLAG_SHRINKAUTOAIM, { - GREENSLIME, - GREENSLIME + 1, - GREENSLIME + 2, - GREENSLIME + 3, - GREENSLIME + 4, - GREENSLIME + 5, - GREENSLIME + 6, - GREENSLIME + 7, - }); + setflag(SFLAG_SHRINKAUTOAIM, { + GREENSLIME, + GREENSLIME + 1, + GREENSLIME + 2, + GREENSLIME + 3, + GREENSLIME + 4, + GREENSLIME + 5, + GREENSLIME + 6, + GREENSLIME + 7, + }); - actorinfo[ORGANTIC].aimoffset = 32 << 8; - actorinfo[ROTATEGUN].aimoffset = 32 << 8; + actorinfo[ORGANTIC].aimoffset = 32 << 8; + actorinfo[ROTATEGUN].aimoffset = 32 << 8; - weaponsandammosprites[0] = RPGSPRITE; - weaponsandammosprites[1] = CHAINGUNSPRITE; - weaponsandammosprites[2] = DEVISTATORAMMO; - weaponsandammosprites[3] = RPGAMMO; - weaponsandammosprites[4] = RPGAMMO; - weaponsandammosprites[5] = JETPACK; - weaponsandammosprites[6] = SHIELD; - weaponsandammosprites[7] = FIRSTAID; - weaponsandammosprites[8] = STEROIDS; - weaponsandammosprites[9] = RPGAMMO; - weaponsandammosprites[10] = RPGAMMO; - weaponsandammosprites[11] = RPGSPRITE; - weaponsandammosprites[12] = RPGAMMO; - weaponsandammosprites[13] = FREEZESPRITE; - weaponsandammosprites[14] = FREEZEAMMO; + weaponsandammosprites[0] = RPGSPRITE; + weaponsandammosprites[1] = CHAINGUNSPRITE; + weaponsandammosprites[2] = DEVISTATORAMMO; + weaponsandammosprites[3] = RPGAMMO; + weaponsandammosprites[4] = RPGAMMO; + weaponsandammosprites[5] = JETPACK; + weaponsandammosprites[6] = SHIELD; + weaponsandammosprites[7] = FIRSTAID; + weaponsandammosprites[8] = STEROIDS; + weaponsandammosprites[9] = RPGAMMO; + weaponsandammosprites[10] = RPGAMMO; + weaponsandammosprites[11] = RPGSPRITE; + weaponsandammosprites[12] = RPGAMMO; + weaponsandammosprites[13] = FREEZESPRITE; + weaponsandammosprites[14] = FREEZEAMMO; - TILE_BOX = BOX; - TILE_TREE1 = TREE1; - TILE_TREE2 = TREE2; - TILE_TIRE = TIRE; - TILE_CONE = CONE; - TILE_W_FORCEFIELD = W_FORCEFIELD; - TILE_CAMERA1 = CAMERA1; - TILE_SCRAP6 = SCRAP6; - TILE_APLAYER = APLAYER; - TILE_DRONE = DRONE; - TILE_MENUSCREEN = MENUSCREEN; - TILE_SCREENBORDER = BIGHOLE; - TILE_VIEWBORDER = VIEWBORDER; - TILE_LASERLINE = LASERLINE; - TILE_APLAYERTOP = APLAYERTOP; - TILE_CAMCORNER = CAMCORNER; - TILE_CAMLIGHT = CAMLIGHT; - TILE_STATIC = STATIC; - TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; - TILE_SPINNINGNUKEICON = SPINNINGNUKEICON; - TILE_THREEDEE = THREEDEE; - TILE_INGAMEDUKETHREEDEE = INGAMEDUKETHREEDEE; - TILE_PLUTOPAKSPRITE = PLUTOPAKSPRITE; - TILE_MENUBAR = MENUBAR; - TILE_ATOMICHEALTH = ATOMICHEALTH; - TILE_FLOORSLIME = FLOORSLIME; - TILE_JIBS6 = JIBS6; - TILE_WATERBUBBLE = WATERBUBBLE; - TILE_SMALLSMOKE = SMALLSMOKE; - TILE_BLOODPOOL = BLOODPOOL; - TILE_FOOTPRINTS = FOOTPRINTS; - TILE_FOOTPRINTS2 = FOOTPRINTS2; - TILE_FOOTPRINTS3 = FOOTPRINTS3; - TILE_FOOTPRINTS4 = FOOTPRINTS4; - TILE_CLOUDYSKIES = CLOUDYSKIES; - TILE_ARROW = ARROW; - TILE_ACCESSSWITCH = ACCESSSWITCH; - TILE_ACCESSSWITCH2 = ACCESSSWITCH2; - TILE_GLASSPIECES = GLASSPIECES; - TILE_BETAVERSION = BETAVERSION; - TILE_MIRROR = MIRROR; - TILE_CLOUDYOCEAN = CLOUDYOCEAN; - TILE_MOONSKY1 = MOONSKY1; - TILE_LA = LA; - TILE_LOADSCREEN = LOADSCREEN; - TILE_CROSSHAIR = CROSSHAIR; - TILE_BIGORBIT1 = BIGORBIT1; - TILE_HURTRAIL = HURTRAIL; - TILE_FLOORPLASMA = FLOORPLASMA; + TILE_BOX = BOX; + TILE_TREE1 = TREE1; + TILE_TREE2 = TREE2; + TILE_TIRE = TIRE; + TILE_CONE = CONE; + TILE_W_FORCEFIELD = W_FORCEFIELD; + TILE_CAMERA1 = CAMERA1; + TILE_SCRAP6 = SCRAP6; + TILE_APLAYER = APLAYER; + TILE_DRONE = DRONE; + TILE_MENUSCREEN = MENUSCREEN; + TILE_SCREENBORDER = BIGHOLE; + TILE_VIEWBORDER = VIEWBORDER; + TILE_LASERLINE = LASERLINE; + TILE_APLAYERTOP = APLAYERTOP; + TILE_CAMCORNER = CAMCORNER; + TILE_CAMLIGHT = CAMLIGHT; + TILE_STATIC = STATIC; + TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; + TILE_SPINNINGNUKEICON = SPINNINGNUKEICON; + TILE_THREEDEE = THREEDEE; + TILE_INGAMEDUKETHREEDEE = INGAMEDUKETHREEDEE; + TILE_PLUTOPAKSPRITE = PLUTOPAKSPRITE; + TILE_MENUBAR = MENUBAR; + TILE_ATOMICHEALTH = ATOMICHEALTH; + TILE_FLOORSLIME = FLOORSLIME; + TILE_JIBS6 = JIBS6; + TILE_WATERBUBBLE = WATERBUBBLE; + TILE_SMALLSMOKE = SMALLSMOKE; + TILE_BLOODPOOL = BLOODPOOL; + TILE_FOOTPRINTS = FOOTPRINTS; + TILE_FOOTPRINTS2 = FOOTPRINTS2; + TILE_FOOTPRINTS3 = FOOTPRINTS3; + TILE_FOOTPRINTS4 = FOOTPRINTS4; + TILE_CLOUDYSKIES = CLOUDYSKIES; + TILE_ARROW = ARROW; + TILE_ACCESSSWITCH = ACCESSSWITCH; + TILE_ACCESSSWITCH2 = ACCESSSWITCH2; + TILE_GLASSPIECES = GLASSPIECES; + TILE_BETAVERSION = BETAVERSION; + TILE_MIRROR = MIRROR; + TILE_CLOUDYOCEAN = CLOUDYOCEAN; + TILE_MOONSKY1 = MOONSKY1; + TILE_LA = LA; + TILE_LOADSCREEN = LOADSCREEN; + TILE_CROSSHAIR = CROSSHAIR; + TILE_BIGORBIT1 = BIGORBIT1; + TILE_HURTRAIL = HURTRAIL; + TILE_FLOORPLASMA = FLOORPLASMA; } diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 64571e680..06426c60a 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -96,7 +96,7 @@ void initactorflags_r() setflag(SFLAG_KILLCOUNT, { ROCK, ROCK2 }); //??? setflag(SFLAG_NODAMAGEPUSH, { HULK, MAMA, BILLYPLAY, COOTPLAY, MAMACLOUD }); setflag(SFLAG_NOCANSEECHECK, { COOT, COOTSTAYPUT, BIKERB, BIKERBV2, CHEER, CHEERB, - CHEERSTAYPUT, MINIONBOAT, HULKBOAT, CHEERBOAT, RABBIT, COOTPLAY, BILLYPLAY, MAKEOUT, MAMA }); + CHEERSTAYPUT, MINIONBOAT, HULKBOAT, CHEERBOAT, RABBIT, COOTPLAY, BILLYPLAY, MAKEOUT, MAMA }); } else { @@ -104,54 +104,54 @@ void initactorflags_r() } settileflag(TFLAG_WALLSWITCH, { - HANDPRINTSWITCH, - HANDPRINTSWITCH+1, - ALIENSWITCH, - ALIENSWITCH+1, - MULTISWITCH, - MULTISWITCH+1, - MULTISWITCH+2, - MULTISWITCH+3, - ACCESSSWITCH, - ACCESSSWITCH2, - PULLSWITCH, - PULLSWITCH+1, - HANDSWITCH, - HANDSWITCH+1, - SLOTDOOR, - SLOTDOOR+1, - LIGHTSWITCH, - LIGHTSWITCH+1, - SPACELIGHTSWITCH, - SPACELIGHTSWITCH+1, - SPACEDOORSWITCH, - SPACEDOORSWITCH+1, - FRANKENSTINESWITCH, - FRANKENSTINESWITCH+1, - LIGHTSWITCH2, - LIGHTSWITCH2+1, - POWERSWITCH1, - POWERSWITCH1+1, - LOCKSWITCH1, - LOCKSWITCH1+1, - POWERSWITCH2, - POWERSWITCH2+1, - DIPSWITCH, - DIPSWITCH+1, - DIPSWITCH2, - DIPSWITCH2+1, - TECHSWITCH, - TECHSWITCH+1, - DIPSWITCH3, - DIPSWITCH3+1, - NUKEBUTTON, + HANDPRINTSWITCH, + HANDPRINTSWITCH+1, + ALIENSWITCH, + ALIENSWITCH+1, + MULTISWITCH, + MULTISWITCH+1, + MULTISWITCH+2, + MULTISWITCH+3, + ACCESSSWITCH, + ACCESSSWITCH2, + PULLSWITCH, + PULLSWITCH+1, + HANDSWITCH, + HANDSWITCH+1, + SLOTDOOR, + SLOTDOOR+1, + LIGHTSWITCH, + LIGHTSWITCH+1, + SPACELIGHTSWITCH, + SPACELIGHTSWITCH+1, + SPACEDOORSWITCH, + SPACEDOORSWITCH+1, + FRANKENSTINESWITCH, + FRANKENSTINESWITCH+1, + LIGHTSWITCH2, + LIGHTSWITCH2+1, + POWERSWITCH1, + POWERSWITCH1+1, + LOCKSWITCH1, + LOCKSWITCH1+1, + POWERSWITCH2, + POWERSWITCH2+1, + DIPSWITCH, + DIPSWITCH+1, + DIPSWITCH2, + DIPSWITCH2+1, + TECHSWITCH, + TECHSWITCH+1, + DIPSWITCH3, + DIPSWITCH3+1, + NUKEBUTTON, NUKEBUTTON+1}); if (isRRRA()) settileflag(TFLAG_WALLSWITCH, { - MULTISWITCH2, - MULTISWITCH2+1, - MULTISWITCH2+2, - MULTISWITCH2+3, - RRTILE8464, + MULTISWITCH2, + MULTISWITCH2+1, + MULTISWITCH2+2, + MULTISWITCH2+3, + RRTILE8464, RRTILE8464+1}); setflag(SFLAG_INVENTORY, { diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 6984f949f..671fae7fb 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -92,7 +92,7 @@ static void genspriteremaps(void) auto fr = fileSystem.OpenFileReader("lookup.dat"); if (!fr.isOpen()) - return; + return; j = lookups.loadTable(fr); @@ -106,7 +106,7 @@ static void genspriteremaps(void) uint8_t paldata[768]; - for (j=1; j<=5; j++) + for (j = 1; j <= 5; j++) { if (fr.Read(paldata, 768) != 768) return; @@ -121,8 +121,8 @@ static void genspriteremaps(void) { // swap red and blue channels. paldata[i * 3] = GPalette.BaseColors[i].b; - paldata[i * 3+1] = GPalette.BaseColors[i].g; - paldata[i * 3+2] = GPalette.BaseColors[i].r; + paldata[i * 3 + 1] = GPalette.BaseColors[i].g; + paldata[i * 3 + 2] = GPalette.BaseColors[i].r; } paletteSetColorTable(DRUGPAL, paldata, false, false); // todo: implement this as a shader effect (swap R and B in postprocessing.) @@ -235,40 +235,40 @@ static void setupbackdrop() static void SetupGameButtons() { - static const char* actions[] = { - "Move_Forward", - "Move_Backward", - "Turn_Left", - "Turn_Right", - "Strafe", - "Fire", - "Open", - "Run", - "Jump", - "Crouch", - "Look_Up", - "Look_Down", - "Look_Left", - "Look_Right", - "Strafe_Left", - "Strafe_Right", - "Aim_Up", - "Aim_Down", - "Map", - "Shrink_Screen", - "Enlarge_Screen", - "Show_Opponents_Weapon", - "Map_Follow_Mode", - "See_Coop_View", - "Mouse_Aiming", - "Toggle_Crosshair", - "Quick_Kick", - "Dpad_Select", - "Dpad_Aiming", - "Third_Person_View", - "Toggle_Crouch", - }; - buttonMap.SetButtons(actions, NUM_ACTIONS); + static const char* actions[] = { + "Move_Forward", + "Move_Backward", + "Turn_Left", + "Turn_Right", + "Strafe", + "Fire", + "Open", + "Run", + "Jump", + "Crouch", + "Look_Up", + "Look_Down", + "Look_Left", + "Look_Right", + "Strafe_Left", + "Strafe_Right", + "Aim_Up", + "Aim_Down", + "Map", + "Shrink_Screen", + "Enlarge_Screen", + "Show_Opponents_Weapon", + "Map_Follow_Mode", + "See_Coop_View", + "Mouse_Aiming", + "Toggle_Crosshair", + "Quick_Kick", + "Dpad_Select", + "Dpad_Aiming", + "Third_Person_View", + "Toggle_Crouch", + }; + buttonMap.SetButtons(actions, NUM_ACTIONS); } //--------------------------------------------------------------------------- @@ -279,15 +279,15 @@ static void SetupGameButtons() static void ticker(void) { - S_Update(); + S_Update(); - // we need CONTROL_GetInput in order to pick up joystick button presses - if (!(ps[myconnectindex].gm & MODE_GAME) || (paused && !System_WantGuiCapture())) - { - ControlInfo noshareinfo; - CONTROL_GetInput(&noshareinfo); - C_RunDelayedCommands(); - } + // we need CONTROL_GetInput in order to pick up joystick button presses + if (!(ps[myconnectindex].gm & MODE_GAME) || (paused && !System_WantGuiCapture())) + { + ControlInfo noshareinfo; + CONTROL_GetInput(&noshareinfo); + C_RunDelayedCommands(); + } } //--------------------------------------------------------------------------- @@ -298,15 +298,15 @@ static void ticker(void) static void loaddefs() { - const char *defsfile = G_DefFile(); - cycle_t deftimer; - deftimer.Reset(); - deftimer.Clock(); - if (!loaddefinitionsfile(defsfile)) - { - deftimer.Unclock(); - Printf("Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS()); - } + const char* defsfile = G_DefFile(); + cycle_t deftimer; + deftimer.Reset(); + deftimer.Clock(); + if (!loaddefinitionsfile(defsfile)) + { + deftimer.Unclock(); + Printf("Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS()); + } userConfig.AddDefs.reset(); } @@ -318,16 +318,16 @@ static void loaddefs() static void initTiles() { - if (TileFiles.artLoadFiles("tiles%03i.art") < 0) - I_FatalError("Failed loading art."); + if (TileFiles.artLoadFiles("tiles%03i.art") < 0) + I_FatalError("Failed loading art."); - tileDelete(TILE_MIRROR); - skiptile = TILE_W_FORCEFIELD + 1; + tileDelete(TILE_MIRROR); + skiptile = TILE_W_FORCEFIELD + 1; - if (isRR()) - tileDelete(0); + if (isRR()) + tileDelete(0); - tileDelete(FOF); + tileDelete(FOF); } //--------------------------------------------------------------------------- @@ -338,85 +338,85 @@ static void initTiles() static void Startup(void) { - ud.god = 0; - ud.m_respawn_items = 0; - ud.m_respawn_monsters = 0; - ud.m_respawn_inventory = 0; - ud.cashman = 0; - ud.m_player_skill = ud.player_skill = 2; - ud.wchoice[0][0] = 3; - ud.wchoice[0][1] = 4; - ud.wchoice[0][2] = 5; - ud.wchoice[0][3] = 7; - ud.wchoice[0][4] = 8; - ud.wchoice[0][5] = 6; - ud.wchoice[0][6] = 0; - ud.wchoice[0][7] = 2; - ud.wchoice[0][8] = 9; - ud.wchoice[0][9] = 1; - ud.multimode = 1; + ud.god = 0; + ud.m_respawn_items = 0; + ud.m_respawn_monsters = 0; + ud.m_respawn_inventory = 0; + ud.cashman = 0; + ud.m_player_skill = ud.player_skill = 2; + ud.wchoice[0][0] = 3; + ud.wchoice[0][1] = 4; + ud.wchoice[0][2] = 5; + ud.wchoice[0][3] = 7; + ud.wchoice[0][4] = 8; + ud.wchoice[0][5] = 6; + ud.wchoice[0][6] = 0; + ud.wchoice[0][7] = 2; + ud.wchoice[0][8] = 9; + ud.wchoice[0][9] = 1; + ud.multimode = 1; ud.m_monsters_off = userConfig.nomonsters; - ps[0].aim_mode = 1; - ud.camerasprite = -1; + ps[0].aim_mode = 1; + ud.camerasprite = -1; if (fileSystem.FileExists("DUKESW.BIN")) g_gameType |= GAMEFLAG_SHAREWARE; - numplayers = 1; - playerswhenstarted = ud.multimode; + numplayers = 1; + playerswhenstarted = ud.multimode; - connectpoint2[0] = -1; - - SetDispatcher(); - S_InitSound(); + connectpoint2[0] = -1; - timerInit(TICRATE); - timerSetCallback(ticker); + SetDispatcher(); + S_InitSound(); - loadcons(); - fi.initactorflags(); + timerInit(TICRATE); + timerSetCallback(ticker); - OnEvent(EVENT_INIT); + loadcons(); + fi.initactorflags(); - enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; + OnEvent(EVENT_INIT); - if (engineInit()) - G_FatalEngineError(); + enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; - setupbackdrop(); - //Net_SendClientInfo(); + if (engineInit()) + G_FatalEngineError(); + + setupbackdrop(); + //Net_SendClientInfo(); initTiles(); - fi.InitFonts(); - genspriteremaps(); - TileFiles.PostLoadSetup(); - SetupGameButtons(); - InitCheats(); - checkcommandline(); - registerosdcommands(); - registerinputcommands(); - - screenpeek = myconnectindex; - ps[myconnectindex].palette = BASEPAL; + fi.InitFonts(); + genspriteremaps(); + TileFiles.PostLoadSetup(); + SetupGameButtons(); + InitCheats(); + checkcommandline(); + registerosdcommands(); + registerinputcommands(); - for (int j=numplayers; j 1) - { - ud.m_monsters_off = 1; - ud.m_player_skill = 0; - } + for (int j = numplayers; j < ud.multimode; j++) + { + mysnprintf(ud.user_name[j], sizeof(ud.user_name[j]), "%s %d", GStrings("PLAYER"), j + 1); + ps[j].weaponswitch = 3; + ps[j].auto_aim = 0; + } - ud.last_level = -1; - hud_size.Callback(); - hud_scale.Callback(); + loaddefs(); + + if (ud.multimode > 1) + { + ud.m_monsters_off = 1; + ud.m_player_skill = 0; + } + + ud.last_level = -1; + hud_size.Callback(); + hud_scale.Callback(); } //--------------------------------------------------------------------------- @@ -428,13 +428,13 @@ static void Startup(void) void app_loop(); int GameInterface::app_main() { - Startup(); - enginePostInit(); - videoInit(); - videoSetPalette(BASEPAL); + Startup(); + enginePostInit(); + videoInit(); + videoSetPalette(BASEPAL); app_loop(); return 0; } - + END_DUKE_NS diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 1c86a29de..d14eaed41 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -222,12 +222,12 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4]) void setgamepalette(int palid) { - if (palid >= MAXBASEPALS || palid < 0) palid = 0; + if (palid >= MAXBASEPALS || palid < 0) palid = 0; auto& fstint = lookups.tables[MAXPALOOKUPS - 1]; if (palid == WATERPAL) fstint.tintColor = PalEntry(224, 192, 255); else if (palid == SLIMEPAL) fstint.tintColor = PalEntry(208, 255, 192); else fstint.tintColor = 0xffffff; - videoSetPalette(palid); + videoSetPalette(palid); } //--------------------------------------------------------------------------- @@ -716,8 +716,8 @@ void cameratext(int i) void dobonus(int bonusonly, const CompletionFunc& completion) { if (isRRRA()) { if (completion) completion(false); } - else if (isRR()) dobonus_r(bonusonly, completion); - else dobonus_d(bonusonly, completion); + else if (isRR()) dobonus_r(bonusonly, completion); + else dobonus_d(bonusonly, completion); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 705f6b86f..221bb92e1 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -41,23 +41,23 @@ BEGIN_DUKE_NS // Player Actions - used by ifp instruction. enum playeraction_t { - pstanding = 0x00000001, - pwalking = 0x00000002, - prunning = 0x00000004, - pducking = 0x00000008, - pfalling = 0x00000010, - pjumping = 0x00000020, - phigher = 0x00000040, - pwalkingback = 0x00000080, - prunningback = 0x00000100, - pkicking = 0x00000200, - pshrunk = 0x00000400, - pjetpack = 0x00000800, - ponsteroids = 0x00001000, - ponground = 0x00002000, - palive = 0x00004000, - pdead = 0x00008000, - pfacing = 0x00010000 + pstanding = 0x00000001, + pwalking = 0x00000002, + prunning = 0x00000004, + pducking = 0x00000008, + pfalling = 0x00000010, + pjumping = 0x00000020, + phigher = 0x00000040, + pwalkingback = 0x00000080, + prunningback = 0x00000100, + pkicking = 0x00000200, + pshrunk = 0x00000400, + pjetpack = 0x00000800, + ponsteroids = 0x00001000, + ponground = 0x00002000, + palive = 0x00004000, + pdead = 0x00008000, + pfacing = 0x00010000 }; diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 5d29bcb36..9af66d1c9 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -9,186 +9,186 @@ BEGIN_DUKE_NS inline int rnd(int X) { - return ((krand() >> 8) >= (255 - (X))); + return ((krand() >> 8) >= (255 - (X))); } inline bool AFLAMABLE(int X) { - return (X == TILE_BOX || X == TILE_TREE1 || X == TILE_TREE2 || X == TILE_TIRE || X == TILE_CONE); + return (X == TILE_BOX || X == TILE_TREE1 || X == TILE_TREE2 || X == TILE_TIRE || X == TILE_CONE); } inline int badguypic(int const tileNum) { - return ((actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0); + return ((actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0); } inline int badguy(void const * const pSprite) { - return badguypic(((uspritetype const *) pSprite)->picnum); + return badguypic(((uspritetype const *) pSprite)->picnum); } inline int actorflag(int spritenum, int mask) { - return (((actorinfo[sprite[spritenum].picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0); + return (((actorinfo[sprite[spritenum].picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0); } inline int actorfella(int spnum) { - return actorflag(spnum, SFLAG_KILLCOUNT); + return actorflag(spnum, SFLAG_KILLCOUNT); } inline void setflag(int flag, const std::initializer_list& types) { - for (auto val : types) - { - actorinfo[val].flags |= flag; - } + for (auto val : types) + { + actorinfo[val].flags |= flag; + } } inline bool inventory(spritetype* S) { - return !!(actorinfo[S->picnum].flags & SFLAG_INVENTORY); + return !!(actorinfo[S->picnum].flags & SFLAG_INVENTORY); } inline void settileflag(int flag, const std::initializer_list& types) { - for (auto val : types) - { - tileinfo[val].flags |= flag; - } + for (auto val : types) + { + tileinfo[val].flags |= flag; + } } inline bool wallswitchcheck(int s) { - return !!(tileinfo[s].flags & TFLAG_WALLSWITCH); + return !!(tileinfo[s].flags & TFLAG_WALLSWITCH); } inline int checkcursectnums(int se) { - int i; - for(i=connecthead;i>=0;i=connectpoint2[i]) - if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i; - return -1; + int i; + for(i=connecthead;i>=0;i=connectpoint2[i]) + if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i; + return -1; } // These are from duke's sector.c inline int ldist(const spritetype* s1, const spritetype* s2) { - int vx, vy; - vx = s1->x - s2->x; - vy = s1->y - s2->y; - return(FindDistance2D(vx, vy) + 1); + int vx, vy; + vx = s1->x - s2->x; + vy = s1->y - s2->y; + return(FindDistance2D(vx, vy) + 1); } inline int ldist(const spritetype* s1, const tspritetype* s2) { - int vx, vy; - vx = s1->x - s2->x; - vy = s1->y - s2->y; - return(FindDistance2D(vx, vy) + 1); + int vx, vy; + vx = s1->x - s2->x; + vy = s1->y - s2->y; + return(FindDistance2D(vx, vy) + 1); } inline int dist(const spritetype* s1, const spritetype* s2) { - int vx, vy, vz; - vx = s1->x - s2->x; - vy = s1->y - s2->y; - vz = s1->z - s2->z; - return(FindDistance3D(vx, vy, vz >> 4)); + int vx, vy, vz; + vx = s1->x - s2->x; + vy = s1->y - s2->y; + vz = s1->z - s2->z; + return(FindDistance3D(vx, vy, vz >> 4)); } inline bool isIn(int value, int first) { - return value == first; + return value == first; } template bool isIn(int value, int first, Args... args) { - return value == first || isIn(value, args...); + return value == first || isIn(value, args...); } inline bool isIn(int value, const std::initializer_list& list) { - for (auto v : list) if (v == value) return true; - return false; + for (auto v : list) if (v == value) return true; + return false; } // these are mainly here to avoid directly accessing the input data so that it can be more easily refactored later. inline bool PlayerInput(int pl, ESyncBits bit) { - return (!!((sync[pl].bits) & bit)); + return (!!((sync[pl].bits) & bit)); } inline void PlayerSetInput(int pl, ESyncBits bit) { - sync[pl].bits |= bit; + sync[pl].bits |= bit; } inline void PlayerClearInput(int pl, ESyncBits bit) { - sync[pl].bits &= ~bit; + sync[pl].bits &= ~bit; } inline ESyncBits PlayerInputBits(int pl, ESyncBits bits) { - return (sync[pl].bits & bits); + return (sync[pl].bits & bits); } inline int PlayerInputSideVel(int pl) { - return sync[pl].svel; + return sync[pl].svel; } inline int PlayerInputForwardVel(int pl) { - return sync[pl].fvel; + return sync[pl].fvel; } inline fixed_t PlayerInputAngVel(int pl) { - return sync[pl].q16avel; + return sync[pl].q16avel; } inline void clearfriction() { - for (int i = 0; i != -1; i = connectpoint2[i]) - { - ps[i].fric.x = ps[i].fric.y = 0; - } + for (int i = 0; i != -1; i = connectpoint2[i]) + { + ps[i].fric.x = ps[i].fric.y = 0; + } } inline void SetPlayerPal(player_struct* p, PalEntry pe) { - p->pals = pe; + p->pals = pe; } inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) { - if (!((ud.multimode < 2 && ((ps[myconnectindex].gm & MODE_MENU) == 0)) || - ud.multimode > 1 || ud.recstat == 2) || paused) - { - return 65536; - } - return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC); + if (!((ud.multimode < 2 && ((ps[myconnectindex].gm & MODE_MENU) == 0)) || + ud.multimode > 1 || ud.recstat == 2) || paused) + { + return 65536; + } + return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC); } // These should be the only places converting between level numbers and volume/map pairs constexpr inline int levelnum(int vol, int map) { - return vol * 1000 + map; + return vol * 1000 + map; } constexpr inline int volfromlevelnum(int num) { - return num > 0 ? num / 1000 : 0; + return num > 0 ? num / 1000 : 0; } constexpr inline int mapfromlevelnum(int num) { - return num > 0 ? num % 1000 : -1; + return num > 0 ? num % 1000 : -1; } //--------------------------------------------------------------------------- @@ -199,8 +199,8 @@ constexpr inline int mapfromlevelnum(int num) inline void hud_draw(double x, double y, int tilenum, int shade, int orientation) { - int p = sector[ps[screenpeek].cursectnum].floorpal; - hud_drawsprite(x, y, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); + int p = sector[ps[screenpeek].cursectnum].floorpal; + hud_drawsprite(x, y, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); } END_DUKE_NS diff --git a/source/games/duke/src/interpolate.cpp b/source/games/duke/src/interpolate.cpp index 3a224bf9f..82a5f32b9 100644 --- a/source/games/duke/src/interpolate.cpp +++ b/source/games/duke/src/interpolate.cpp @@ -105,45 +105,45 @@ void restoreinterpolations() //Stick at end of drawscreen void setsectinterpolate(int i) { - int j, k, startwall,endwall; - auto sect = §or[sprite[i].sectnum]; + int j, k, startwall,endwall; + auto sect = §or[sprite[i].sectnum]; - startwall = sect->wallptr; - endwall = startwall+sect->wallnum; + startwall = sect->wallptr; + endwall = startwall+sect->wallnum; - for(j=startwall;j= 0) - { - setinterpolation(&wall[k].x); - setinterpolation(&wall[k].y); - k = wall[k].point2; - setinterpolation(&wall[k].x); - setinterpolation(&wall[k].y); - } - } + for(j=startwall;j= 0) + { + setinterpolation(&wall[k].x); + setinterpolation(&wall[k].y); + k = wall[k].point2; + setinterpolation(&wall[k].x); + setinterpolation(&wall[k].y); + } + } } void clearsectinterpolate(short i) { - short j,startwall,endwall; - auto sect = §or[sprite[i].sectnum]; + short j,startwall,endwall; + auto sect = §or[sprite[i].sectnum]; - startwall = sect->wallptr; - endwall = startwall + sect->wallnum; - for(j=startwall;j= 0) - { - stopinterpolation(&wall[wall[j].nextwall].x); - stopinterpolation(&wall[wall[j].nextwall].y); - } - } + startwall = sect->wallptr; + endwall = startwall + sect->wallnum; + for(j=startwall;j= 0) + { + stopinterpolation(&wall[wall[j].nextwall].x); + stopinterpolation(&wall[wall[j].nextwall].y); + } + } } END_DUKE_NS diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 5f638408a..760545950 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -59,43 +59,43 @@ extern int TILE_FLOORPLASMA; enum dukeweapon_t { - KNEE_WEAPON, // 0 - PISTOL_WEAPON, - SHOTGUN_WEAPON, - CHAINGUN_WEAPON, - RPG_WEAPON, - HANDBOMB_WEAPON, // 5 - SHRINKER_WEAPON, - DEVISTATOR_WEAPON, - TRIPBOMB_WEAPON, - FREEZE_WEAPON, - HANDREMOTE_WEAPON, // 10 - GROW_WEAPON, - FLAMETHROWER_WEAPON, // World Tour + KNEE_WEAPON, // 0 + PISTOL_WEAPON, + SHOTGUN_WEAPON, + CHAINGUN_WEAPON, + RPG_WEAPON, + HANDBOMB_WEAPON, // 5 + SHRINKER_WEAPON, + DEVISTATOR_WEAPON, + TRIPBOMB_WEAPON, + FREEZE_WEAPON, + HANDREMOTE_WEAPON, // 10 + GROW_WEAPON, + FLAMETHROWER_WEAPON, // World Tour - MIN_WEAPON = 0, - MAX_WEAPON = 9 + MIN_WEAPON = 0, + MAX_WEAPON = 9 }; enum redneck_weapon_t { - // These names have been pieced together from RedneckGDX and RedNukem because the reconstructed source recycled Duke's names for the first 11 weapons. - // Names for 0-2 are the same - RIFLEGUN_WEAPON = 3, - DYNAMITE_WEAPON = 4, - CROSSBOW_WEAPON = 5, - THROWSAW_WEAPON = 6, - ALIENBLASTER_WEAPON = 7, - POWDERKEG_WEAPON = 8, - TIT_WEAPON = 9, - THROWINGDYNAMITE_WEAPON = 10, - BUZZSAW_WEAPON = 11, - BOWLING_WEAPON = 12, - MOTORCYCLE_WEAPON = 13, - BOAT_WEAPON = 14, - SLINGBLADE_WEAPON = 15, - CHICKEN_WEAPON = 16, - MAX_WEAPONS + // These names have been pieced together from RedneckGDX and RedNukem because the reconstructed source recycled Duke's names for the first 11 weapons. + // Names for 0-2 are the same + RIFLEGUN_WEAPON = 3, + DYNAMITE_WEAPON = 4, + CROSSBOW_WEAPON = 5, + THROWSAW_WEAPON = 6, + ALIENBLASTER_WEAPON = 7, + POWDERKEG_WEAPON = 8, + TIT_WEAPON = 9, + THROWINGDYNAMITE_WEAPON = 10, + BUZZSAW_WEAPON = 11, + BOWLING_WEAPON = 12, + MOTORCYCLE_WEAPON = 13, + BOAT_WEAPON = 14, + SLINGBLADE_WEAPON = 15, + CHICKEN_WEAPON = 16, + MAX_WEAPONS }; END_DUKE_NS diff --git a/source/games/duke/src/noise.cpp b/source/games/duke/src/noise.cpp index cc6c28bac..4b9fbe642 100644 --- a/source/games/duke/src/noise.cpp +++ b/source/games/duke/src/noise.cpp @@ -31,30 +31,30 @@ BEGIN_DUKE_NS int madenoise(int snum) { - player_struct *p; - p = &ps[snum]; - p->donoise = 1; - p->noise_x = p->posx; - p->noise_y = p->posy; - return 1; + player_struct *p; + p = &ps[snum]; + p->donoise = 1; + p->noise_x = p->posx; + p->noise_y = p->posy; + return 1; } int wakeup(int i, int snum) { - player_struct *p; - int radius; - p = &ps[snum]; - if (!p->donoise) - return 0; - if (sprite[i].pal == 30 || sprite[i].pal == 32 || sprite[i].pal == 33 || (isRRRA() && sprite[i].pal == 8)) - return 0; + player_struct *p; + int radius; + p = &ps[snum]; + if (!p->donoise) + return 0; + if (sprite[i].pal == 30 || sprite[i].pal == 32 || sprite[i].pal == 33 || (isRRRA() && sprite[i].pal == 8)) + return 0; - radius = p->noise_radius; + radius = p->noise_radius; - if (p->noise_x - radius < sprite[i].x && p->noise_x + radius > sprite[i].x - && p->noise_y - radius < sprite[i].y && p->noise_y + radius > sprite[i].y) - return 1; - return 0; + if (p->noise_x - radius < sprite[i].x && p->noise_x + radius > sprite[i].x + && p->noise_y - radius < sprite[i].y && p->noise_y + radius > sprite[i].y) + return 1; + return 0; } END_DUKE_NS diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 94d5ba784..b78559ea1 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -4153,27 +4153,27 @@ void processmove_r(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int s void OnMotorcycle(struct player_struct *p, int motosprite) { - if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2)) - { - if (motosprite) - { - p->posx = sprite[motosprite].x; - p->posy = sprite[motosprite].y; - p->setang(sprite[motosprite].ang); - p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner; - deletesprite(motosprite); - } - p->over_shoulder_on = 0; - p->OnMotorcycle = 1; - p->last_full_weapon = p->curr_weapon; - p->curr_weapon = MOTORCYCLE_WEAPON; - p->gotweapon.Set(MOTORCYCLE_WEAPON); - p->posxv = 0; - p->posyv = 0; - p->sethoriz(100); - } - if (!A_CheckSoundPlaying(p->i,186)) - A_PlaySound(186, p->i); + if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2)) + { + if (motosprite) + { + p->posx = sprite[motosprite].x; + p->posy = sprite[motosprite].y; + p->setang(sprite[motosprite].ang); + p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner; + deletesprite(motosprite); + } + p->over_shoulder_on = 0; + p->OnMotorcycle = 1; + p->last_full_weapon = p->curr_weapon; + p->curr_weapon = MOTORCYCLE_WEAPON; + p->gotweapon.Set(MOTORCYCLE_WEAPON); + p->posxv = 0; + p->posyv = 0; + p->sethoriz(100); + } + if (!A_CheckSoundPlaying(p->i,186)) + A_PlaySound(186, p->i); } //--------------------------------------------------------------------------- @@ -4184,42 +4184,42 @@ void OnMotorcycle(struct player_struct *p, int motosprite) void OffMotorcycle(struct player_struct *p) { - short j; - if (p->OnMotorcycle) - { - if (A_CheckSoundPlaying(p->i,188)) - S_StopEnvSound(188,p->i); - if (A_CheckSoundPlaying(p->i,187)) - S_StopEnvSound(187,p->i); - if (A_CheckSoundPlaying(p->i,186)) - S_StopEnvSound(186,p->i); - if (A_CheckSoundPlaying(p->i,214)) - S_StopEnvSound(214,p->i); - if (!A_CheckSoundPlaying(p->i,42)) - A_PlaySound(42, p->i); - p->OnMotorcycle = 0; - p->gotweapon.Clear(MOTORCYCLE_WEAPON); - p->curr_weapon = p->last_full_weapon; - checkavailweapon(p); - p->sethoriz(100); - p->moto_do_bump = 0; - p->MotoSpeed = 0; - p->TiltStatus = 0; - p->moto_drink = 0; - p->VBumpTarget = 0; - p->VBumpNow = 0; - p->TurbCount = 0; - p->posxv = 0; - p->posyv = 0; - p->posxv -= sintable[(p->getang()+512)&2047]<<7; - p->posyv -= sintable[p->getang()&2047]<<7; - p->moto_underwater = 0; - j = fi.spawn(p->i, EMPTYBIKE); - sprite[j].ang = p->getang(); - sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; - sprite[j].yvel += sintable[p->getang()&2047]<<7; - sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; - } + short j; + if (p->OnMotorcycle) + { + if (A_CheckSoundPlaying(p->i,188)) + S_StopEnvSound(188,p->i); + if (A_CheckSoundPlaying(p->i,187)) + S_StopEnvSound(187,p->i); + if (A_CheckSoundPlaying(p->i,186)) + S_StopEnvSound(186,p->i); + if (A_CheckSoundPlaying(p->i,214)) + S_StopEnvSound(214,p->i); + if (!A_CheckSoundPlaying(p->i,42)) + A_PlaySound(42, p->i); + p->OnMotorcycle = 0; + p->gotweapon.Clear(MOTORCYCLE_WEAPON); + p->curr_weapon = p->last_full_weapon; + checkavailweapon(p); + p->sethoriz(100); + p->moto_do_bump = 0; + p->MotoSpeed = 0; + p->TiltStatus = 0; + p->moto_drink = 0; + p->VBumpTarget = 0; + p->VBumpNow = 0; + p->TurbCount = 0; + p->posxv = 0; + p->posyv = 0; + p->posxv -= sintable[(p->getang()+512)&2047]<<7; + p->posyv -= sintable[p->getang()&2047]<<7; + p->moto_underwater = 0; + j = fi.spawn(p->i, EMPTYBIKE); + sprite[j].ang = p->getang(); + sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; + sprite[j].yvel += sintable[p->getang()&2047]<<7; + sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; + } } //--------------------------------------------------------------------------- @@ -4230,25 +4230,25 @@ void OffMotorcycle(struct player_struct *p) void OnBoat(struct player_struct *p, int boatsprite) { - if (!p->OnBoat) - { - if (boatsprite) - { - p->posx = sprite[boatsprite].x; - p->posy = sprite[boatsprite].y; - p->setang(sprite[boatsprite].ang); - p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner; - deletesprite(boatsprite); - } - p->over_shoulder_on = 0; - p->OnBoat = 1; - p->last_full_weapon = p->curr_weapon; - p->curr_weapon = BOAT_WEAPON; - p->gotweapon.Set(BOAT_WEAPON); - p->posxv = 0; - p->posyv = 0; - p->sethoriz(100); - } + if (!p->OnBoat) + { + if (boatsprite) + { + p->posx = sprite[boatsprite].x; + p->posy = sprite[boatsprite].y; + p->setang(sprite[boatsprite].ang); + p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner; + deletesprite(boatsprite); + } + p->over_shoulder_on = 0; + p->OnBoat = 1; + p->last_full_weapon = p->curr_weapon; + p->curr_weapon = BOAT_WEAPON; + p->gotweapon.Set(BOAT_WEAPON); + p->posxv = 0; + p->posyv = 0; + p->sethoriz(100); + } } //--------------------------------------------------------------------------- @@ -4259,32 +4259,32 @@ void OnBoat(struct player_struct *p, int boatsprite) void OffBoat(struct player_struct *p) { - short j; - if (p->OnBoat) - { - p->OnBoat = 0; - p->gotweapon.Clear(BOAT_WEAPON); - p->curr_weapon = p->last_full_weapon; - checkavailweapon(p); + short j; + if (p->OnBoat) + { + p->OnBoat = 0; + p->gotweapon.Clear(BOAT_WEAPON); + p->curr_weapon = p->last_full_weapon; + checkavailweapon(p); p->sethoriz(100); p->moto_do_bump = 0; p->MotoSpeed = 0; - p->TiltStatus = 0; - p->moto_drink = 0; - p->VBumpTarget = 0; - p->VBumpNow = 0; - p->TurbCount = 0; - p->posxv = 0; - p->posyv = 0; - p->posxv -= sintable[(p->getang()+512)&2047]<<7; - p->posyv -= sintable[p->getang()&2047]<<7; - p->moto_underwater = 0; - j = fi.spawn(p->i, EMPTYBOAT); - sprite[j].ang = p->getang(); - sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; - sprite[j].yvel += sintable[p->getang()&2047]<<7; - sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; - } + p->TiltStatus = 0; + p->moto_drink = 0; + p->VBumpTarget = 0; + p->VBumpNow = 0; + p->TurbCount = 0; + p->posxv = 0; + p->posyv = 0; + p->posxv -= sintable[(p->getang()+512)&2047]<<7; + p->posyv -= sintable[p->getang()&2047]<<7; + p->moto_underwater = 0; + j = fi.spawn(p->i, EMPTYBOAT); + sprite[j].ang = p->getang(); + sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; + sprite[j].yvel += sintable[p->getang()&2047]<<7; + sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; + } } diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index e18b7dad7..3b004a933 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -50,7 +50,7 @@ short myangbak[MOVEFIFOSIZ]; void resetmys() { - myx = omyx = ps[myconnectindex].posx; + myx = omyx = ps[myconnectindex].posx; myy = omyy = ps[myconnectindex].posy; myz = omyz = ps[myconnectindex].posz; myxvel = myyvel = myzvel = 0; @@ -60,472 +60,472 @@ void resetmys() mycursectnum = ps[myconnectindex].cursectnum; myjumpingcounter = ps[myconnectindex].jumping_counter; myjumpingtoggle = ps[myconnectindex].jumping_toggle; - myonground = ps[myconnectindex].on_ground; - myhardlanding = ps[myconnectindex].hard_landing; - myreturntocenter = ps[myconnectindex].return_to_center; + myonground = ps[myconnectindex].on_ground; + myhardlanding = ps[myconnectindex].hard_landing; + myreturntocenter = ps[myconnectindex].return_to_center; } #if 0 // todo: fix this when networking works again void fakedomovethingscorrect(void) { - int i; - struct player_struct *p; + int i; + struct player_struct *p; - if (numplayers < 2) return; + if (numplayers < 2) return; - i = ((movefifoplc-1)&(MOVEFIFOSIZ-1)); - p = &ps[myconnectindex]; + i = ((movefifoplc-1)&(MOVEFIFOSIZ-1)); + p = &ps[myconnectindex]; - if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] - && p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; + if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] + && p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; - myx = p->posx; omyx = p->oposx; myxvel = p->posxv; - myy = p->posy; omyy = p->oposy; myyvel = p->posyv; - myz = p->posz; omyz = p->oposz; myzvel = p->poszv; - myang = p->ang; omyang = p->oang; - mycursectnum = p->cursectnum; - myhoriz = p->horiz; omyhoriz = p->ohoriz; - myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff; - myjumpingcounter = p->jumping_counter; - myjumpingtoggle = p->jumping_toggle; - myonground = p->on_ground; - myhardlanding = p->hard_landing; - myreturntocenter = p->return_to_center; + myx = p->posx; omyx = p->oposx; myxvel = p->posxv; + myy = p->posy; omyy = p->oposy; myyvel = p->posyv; + myz = p->posz; omyz = p->oposz; myzvel = p->poszv; + myang = p->ang; omyang = p->oang; + mycursectnum = p->cursectnum; + myhoriz = p->horiz; omyhoriz = p->ohoriz; + myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff; + myjumpingcounter = p->jumping_counter; + myjumpingtoggle = p->jumping_toggle; + myonground = p->on_ground; + myhardlanding = p->hard_landing; + myreturntocenter = p->return_to_center; - fakemovefifoplc = movefifoplc; - while (fakemovefifoplc < movefifoend[myconnectindex]) - fakedomovethings(); + fakemovefifoplc = movefifoplc; + while (fakemovefifoplc < movefifoend[myconnectindex]) + fakedomovethings(); } void fakedomovethings(void) { - input *syn; - struct player_struct *p; - int i, j, k, doubvel, fz, cz, hz, lz, x, y; - ESyncBits sb_snum; - short psect, psectlotag, tempsect, backcstat; - uint8_t shrunk, spritebridge; + input *syn; + struct player_struct *p; + int i, j, k, doubvel, fz, cz, hz, lz, x, y; + ESyncBits sb_snum; + short psect, psectlotag, tempsect, backcstat; + uint8_t shrunk, spritebridge; - syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex]; + syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex]; - p = &ps[myconnectindex]; + p = &ps[myconnectindex]; - backcstat = sprite[p->i].cstat; - sprite[p->i].cstat &= ~257; + backcstat = sprite[p->i].cstat; + sprite[p->i].cstat &= ~257; - sb_snum = syn->bits; + sb_snum = syn->bits; - psect = mycursectnum; - psectlotag = sector[psect].lotag; - spritebridge = 0; + psect = mycursectnum; + psectlotag = sector[psect].lotag; + spritebridge = 0; - shrunk = (sprite[p->i].yrepeat < (isRR()? 8 : 32)); + shrunk = (sprite[p->i].yrepeat < (isRR()? 8 : 32)); - if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) ) - { - myx = omyx; - myy = omyy; - } - else - { - omyx = myx; - omyy = myy; - } + if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) ) + { + myx = omyx; + myy = omyy; + } + else + { + omyx = myx; + omyy = myy; + } - omyhoriz = myhoriz; - omyhorizoff = myhorizoff; - omyz = myz; - omyang = myang; + omyhoriz = myhoriz; + omyhorizoff = myhorizoff; + omyz = myz; + omyang = myang; - getzrange(myx,myy,myz,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0); + getzrange(myx,myy,myz,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0); - j = getflorzofslope(psect,myx,myy); + j = getflorzofslope(psect,myx,myy); - if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) ) - psectlotag = 0; + if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) ) + psectlotag = 0; - if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) - { - x = myx+(sintable[(myang+512)&2047]>>5); - y = myy+(sintable[myang&2047]>>5); - tempsect = psect; - updatesector(x,y,&tempsect); - if (tempsect >= 0) - { - k = getflorzofslope(psect,x,y); - if (psect == tempsect) - myhorizoff += mulscale16(j-k,160); - else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8)) - myhorizoff += mulscale16(j-k,160); - } - } - if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1); - else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1); + if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) + { + x = myx+(sintable[(myang+512)&2047]>>5); + y = myy+(sintable[myang&2047]>>5); + tempsect = psect; + updatesector(x,y,&tempsect); + if (tempsect >= 0) + { + k = getflorzofslope(psect,x,y); + if (psect == tempsect) + myhorizoff += mulscale16(j-k,160); + else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8)) + myhorizoff += mulscale16(j-k,160); + } + } + if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1); + else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1); - if(hz >= 0 && (hz&49152) == 49152) - { - hz &= (MAXSPRITES-1); - if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0) - { - hz = 0; - cz = getceilzofslope(psect,myx,myy); - } - } + if(hz >= 0 && (hz&49152) == 49152) + { + hz &= (MAXSPRITES-1); + if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0) + { + hz = 0; + cz = getceilzofslope(psect,myx,myy); + } + } - if(lz >= 0 && (lz&49152) == 49152) - { - j = lz&(MAXSPRITES-1); - if ((sprite[j].cstat&33) == 33) - { - psectlotag = 0; - spritebridge = 1; - } - if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) ) - { - j = getangle( sprite[j].x-myx,sprite[j].y-myy); - myxvel -= sintable[(j+512)&2047]<<4; - myyvel -= sintable[j&2047]<<4; - } - } + if(lz >= 0 && (lz&49152) == 49152) + { + j = lz&(MAXSPRITES-1); + if ((sprite[j].cstat&33) == 33) + { + psectlotag = 0; + spritebridge = 1; + } + if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) ) + { + j = getangle( sprite[j].x-myx,sprite[j].y-myy); + myxvel -= sintable[(j+512)&2047]<<4; + myyvel -= sintable[j&2047]<<4; + } + } - if( sprite[p->i].extra <= 0 ) - { - if( psectlotag == 2 ) - { - if(p->on_warping_sector == 0) - { - if( klabs(myz-fz) > (PHEIGHT>>1)) - myz += 348; - } - clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0); - } + if( sprite[p->i].extra <= 0 ) + { + if( psectlotag == 2 ) + { + if(p->on_warping_sector == 0) + { + if( klabs(myz-fz) > (PHEIGHT>>1)) + myz += 348; + } + clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0); + } - updatesector(myx,myy,&mycursectnum); - pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0); + updatesector(myx,myy,&mycursectnum); + pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0); - myhoriz = 100; - myhorizoff = 0; + myhoriz = 100; + myhorizoff = 0; - goto ENDFAKEPROCESSINPUT; - } + goto ENDFAKEPROCESSINPUT; + } - doubvel = TICSPERFRAME; + doubvel = TICSPERFRAME; - if(p->on_crane >= 0) goto FAKEHORIZONLY; + if(p->on_crane >= 0) goto FAKEHORIZONLY; - if(p->one_eighty_count < 0) myang += 128; + if(p->one_eighty_count < 0) myang += 128; - i = 40; + i = 40; - if( psectlotag == 2) - { - myjumpingcounter = 0; + if( psectlotag == 2) + { + myjumpingcounter = 0; - if ( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) ) - { - if(myzvel > 0) myzvel = 0; - myzvel -= 348; - if(myzvel < -(256*6)) myzvel = -(256*6); - } - else if ( (sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat) ) - { - if(myzvel < 0) myzvel = 0; - myzvel += 348; - if(myzvel > (256*6)) myzvel = (256*6); - } - else - { - if(myzvel < 0) - { - myzvel += 256; - if(myzvel > 0) - myzvel = 0; - } - if(myzvel > 0) - { - myzvel -= 256; - if(myzvel < 0) - myzvel = 0; - } - } + if ( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) ) + { + if(myzvel > 0) myzvel = 0; + myzvel -= 348; + if(myzvel < -(256*6)) myzvel = -(256*6); + } + else if ( (sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat) ) + { + if(myzvel < 0) myzvel = 0; + myzvel += 348; + if(myzvel > (256*6)) myzvel = (256*6); + } + else + { + if(myzvel < 0) + { + myzvel += 256; + if(myzvel > 0) + myzvel = 0; + } + if(myzvel > 0) + { + myzvel -= 256; + if(myzvel < 0) + myzvel = 0; + } + } - if(myzvel > 2048) myzvel >>= 1; + if(myzvel > 2048) myzvel >>= 1; - myz += myzvel; + myz += myzvel; - if(myz > (fz-(15<<8)) ) - myz += ((fz-(15<<8))-myz)>>1; + if(myz > (fz-(15<<8)) ) + myz += ((fz-(15<<8))-myz)>>1; - if(myz < (cz+(4<<8)) ) - { - myz = cz+(4<<8); - myzvel = 0; - } - } + if(myz < (cz+(4<<8)) ) + { + myz = cz+(4<<8); + myzvel = 0; + } + } - else if(p->jetpack_on) - { - myonground = 0; - myjumpingcounter = 0; - myhardlanding = 0; + else if(p->jetpack_on) + { + myonground = 0; + myjumpingcounter = 0; + myhardlanding = 0; - if(p->jetpack_on < 11) - myz -= (p->jetpack_on<<7); //Goin up + if(p->jetpack_on < 11) + myz -= (p->jetpack_on<<7); //Goin up - if(shrunk) j = 512; - else j = 2048; - - if ((sb_snum&1) && !(p->OnMotorcycle || p->OnBoat)) - myz -= j; - if ((sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat)) - myz += j; + if(shrunk) j = 512; + else j = 2048; + + if ((sb_snum&1) && !(p->OnMotorcycle || p->OnBoat)) + myz -= j; + if ((sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat)) + myz += j; - if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32; - else k = 16; + if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32; + else k = 16; - if(myz > (fz-(k<<8)) ) - myz += ((fz-(k<<8))-myz)>>1; - if(myz < (cz+(18<<8)) ) - myz = cz+(18<<8); - } - else if( psectlotag != 2 ) - { - if (psectlotag == 1 && p->spritebridge == 0) - { - if(shrunk == 0) i = 34; - else i = 12; - } - if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling - { - if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) ) - myz = fz-(i<<8); - else - { - myonground = 0; + if(myz > (fz-(k<<8)) ) + myz += ((fz-(k<<8))-myz)>>1; + if(myz < (cz+(18<<8)) ) + myz = cz+(18<<8); + } + else if( psectlotag != 2 ) + { + if (psectlotag == 1 && p->spritebridge == 0) + { + if(shrunk == 0) i = 34; + else i = 12; + } + if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling + { + if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) ) + myz = fz-(i<<8); + else + { + myonground = 0; - myzvel += (gc+80); + myzvel += (gc+80); - if(myzvel >= (4096+2048)) myzvel = (4096+2048); - } - } + if(myzvel >= (4096+2048)) myzvel = (4096+2048); + } + } - else - { - if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1)) - myhardlanding = myzvel>>10; - myonground = 1; + else + { + if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1)) + myhardlanding = myzvel>>10; + myonground = 1; - if(i==40) - { - //Smooth on the ground + if(i==40) + { + //Smooth on the ground - k = ((fz-(i<<8))-myz)>>1; - if( klabs(k) < 256 ) k = 0; - myz += k; // ((fz-(i<<8))-myz)>>1; - myzvel -= 768; // 412; - if(myzvel < 0) myzvel = 0; - } - else if(myjumpingcounter == 0) - { - myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water - if(p->on_warping_sector == 0 && myz > fz-(16<<8)) - { - myz = fz-(16<<8); - myzvel >>= 1; - } - } + k = ((fz-(i<<8))-myz)>>1; + if( klabs(k) < 256 ) k = 0; + myz += k; // ((fz-(i<<8))-myz)>>1; + myzvel -= 768; // 412; + if(myzvel < 0) myzvel = 0; + } + else if(myjumpingcounter == 0) + { + myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water + if(p->on_warping_sector == 0 && myz > fz-(16<<8)) + { + myz = fz-(16<<8); + myzvel >>= 1; + } + } - if( (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat) ) - myz += (2048+768); + if( (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat) ) + myz += (2048+768); - if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) - myjumpingtoggle = 0; + if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) + myjumpingtoggle = 0; - else if( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 0 ) - { - if( myjumpingcounter == 0 ) - if( (fz-cz) > (56<<8) ) - { - myjumpingcounter = 1; - myjumpingtoggle = 1; - } - } - if(!isRR() && myjumpingcounter && (sb_snum&1) == 0 ) - myjumpingcounter = 0; - } + else if( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 0 ) + { + if( myjumpingcounter == 0 ) + if( (fz-cz) > (56<<8) ) + { + myjumpingcounter = 1; + myjumpingtoggle = 1; + } + } + if(!isRR() && myjumpingcounter && (sb_snum&1) == 0 ) + myjumpingcounter = 0; + } - if(myjumpingcounter) - { - if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) - myjumpingtoggle = 0; + if(myjumpingcounter) + { + if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) + myjumpingtoggle = 0; - if( myjumpingcounter < (1024+256) ) - { - if(psectlotag == 1 && myjumpingcounter > 768) - { - myjumpingcounter = 0; - myzvel = -512; - } - else - { - myzvel -= (sintable[(2048-128+myjumpingcounter)&2047])/12; - myjumpingcounter += 180; + if( myjumpingcounter < (1024+256) ) + { + if(psectlotag == 1 && myjumpingcounter > 768) + { + myjumpingcounter = 0; + myzvel = -512; + } + else + { + myzvel -= (sintable[(2048-128+myjumpingcounter)&2047])/12; + myjumpingcounter += 180; - myonground = 0; - } - } - else - { - myjumpingcounter = 0; - myzvel = 0; - } - } + myonground = 0; + } + } + else + { + myjumpingcounter = 0; + myzvel = 0; + } + } - myz += myzvel; + myz += myzvel; - if(myz < (cz+(4<<8)) ) - { - myjumpingcounter = 0; - if(myzvel < 0) myxvel = myyvel = 0; - myzvel = 128; - myz = cz+(4<<8); - } + if(myz < (cz+(4<<8)) ) + { + myjumpingcounter = 0; + if(myzvel < 0) myxvel = myyvel = 0; + myzvel = 128; + myz = cz+(4<<8); + } - } + } - if (movementBlocked(snum) || myhardlanding) - { - doubvel = 0; - myxvel = 0; - myyvel = 0; - } - else if ( syn->avel ) //p->ang += syncangvel * constant - { //ENGINE calculates angvel for you - int tempang; + if (movementBlocked(snum) || myhardlanding) + { + doubvel = 0; + myxvel = 0; + myyvel = 0; + } + else if ( syn->avel ) //p->ang += syncangvel * constant + { //ENGINE calculates angvel for you + int tempang; - tempang = syn->avel<<1; + tempang = syn->avel<<1; - if(psectlotag == 2) - myang += (tempang-(tempang>>3))*sgn(doubvel); - else myang += (tempang)*sgn(doubvel); - myang &= 2047; - } + if(psectlotag == 2) + myang += (tempang-(tempang>>3))*sgn(doubvel); + else myang += (tempang)*sgn(doubvel); + myang &= 2047; + } - if ( myxvel || myyvel || syn->fvel || syn->svel ) - { - if(p->steroids_amount > 0 && p->steroids_amount < 400) - doubvel <<= 1; + if ( myxvel || myyvel || syn->fvel || syn->svel ) + { + if(p->steroids_amount > 0 && p->steroids_amount < 400) + doubvel <<= 1; - myxvel += ((syn->fvel*doubvel)<<6); - myyvel += ((syn->svel*doubvel)<<6); + myxvel += ((syn->fvel*doubvel)<<6); + myyvel += ((syn->svel*doubvel)<<6); - if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) ) - { - myxvel = mulscale16(myxvel,dukefriction-0x2000); - myyvel = mulscale16(myyvel,dukefriction-0x2000); - } - else - { - if(psectlotag == 2) - { - myxvel = mulscale16(myxvel,dukefriction-0x1400); - myyvel = mulscale16(myyvel,dukefriction-0x1400); - } - else - { - myxvel = mulscale16(myxvel,dukefriction); - myyvel = mulscale16(myyvel,dukefriction); - } - } + if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) ) + { + myxvel = mulscale16(myxvel,dukefriction-0x2000); + myyvel = mulscale16(myyvel,dukefriction-0x2000); + } + else + { + if(psectlotag == 2) + { + myxvel = mulscale16(myxvel,dukefriction-0x1400); + myyvel = mulscale16(myyvel,dukefriction-0x1400); + } + else + { + myxvel = mulscale16(myxvel,dukefriction); + myyvel = mulscale16(myyvel,dukefriction); + } + } - if( abs(myxvel) < 2048 && abs(myyvel) < 2048 ) - myxvel = myyvel = 0; + if( abs(myxvel) < 2048 && abs(myyvel) < 2048 ) + myxvel = myyvel = 0; - if( shrunk ) - { - myxvel = - mulscale16(myxvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); - myyvel = - mulscale16(myyvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); - } - } + if( shrunk ) + { + myxvel = + mulscale16(myxvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); + myyvel = + mulscale16(myyvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); + } + } FAKEHORIZONLY: - if(psectlotag == 1 || spritebridge == 1) i = (4L<<8); else i = (20L<<8); + if(psectlotag == 1 || spritebridge == 1) i = (4L<<8); else i = (20L<<8); - clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0); - pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0); + clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0); + pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0); - if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk) - myz += 30<<8; + if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk) + myz += 30<<8; - if ((sb_snum&(1<<18)) || myhardlanding) - myreturntocenter = 9; + if ((sb_snum&(1<<18)) || myhardlanding) + myreturntocenter = 9; - if (sb_snum&(1<<13)) - { - myreturntocenter = 9; - if (sb_snum&(1<<5)) myhoriz += 6; - myhoriz += 6; - } - else if (sb_snum&(1<<14)) - { - myreturntocenter = 9; - if (sb_snum&(1<<5)) myhoriz -= 6; - myhoriz -= 6; - } - else if ((sb_snum&(1<<3)) && !(p->OnMotorcycle || p->OnBoat)) - { - if (sb_snum&(1<<5)) myhoriz += 6; - myhoriz += 6; - } - else if ((sb_snum&(1<<4)) && !(p->OnMotorcycle || p->OnBoat)) - { - if (sb_snum&(1<<5)) myhoriz -= 6; - myhoriz -= 6; - } + if (sb_snum&(1<<13)) + { + myreturntocenter = 9; + if (sb_snum&(1<<5)) myhoriz += 6; + myhoriz += 6; + } + else if (sb_snum&(1<<14)) + { + myreturntocenter = 9; + if (sb_snum&(1<<5)) myhoriz -= 6; + myhoriz -= 6; + } + else if ((sb_snum&(1<<3)) && !(p->OnMotorcycle || p->OnBoat)) + { + if (sb_snum&(1<<5)) myhoriz += 6; + myhoriz += 6; + } + else if ((sb_snum&(1<<4)) && !(p->OnMotorcycle || p->OnBoat)) + { + if (sb_snum&(1<<5)) myhoriz -= 6; + myhoriz -= 6; + } - if (myreturntocenter > 0) - if ((sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0) - { - myreturntocenter--; - myhoriz += 33-(myhoriz/3); - } + if (myreturntocenter > 0) + if ((sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0) + { + myreturntocenter--; + myhoriz += 33-(myhoriz/3); + } - if(p->aim_mode) - myhoriz += syn->horz>>1; - else - { - if( myhoriz > 95 && myhoriz < 105) myhoriz = 100; - if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0; - } + if(p->aim_mode) + myhoriz += syn->horz>>1; + else + { + if( myhoriz > 95 && myhoriz < 105) myhoriz = 100; + if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0; + } - if (myhardlanding > 0) - { - myhardlanding--; - myhoriz -= (myhardlanding<<4); - } + if (myhardlanding > 0) + { + myhardlanding--; + myhoriz -= (myhardlanding<<4); + } - myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX); + myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX); - if(p->knee_incs > 0) - { - myhoriz -= 48; - myreturntocenter = 9; - } + if(p->knee_incs > 0) + { + myhoriz -= 48; + myreturntocenter = 9; + } ENDFAKEPROCESSINPUT: - myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx; - myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy; - myzbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myz; - myangbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myang; - myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz; - fakemovefifoplc++; + myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx; + myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy; + myzbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myz; + myangbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myang; + myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz; + fakemovefifoplc++; - sprite[p->i].cstat = backcstat; + sprite[p->i].cstat = backcstat; } #endif diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index c6e54ff8d..89583b526 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -41,7 +41,7 @@ BEGIN_DUKE_NS inline void tloadtile(int tilenum, int palnum = 0) { - assert(tilenum < MAXTILES); + assert(tilenum < MAXTILES); markTileForPrecache(tilenum, palnum); } @@ -53,118 +53,118 @@ inline void tloadtile(int tilenum, int palnum = 0) static void cachespritenum(int i) { - int maxc; - int j; + int maxc; + int j; int pal = sprite[i].pal; - if(ud.monsters_off && badguy(&sprite[i])) return; + if(ud.monsters_off && badguy(&sprite[i])) return; - maxc = 1; + maxc = 1; - switch(sprite[i].picnum) - { - case HYDRENT: - tloadtile(BROKEFIREHYDRENT); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) - tloadtile(j, pal); - break; - case TOILET: - tloadtile(TOILETBROKE); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) - tloadtile(j, pal); - break; - case STALL: - tloadtile(STALLBROKE); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) - tloadtile(j, pal); - break; - case RUBBERCAN: - maxc = 2; - break; - case TOILETWATER: - maxc = 4; - break; - case FEMPIC1: - maxc = 44; - break; - case LIZTROOP: - case LIZTROOPRUNNING: - case LIZTROOPSHOOT: - case LIZTROOPJETPACK: - case LIZTROOPONTOILET: - case LIZTROOPDUCKING: - for(j = LIZTROOP; j < (LIZTROOP+72); j++) - tloadtile(j, pal); - for(j=HEADJIB1;j 1) - { - maxc = 5; - for(j = 1420;j < 1420+106; j++) - tloadtile(j, pal); - } - break; - case ATOMICHEALTH: - maxc = 14; - break; - case DRONE: - maxc = 10; - break; - case EXPLODINGBARREL: - case SEENINE: - case OOZFILTER: - maxc = 3; - break; - case NUKEBARREL: - case CAMERA1: - maxc = 5; - break; - } + switch(sprite[i].picnum) + { + case HYDRENT: + tloadtile(BROKEFIREHYDRENT); + for(j = TOILETWATER; j < (TOILETWATER+4); j++) + tloadtile(j, pal); + break; + case TOILET: + tloadtile(TOILETBROKE); + for(j = TOILETWATER; j < (TOILETWATER+4); j++) + tloadtile(j, pal); + break; + case STALL: + tloadtile(STALLBROKE); + for(j = TOILETWATER; j < (TOILETWATER+4); j++) + tloadtile(j, pal); + break; + case RUBBERCAN: + maxc = 2; + break; + case TOILETWATER: + maxc = 4; + break; + case FEMPIC1: + maxc = 44; + break; + case LIZTROOP: + case LIZTROOPRUNNING: + case LIZTROOPSHOOT: + case LIZTROOPJETPACK: + case LIZTROOPONTOILET: + case LIZTROOPDUCKING: + for(j = LIZTROOP; j < (LIZTROOP+72); j++) + tloadtile(j, pal); + for(j=HEADJIB1;j 1) + { + maxc = 5; + for(j = 1420;j < 1420+106; j++) + tloadtile(j, pal); + } + break; + case ATOMICHEALTH: + maxc = 14; + break; + case DRONE: + maxc = 10; + break; + case EXPLODINGBARREL: + case SEENINE: + case OOZFILTER: + maxc = 3; + break; + case NUKEBARREL: + case CAMERA1: + maxc = 5; + break; + } - for(j = sprite[i].picnum; j < (sprite[i].picnum+maxc); j++) - tloadtile(j, pal); + for(j = sprite[i].picnum; j < (sprite[i].picnum+maxc); j++) + tloadtile(j, pal); } //--------------------------------------------------------------------------- @@ -175,51 +175,51 @@ static void cachespritenum(int i) static void cachegoodsprites(void) { - int i; + int i; - tloadtile(BOTTOMSTATUSBAR); - if (ud.multimode > 1) - { - tloadtile(FRAGBAR); - for (i = MINIFONT; i < MINIFONT + 63; i++) - tloadtile(i); - } + tloadtile(BOTTOMSTATUSBAR); + if (ud.multimode > 1) + { + tloadtile(FRAGBAR); + for (i = MINIFONT; i < MINIFONT + 63; i++) + tloadtile(i); + } - tloadtile(VIEWSCREEN); + tloadtile(VIEWSCREEN); - for(i=FOOTPRINTS;i= 0) - tloadtile(wall[i].overpicnum, wall[i].pal); - } + for (i = 0; i < numwalls; i++) + { + tloadtile(wall[i].picnum, wall[i].pal); + if (wall[i].overpicnum >= 0) + tloadtile(wall[i].overpicnum, wall[i].pal); + } - for (i = 0; i < numsectors; i++) - { - tloadtile(sector[i].floorpicnum, sector[i].floorpal); - tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal); - if (sector[i].ceilingpicnum == LA) - { - tloadtile(LA + 1); - tloadtile(LA + 2); - } - } + for (i = 0; i < numsectors; i++) + { + tloadtile(sector[i].floorpicnum, sector[i].floorpal); + tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal); + if (sector[i].ceilingpicnum == LA) + { + tloadtile(LA + 1); + tloadtile(LA + 2); + } + } - j = headspritesect[i]; - while (j >= 0) - { - if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat & 32768) == 0) - cachespritenum(j); - j = nextspritesect[j]; - } + j = headspritesect[i]; + while (j >= 0) + { + if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat & 32768) == 0) + cachespritenum(j); + j = nextspritesect[j]; + } - precacheMarkedTiles(); + precacheMarkedTiles(); } //--------------------------------------------------------------------------- @@ -271,240 +271,240 @@ void cacheit_d(void) void prelevel_d(int g) { - short i, nexti, j, startwall, endwall, lotaglist; - short lotags[65]; + short i, nexti, j, startwall, endwall, lotaglist; + short lotags[65]; - prelevel_common(g); + prelevel_common(g); - i = headspritestat[0]; - while (i >= 0) - { - nexti = nextspritestat[i]; + i = headspritestat[0]; + while (i >= 0) + { + nexti = nextspritestat[i]; - if (sprite[i].lotag == -1 && (sprite[i].cstat & 16)) - { - ps[0].exitx = sprite[i].x; - ps[0].exity = sprite[i].y; - } - else switch (sprite[i].picnum) - { - case GPSPEED: - sector[sprite[i].sectnum].extra = sprite[i].lotag; - deletesprite(i); - break; + if (sprite[i].lotag == -1 && (sprite[i].cstat & 16)) + { + ps[0].exitx = sprite[i].x; + ps[0].exity = sprite[i].y; + } + else switch (sprite[i].picnum) + { + case GPSPEED: + sector[sprite[i].sectnum].extra = sprite[i].lotag; + deletesprite(i); + break; - case CYCLER: - if (numcyclers >= MAXCYCLERS) - I_Error("Too many cycling sectors."); - cyclers[numcyclers][0] = sprite[i].sectnum; - cyclers[numcyclers][1] = sprite[i].lotag; - cyclers[numcyclers][2] = sprite[i].shade; - cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade; - cyclers[numcyclers][4] = sprite[i].hitag; - cyclers[numcyclers][5] = (sprite[i].ang == 1536); - numcyclers++; - deletesprite(i); - break; - } - i = nexti; - } + case CYCLER: + if (numcyclers >= MAXCYCLERS) + I_Error("Too many cycling sectors."); + cyclers[numcyclers][0] = sprite[i].sectnum; + cyclers[numcyclers][1] = sprite[i].lotag; + cyclers[numcyclers][2] = sprite[i].shade; + cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade; + cyclers[numcyclers][4] = sprite[i].hitag; + cyclers[numcyclers][5] = (sprite[i].ang == 1536); + numcyclers++; + deletesprite(i); + break; + } + i = nexti; + } - for (i = 0; i < MAXSPRITES; i++) - { - if (sprite[i].statnum < MAXSTATUS) - { - if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) - continue; - fi.spawn(-1, i); - } - } + for (i = 0; i < MAXSPRITES; i++) + { + if (sprite[i].statnum < MAXSTATUS) + { + if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) + continue; + fi.spawn(-1, i); + } + } - for (i = 0; i < MAXSPRITES; i++) - if (sprite[i].statnum < MAXSTATUS) - { - if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) - fi.spawn(-1, i); - } + for (i = 0; i < MAXSPRITES; i++) + if (sprite[i].statnum < MAXSTATUS) + { + if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) + fi.spawn(-1, i); + } - lotaglist = 0; + lotaglist = 0; - i = headspritestat[0]; - while (i >= 0) - { - switch (sprite[i].picnum) - { - case DIPSWITCH + 1: - case DIPSWITCH2 + 1: - case PULLSWITCH + 1: - case HANDSWITCH + 1: - case SLOTDOOR + 1: - case LIGHTSWITCH + 1: - case SPACELIGHTSWITCH + 1: - case SPACEDOORSWITCH + 1: - case FRANKENSTINESWITCH + 1: - case LIGHTSWITCH2 + 1: - case POWERSWITCH1 + 1: - case LOCKSWITCH1 + 1: - case POWERSWITCH2 + 1: - for (j = 0; j < lotaglist; j++) - if (sprite[i].lotag == lotags[j]) - break; + i = headspritestat[0]; + while (i >= 0) + { + switch (sprite[i].picnum) + { + case DIPSWITCH + 1: + case DIPSWITCH2 + 1: + case PULLSWITCH + 1: + case HANDSWITCH + 1: + case SLOTDOOR + 1: + case LIGHTSWITCH + 1: + case SPACELIGHTSWITCH + 1: + case SPACEDOORSWITCH + 1: + case FRANKENSTINESWITCH + 1: + case LIGHTSWITCH2 + 1: + case POWERSWITCH1 + 1: + case LOCKSWITCH1 + 1: + case POWERSWITCH2 + 1: + for (j = 0; j < lotaglist; j++) + if (sprite[i].lotag == lotags[j]) + break; - if (j == lotaglist) - { - lotags[lotaglist] = sprite[i].lotag; - lotaglist++; - if (lotaglist > 64) - I_Error("Too many switches (64 max)."); + if (j == lotaglist) + { + lotags[lotaglist] = sprite[i].lotag; + lotaglist++; + if (lotaglist > 64) + I_Error("Too many switches (64 max)."); - j = headspritestat[3]; - while (j >= 0) - { - if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag) - hittype[j].temp_data[0] = 1; - j = nextspritestat[j]; - } - } - break; - } - i = nextspritestat[i]; - } + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag) + hittype[j].temp_data[0] = 1; + j = nextspritestat[j]; + } + } + break; + } + i = nextspritestat[i]; + } - mirrorcnt = 0; + mirrorcnt = 0; - for (i = 0; i < numwalls; i++) - { - walltype* wal; - wal = &wall[i]; + for (i = 0; i < numwalls; i++) + { + walltype* wal; + wal = &wall[i]; - if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) - { - j = wal->nextsector; + if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) + { + j = wal->nextsector; - if (mirrorcnt > 63) - I_Error("Too many mirrors (64 max.)"); - if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) - { - sector[j].ceilingpicnum = MIRROR; - sector[j].floorpicnum = MIRROR; - mirrorwall[mirrorcnt] = i; - mirrorsector[mirrorcnt] = j; - mirrorcnt++; - continue; - } - } + if (mirrorcnt > 63) + I_Error("Too many mirrors (64 max.)"); + if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) + { + sector[j].ceilingpicnum = MIRROR; + sector[j].floorpicnum = MIRROR; + mirrorwall[mirrorcnt] = i; + mirrorsector[mirrorcnt] = j; + mirrorcnt++; + continue; + } + } - if (numanimwalls >= MAXANIMWALLS) - I_Error("Too many 'anim' walls (max 512.)"); + if (numanimwalls >= MAXANIMWALLS) + I_Error("Too many 'anim' walls (max 512.)"); - animwall[numanimwalls].tag = 0; - animwall[numanimwalls].wallnum = 0; + animwall[numanimwalls].tag = 0; + animwall[numanimwalls].wallnum = 0; - switch (wal->overpicnum) - { - case FANSHADOW: - case FANSPRITE: - wall->cstat |= 65; - animwall[numanimwalls].wallnum = i; - numanimwalls++; - break; + switch (wal->overpicnum) + { + case FANSHADOW: + case FANSPRITE: + wall->cstat |= 65; + animwall[numanimwalls].wallnum = i; + numanimwalls++; + break; - case W_FORCEFIELD: - for (j = 0; j < 3; j++) - tloadtile(W_FORCEFIELD + j); - case W_FORCEFIELD + 1: - case W_FORCEFIELD + 2: - if (wal->shade > 31) - wal->cstat = 0; - else wal->cstat |= 85 + 256; + case W_FORCEFIELD: + for (j = 0; j < 3; j++) + tloadtile(W_FORCEFIELD + j); + case W_FORCEFIELD + 1: + case W_FORCEFIELD + 2: + if (wal->shade > 31) + wal->cstat = 0; + else wal->cstat |= 85 + 256; - if (wal->lotag && wal->nextwall >= 0) - wall[wal->nextwall].lotag = wal->lotag; + if (wal->lotag && wal->nextwall >= 0) + wall[wal->nextwall].lotag = wal->lotag; - case BIGFORCE: + case BIGFORCE: - animwall[numanimwalls].wallnum = i; - numanimwalls++; + animwall[numanimwalls].wallnum = i; + numanimwalls++; - continue; - } + continue; + } - wal->extra = -1; + wal->extra = -1; - switch (wal->picnum) - { - case W_TECHWALL1: - case W_TECHWALL2: - case W_TECHWALL3: - case W_TECHWALL4: - animwall[numanimwalls].wallnum = i; - // animwall[numanimwalls].tag = -1; - numanimwalls++; - break; - case SCREENBREAK6: - case SCREENBREAK7: - case SCREENBREAK8: - for (j = SCREENBREAK6; j < SCREENBREAK9; j++) - tloadtile(j); - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = -1; - numanimwalls++; - break; + switch (wal->picnum) + { + case W_TECHWALL1: + case W_TECHWALL2: + case W_TECHWALL3: + case W_TECHWALL4: + animwall[numanimwalls].wallnum = i; + // animwall[numanimwalls].tag = -1; + numanimwalls++; + break; + case SCREENBREAK6: + case SCREENBREAK7: + case SCREENBREAK8: + for (j = SCREENBREAK6; j < SCREENBREAK9; j++) + tloadtile(j); + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = -1; + numanimwalls++; + break; - case FEMPIC1: - case FEMPIC2: - case FEMPIC3: + case FEMPIC1: + case FEMPIC2: + case FEMPIC3: - wal->extra = wal->picnum; - animwall[numanimwalls].tag = -1; - if (ud.lockout) - { - if (wal->picnum == FEMPIC1) - wal->picnum = BLANKSCREEN; - else wal->picnum = SCREENBREAK6; - } + wal->extra = wal->picnum; + animwall[numanimwalls].tag = -1; + if (ud.lockout) + { + if (wal->picnum == FEMPIC1) + wal->picnum = BLANKSCREEN; + else wal->picnum = SCREENBREAK6; + } - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = wal->picnum; - numanimwalls++; - break; + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = wal->picnum; + numanimwalls++; + break; - case SCREENBREAK1: - case SCREENBREAK2: - case SCREENBREAK3: - case SCREENBREAK4: - case SCREENBREAK5: + case SCREENBREAK1: + case SCREENBREAK2: + case SCREENBREAK3: + case SCREENBREAK4: + case SCREENBREAK5: - case SCREENBREAK9: - case SCREENBREAK10: - case SCREENBREAK11: - case SCREENBREAK12: - case SCREENBREAK13: - case SCREENBREAK14: - case SCREENBREAK15: - case SCREENBREAK16: - case SCREENBREAK17: - case SCREENBREAK18: - case SCREENBREAK19: + case SCREENBREAK9: + case SCREENBREAK10: + case SCREENBREAK11: + case SCREENBREAK12: + case SCREENBREAK13: + case SCREENBREAK14: + case SCREENBREAK15: + case SCREENBREAK16: + case SCREENBREAK17: + case SCREENBREAK18: + case SCREENBREAK19: - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = wal->picnum; - numanimwalls++; - break; - } - } + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = wal->picnum; + numanimwalls++; + break; + } + } - //Invalidate textures in sector behind mirror - for (i = 0; i < mirrorcnt; i++) - { - startwall = sector[mirrorsector[i]].wallptr; - endwall = startwall + sector[mirrorsector[i]].wallnum; - for (j = startwall; j < endwall; j++) - { - wall[j].picnum = MIRROR; - wall[j].overpicnum = MIRROR; - } - } + //Invalidate textures in sector behind mirror + for (i = 0; i < mirrorcnt; i++) + { + startwall = sector[mirrorsector[i]].wallptr; + endwall = startwall + sector[mirrorsector[i]].wallnum; + for (j = startwall; j < endwall; j++) + { + wall[j].picnum = MIRROR; + wall[j].overpicnum = MIRROR; + } + } } END_DUKE_NS \ No newline at end of file diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index acff54d44..6a80eb7a2 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -52,270 +52,270 @@ static inline void tloadtile(int tilenum, int palnum = 0) static void cachespritenum(short i) { - char maxc; - short j; - int pal = sprite[i].pal; + char maxc; + short j; + int pal = sprite[i].pal; - if (ud.monsters_off && badguy(&sprite[i])) return; + if (ud.monsters_off && badguy(&sprite[i])) return; - maxc = 1; + maxc = 1; - switch (sprite[i].picnum) - { - case HYDRENT: - tloadtile(BROKEFIREHYDRENT); - for (j = TOILETWATER; j < (TOILETWATER + 4); j++) - tloadtile(j, pal); - break; - case RRTILE2121: - case RRTILE2122: - tloadtile(sprite[i].picnum, pal); - break; - case TOILET: - tloadtile(TOILETBROKE); - for (j = TOILETWATER; j < (TOILETWATER + 4); j++) - tloadtile(j, pal); - break; - case STALL: - tloadtile(STALLBROKE); - for (j = TOILETWATER; j < (TOILETWATER + 4); j++) - tloadtile(j, pal); - break; - case FORCERIPPLE: - maxc = 9; - break; - case RUBBERCAN: - maxc = 2; - break; - case TOILETWATER: - maxc = 4; - break; - case BUBBASTAND: - for (j = BUBBASCRATCH; j <= (BUBBASCRATCH + 47); j++) - tloadtile(j, pal); - maxc = 0; - break; - case SBSWIPE: - if (isRRRA()) - for (j = SBSWIPE; j <= (SBSWIPE + 29); j++) - tloadtile(j, pal); - maxc = 0; - break; + switch (sprite[i].picnum) + { + case HYDRENT: + tloadtile(BROKEFIREHYDRENT); + for (j = TOILETWATER; j < (TOILETWATER + 4); j++) + tloadtile(j, pal); + break; + case RRTILE2121: + case RRTILE2122: + tloadtile(sprite[i].picnum, pal); + break; + case TOILET: + tloadtile(TOILETBROKE); + for (j = TOILETWATER; j < (TOILETWATER + 4); j++) + tloadtile(j, pal); + break; + case STALL: + tloadtile(STALLBROKE); + for (j = TOILETWATER; j < (TOILETWATER + 4); j++) + tloadtile(j, pal); + break; + case FORCERIPPLE: + maxc = 9; + break; + case RUBBERCAN: + maxc = 2; + break; + case TOILETWATER: + maxc = 4; + break; + case BUBBASTAND: + for (j = BUBBASCRATCH; j <= (BUBBASCRATCH + 47); j++) + tloadtile(j, pal); + maxc = 0; + break; + case SBSWIPE: + if (isRRRA()) + for (j = SBSWIPE; j <= (SBSWIPE + 29); j++) + tloadtile(j, pal); + maxc = 0; + break; - case COOT: - for (j = COOT; j <= (COOT + 217); j++) - tloadtile(j, pal); - for (j = COOTJIBA; j < COOTJIBC + 4; j++) - tloadtile(j, pal); - maxc = 0; - break; - case LTH: - maxc = 105; - for (j = LTH; j < (LTH + maxc); j++) - tloadtile(j, pal); - maxc = 0; - break; - case BILLYRAY: - maxc = 144; - for (j = BILLYWALK; j < (BILLYWALK + maxc); j++) - tloadtile(j, pal); - for (j = BILLYJIBA; j <= BILLYJIBB + 4; j++) - tloadtile(j, pal); - maxc = 0; - break; - case COW: - maxc = 56; - for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++) - tloadtile(j, pal); - maxc = 0; - break; - case DOGRUN: - for (j = DOGATTACK; j <= DOGATTACK + 35; j++) - tloadtile(j, pal); - for (j = DOGRUN; j <= DOGRUN + 80; j++) - tloadtile(j, pal); - maxc = 0; - break; - case RABBIT: - if (isRRRA()) - { - for (j = RABBIT; j <= RABBIT + 54; j++) - tloadtile(j, pal); - for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++) - tloadtile(j, pal); - for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case BIKERB: - case BIKERBV2: - if (isRRRA()) - { - for (j = BIKERB; j <= BIKERB + 104; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case BIKER: - if (isRRRA()) - { - for (j = BIKER; j <= BIKER + 116; j++) - tloadtile(j, pal); - for (j = BIKER + 150; j <= BIKER + 150 + 104; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case CHEER: - if (isRRRA()) - { - for (j = CHEER; j <= CHEER + 44; j++) - tloadtile(j, pal); - for (j = CHEER + 47; j <= CHEER + 47 + 211; j++) - tloadtile(j, pal); - for (j = CHEER + 262; j <= CHEER + 262 + 72; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case CHEERB: - if (isRRRA()) - { - for (j = CHEERB; j <= CHEERB + 83; j++) - tloadtile(j, pal); - for (j = CHEERB + 157; j <= CHEERB + 157 + 83; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case MAMA: - if (isRRRA()) - { - for (j = MAMA; j <= MAMA + 78; j++) - tloadtile(j, pal); - for (j = MAMA + 80; j <= MAMA + 80 + 7; j++) - tloadtile(j, pal); - for (j = MAMA + 90; j <= MAMA + 90 + 94; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case CHEERBOAT: - if (isRRRA()) - { - tloadtile(CHEERBOAT); - maxc = 0; - } - break; - case HULKBOAT: - if (isRRRA()) - { - tloadtile(HULKBOAT); - maxc = 0; - } - break; - case MINIONBOAT: - if (isRRRA()) - { - tloadtile(MINIONBOAT); - maxc = 0; - } - break; - case BILLYPLAY: - if (isRRRA()) - { - for (j = BILLYPLAY; j <= BILLYPLAY + 2; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case COOTPLAY: - if (isRRRA()) - { - for (j = COOTPLAY; j <= COOTPLAY + 4; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case PIG: - case PIGSTAYPUT: - maxc = 68; - break; - case TORNADO: - maxc = 7; - break; - case HEN: - case HENSTAND: - maxc = 34; - break; - case APLAYER: - maxc = 0; - if (ud.multimode > 1) - { - maxc = 5; - for (j = APLAYER; j < APLAYER + 220; j++) - tloadtile(j, pal); - for (j = DUKEGUN; j < DUKELEG + 4; j++) - tloadtile(j, pal); - } - break; - case ATOMICHEALTH: - maxc = 14; - break; - case DRONE: - maxc = 6; - break; - case EXPLODINGBARREL: - case SEENINE: - case OOZFILTER: - maxc = 3; - break; - case NUKEBARREL: - case CAMERA1: - maxc = 5; - break; - case VIXEN: - maxc = 214; - for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) - tloadtile(j, pal); - maxc = 0; - break; - case SBMOVE: - if (!isRRRA()) - { + case COOT: + for (j = COOT; j <= (COOT + 217); j++) + tloadtile(j, pal); + for (j = COOTJIBA; j < COOTJIBC + 4; j++) + tloadtile(j, pal); + maxc = 0; + break; + case LTH: + maxc = 105; + for (j = LTH; j < (LTH + maxc); j++) + tloadtile(j, pal); + maxc = 0; + break; + case BILLYRAY: + maxc = 144; + for (j = BILLYWALK; j < (BILLYWALK + maxc); j++) + tloadtile(j, pal); + for (j = BILLYJIBA; j <= BILLYJIBB + 4; j++) + tloadtile(j, pal); + maxc = 0; + break; + case COW: + maxc = 56; + for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++) + tloadtile(j, pal); + maxc = 0; + break; + case DOGRUN: + for (j = DOGATTACK; j <= DOGATTACK + 35; j++) + tloadtile(j, pal); + for (j = DOGRUN; j <= DOGRUN + 80; j++) + tloadtile(j, pal); + maxc = 0; + break; + case RABBIT: + if (isRRRA()) + { + for (j = RABBIT; j <= RABBIT + 54; j++) + tloadtile(j, pal); + for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++) + tloadtile(j, pal); + for (j = RABBIT + 56; j <= RABBIT + 56 + 49; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case BIKERB: + case BIKERBV2: + if (isRRRA()) + { + for (j = BIKERB; j <= BIKERB + 104; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case BIKER: + if (isRRRA()) + { + for (j = BIKER; j <= BIKER + 116; j++) + tloadtile(j, pal); + for (j = BIKER + 150; j <= BIKER + 150 + 104; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case CHEER: + if (isRRRA()) + { + for (j = CHEER; j <= CHEER + 44; j++) + tloadtile(j, pal); + for (j = CHEER + 47; j <= CHEER + 47 + 211; j++) + tloadtile(j, pal); + for (j = CHEER + 262; j <= CHEER + 262 + 72; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case CHEERB: + if (isRRRA()) + { + for (j = CHEERB; j <= CHEERB + 83; j++) + tloadtile(j, pal); + for (j = CHEERB + 157; j <= CHEERB + 157 + 83; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case MAMA: + if (isRRRA()) + { + for (j = MAMA; j <= MAMA + 78; j++) + tloadtile(j, pal); + for (j = MAMA + 80; j <= MAMA + 80 + 7; j++) + tloadtile(j, pal); + for (j = MAMA + 90; j <= MAMA + 90 + 94; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case CHEERBOAT: + if (isRRRA()) + { + tloadtile(CHEERBOAT); + maxc = 0; + } + break; + case HULKBOAT: + if (isRRRA()) + { + tloadtile(HULKBOAT); + maxc = 0; + } + break; + case MINIONBOAT: + if (isRRRA()) + { + tloadtile(MINIONBOAT); + maxc = 0; + } + break; + case BILLYPLAY: + if (isRRRA()) + { + for (j = BILLYPLAY; j <= BILLYPLAY + 2; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case COOTPLAY: + if (isRRRA()) + { + for (j = COOTPLAY; j <= COOTPLAY + 4; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case PIG: + case PIGSTAYPUT: + maxc = 68; + break; + case TORNADO: + maxc = 7; + break; + case HEN: + case HENSTAND: + maxc = 34; + break; + case APLAYER: + maxc = 0; + if (ud.multimode > 1) + { + maxc = 5; + for (j = APLAYER; j < APLAYER + 220; j++) + tloadtile(j, pal); + for (j = DUKEGUN; j < DUKELEG + 4; j++) + tloadtile(j, pal); + } + break; + case ATOMICHEALTH: + maxc = 14; + break; + case DRONE: + maxc = 6; + break; + case EXPLODINGBARREL: + case SEENINE: + case OOZFILTER: + maxc = 3; + break; + case NUKEBARREL: + case CAMERA1: + maxc = 5; + break; + case VIXEN: + maxc = 214; + for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) + tloadtile(j, pal); + maxc = 0; + break; + case SBMOVE: + if (!isRRRA()) + { - maxc = 54; - for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) - tloadtile(j, pal); - maxc = 100; - for (j = SBMOVE; j < SBMOVE + maxc; j++) - tloadtile(j, pal); - maxc = 0; - } - break; - case HULK: - maxc = 40; - for (j = sprite[i].picnum - 41; j < sprite[i].picnum + maxc - 41; j++) - tloadtile(j, pal); - for (j = HULKJIBA; j <= HULKJIBC + 4; j++) - tloadtile(j, pal); - maxc = 0; - break; - case MINION: - maxc = 141; - for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) - tloadtile(j, pal); - for (j = MINJIBA; j <= MINJIBC + 4; j++) - tloadtile(j, pal); - maxc = 0; - break; + maxc = 54; + for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) + tloadtile(j, pal); + maxc = 100; + for (j = SBMOVE; j < SBMOVE + maxc; j++) + tloadtile(j, pal); + maxc = 0; + } + break; + case HULK: + maxc = 40; + for (j = sprite[i].picnum - 41; j < sprite[i].picnum + maxc - 41; j++) + tloadtile(j, pal); + for (j = HULKJIBA; j <= HULKJIBC + 4; j++) + tloadtile(j, pal); + maxc = 0; + break; + case MINION: + maxc = 141; + for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++) + tloadtile(j, pal); + for (j = MINJIBA; j <= MINJIBC + 4; j++) + tloadtile(j, pal); + maxc = 0; + break; - } + } - for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++) - tloadtile(j, pal); + for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++) + tloadtile(j, pal); } //--------------------------------------------------------------------------- @@ -326,75 +326,75 @@ static void cachespritenum(short i) static void cachegoodsprites(void) { - short i; + short i; - tloadtile(BOTTOMSTATUSBAR); - if (ud.multimode > 1) - { - tloadtile(FRAGBAR); - } + tloadtile(BOTTOMSTATUSBAR); + if (ud.multimode > 1) + { + tloadtile(FRAGBAR); + } - //tloadtile(VIEWSCREEN); + //tloadtile(VIEWSCREEN); - for (i = FOOTPRINTS; i < FOOTPRINTS + 3; i++) - tloadtile(i); + for (i = FOOTPRINTS; i < FOOTPRINTS + 3; i++) + tloadtile(i); - for (i = BURNING; i < BURNING + 14; i++) - tloadtile(i); + for (i = BURNING; i < BURNING + 14; i++) + tloadtile(i); - for (i = FIRSTGUN; i < FIRSTGUN + 10; i++) - tloadtile(i); + for (i = FIRSTGUN; i < FIRSTGUN + 10; i++) + tloadtile(i); - for (i = EXPLOSION2; i < EXPLOSION2 + 21; i++) - tloadtile(i); + for (i = EXPLOSION2; i < EXPLOSION2 + 21; i++) + tloadtile(i); - tloadtile(BULLETHOLE); + tloadtile(BULLETHOLE); - for (i = SHOTGUN; i < SHOTGUN + 8; i++) - tloadtile(i); + for (i = SHOTGUN; i < SHOTGUN + 8; i++) + tloadtile(i); - tloadtile(FOOTPRINTS); + tloadtile(FOOTPRINTS); - for (i = JIBS1; i < (JIBS5 + 5); i++) - tloadtile(i); + for (i = JIBS1; i < (JIBS5 + 5); i++) + tloadtile(i); - for (i = SCRAP1; i < (SCRAP1 + 19); i++) - tloadtile(i); + for (i = SCRAP1; i < (SCRAP1 + 19); i++) + tloadtile(i); - for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++) - tloadtile(i); + for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++) + tloadtile(i); - if (isRRRA() && currentLevel->levelNumber == levelnum(0, 4)) - { - tloadtile(RRTILE2577); - } - if (!isRRRA() && currentLevel->levelNumber == levelnum(1, 2)) - { - tloadtile(RRTILE3190); - tloadtile(RRTILE3191); - tloadtile(RRTILE3192); - tloadtile(RRTILE3144); - tloadtile(RRTILE3139); - tloadtile(RRTILE3132); - tloadtile(RRTILE3120); - tloadtile(RRTILE3121); - tloadtile(RRTILE3122); - tloadtile(RRTILE3123); - tloadtile(RRTILE3124); - } - if (lastlevel) - { - i = isRRRA() ? UFO1_RRRA : UFO1_RR; - tloadtile(i); - i = UFO2; - tloadtile(i); - i = UFO3; - tloadtile(i); - i = UFO4; - tloadtile(i); - i = UFO5; - tloadtile(i); - } + if (isRRRA() && currentLevel->levelNumber == levelnum(0, 4)) + { + tloadtile(RRTILE2577); + } + if (!isRRRA() && currentLevel->levelNumber == levelnum(1, 2)) + { + tloadtile(RRTILE3190); + tloadtile(RRTILE3191); + tloadtile(RRTILE3192); + tloadtile(RRTILE3144); + tloadtile(RRTILE3139); + tloadtile(RRTILE3132); + tloadtile(RRTILE3120); + tloadtile(RRTILE3121); + tloadtile(RRTILE3122); + tloadtile(RRTILE3123); + tloadtile(RRTILE3124); + } + if (lastlevel) + { + i = isRRRA() ? UFO1_RRRA : UFO1_RR; + tloadtile(i); + i = UFO2; + tloadtile(i); + i = UFO3; + tloadtile(i); + i = UFO4; + tloadtile(i); + i = UFO5; + tloadtile(i); + } } //--------------------------------------------------------------------------- @@ -405,36 +405,36 @@ static void cachegoodsprites(void) void cacheit_r(void) { - short i,j; + short i,j; - cachegoodsprites(); + cachegoodsprites(); - for(i=0;i= 0) - tloadtile(wall[i].overpicnum, wall[i].pal); - } + for(i=0;i= 0) + tloadtile(wall[i].overpicnum, wall[i].pal); + } - for (i = 0; i < numsectors; i++) - { - tloadtile(sector[i].floorpicnum, sector[i].floorpal); - tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal); - if (sector[i].ceilingpicnum == LA) - { - tloadtile(LA + 1); - tloadtile(LA + 2); - } - } + for (i = 0; i < numsectors; i++) + { + tloadtile(sector[i].floorpicnum, sector[i].floorpal); + tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal); + if (sector[i].ceilingpicnum == LA) + { + tloadtile(LA + 1); + tloadtile(LA + 2); + } + } - j = headspritesect[i]; - while(j >= 0) - { - if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0) - cachespritenum(j); - j = nextspritesect[j]; - } - precacheMarkedTiles(); + j = headspritesect[i]; + while(j >= 0) + { + if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0) + cachespritenum(j); + j = nextspritesect[j]; + } + precacheMarkedTiles(); } //--------------------------------------------------------------------------- @@ -445,371 +445,371 @@ void cacheit_r(void) void prelevel_r(int g) { - struct player_struct* p; - short i; - short nexti; - short j; - short startwall; - short endwall; - short lotaglist; - short k; - short lotags[65]; - int speed; - int dist; - short sound; - sound = 0; + struct player_struct* p; + short i; + short nexti; + short j; + short startwall; + short endwall; + short lotaglist; + short k; + short lotags[65]; + int speed; + int dist; + short sound; + sound = 0; - prelevel_common(g); - p = &ps[screenpeek]; + prelevel_common(g); + p = &ps[screenpeek]; - if (isRRRA()) - { - if (currentLevel->levelNumber == levelnum(1, 4)) - ps[myconnectindex].steroids_amount = 0; + if (isRRRA()) + { + if (currentLevel->levelNumber == levelnum(1, 4)) + ps[myconnectindex].steroids_amount = 0; - for (j = 0; j < MAXSPRITES; j++) - { - if (sprite[j].pal == 100) - { - if (numplayers > 1) - deletesprite(j); - else - sprite[j].pal = 0; - } - else if (sprite[j].pal == 101) - { - sprite[j].extra = 0; - sprite[j].hitag = 1; - sprite[j].pal = 0; - changespritestat(j, 118); - } - } - } + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[j].pal == 100) + { + if (numplayers > 1) + deletesprite(j); + else + sprite[j].pal = 0; + } + else if (sprite[j].pal == 101) + { + sprite[j].extra = 0; + sprite[j].hitag = 1; + sprite[j].pal = 0; + changespritestat(j, 118); + } + } + } - for (i = 0; i < numsectors; i++) - { - if (sector[i].ceilingpicnum == RRTILE2577) - thunderon = 1; + for (i = 0; i < numsectors; i++) + { + if (sector[i].ceilingpicnum == RRTILE2577) + thunderon = 1; - switch (sector[i].lotag) - { - case 41: - k = headspritesect[i]; - while (k != -1) - { - nexti = nextspritesect[k]; - if (sprite[k].picnum == RRTILE11) - { - dist = sprite[k].lotag << 4; - speed = sprite[k].hitag; - deletesprite(k); - } - if (sprite[k].picnum == RRTILE38) - { - sound = sprite[k].lotag; - deletesprite(k); - } - k = nexti; - } - for (j = 0; j < numsectors; j++) - { - if (sector[i].hitag == sector[j].hitag && j != i) - { - addjaildoor(dist, speed, sector[i].hitag, sector[j].lotag, sound, j); - } - } - break; - case 42: - { - short ii; - int childsectnum = -1; - k = headspritesect[i]; - while (k != -1) - { - nexti = nextspritesect[k]; - if (sprite[k].picnum == RRTILE64) - { - dist = sprite[k].lotag << 4; - speed = sprite[k].hitag; - for (ii = 0; ii < MAXSPRITES; ii++) - { - if (sprite[ii].picnum == RRTILE66) - if (sprite[ii].lotag == sprite[k].sectnum) - { - childsectnum = sprite[ii].sectnum; - deletesprite(ii); - } - } - deletesprite(k); - } - if (sprite[k].picnum == RRTILE65) - { - sound = sprite[k].lotag; - deletesprite(k); - } - k = nexti; - } - addminecart(dist, speed, i, sector[i].hitag, sound, childsectnum); - break; - } - } - } + switch (sector[i].lotag) + { + case 41: + k = headspritesect[i]; + while (k != -1) + { + nexti = nextspritesect[k]; + if (sprite[k].picnum == RRTILE11) + { + dist = sprite[k].lotag << 4; + speed = sprite[k].hitag; + deletesprite(k); + } + if (sprite[k].picnum == RRTILE38) + { + sound = sprite[k].lotag; + deletesprite(k); + } + k = nexti; + } + for (j = 0; j < numsectors; j++) + { + if (sector[i].hitag == sector[j].hitag && j != i) + { + addjaildoor(dist, speed, sector[i].hitag, sector[j].lotag, sound, j); + } + } + break; + case 42: + { + short ii; + int childsectnum = -1; + k = headspritesect[i]; + while (k != -1) + { + nexti = nextspritesect[k]; + if (sprite[k].picnum == RRTILE64) + { + dist = sprite[k].lotag << 4; + speed = sprite[k].hitag; + for (ii = 0; ii < MAXSPRITES; ii++) + { + if (sprite[ii].picnum == RRTILE66) + if (sprite[ii].lotag == sprite[k].sectnum) + { + childsectnum = sprite[ii].sectnum; + deletesprite(ii); + } + } + deletesprite(k); + } + if (sprite[k].picnum == RRTILE65) + { + sound = sprite[k].lotag; + deletesprite(k); + } + k = nexti; + } + addminecart(dist, speed, i, sector[i].hitag, sound, childsectnum); + break; + } + } + } - i = headspritestat[0]; - while (i >= 0) - { - nexti = nextspritestat[i]; + i = headspritestat[0]; + while (i >= 0) + { + nexti = nextspritestat[i]; - if (sprite[i].lotag == -1 && (sprite[i].cstat & 16)) - { - ps[0].exitx = sprite[i].x; - ps[0].exity = sprite[i].y; - } - else switch (sprite[i].picnum) - { - case NUKEBUTTON: - chickenplant = 1; - break; + if (sprite[i].lotag == -1 && (sprite[i].cstat & 16)) + { + ps[0].exitx = sprite[i].x; + ps[0].exity = sprite[i].y; + } + else switch (sprite[i].picnum) + { + case NUKEBUTTON: + chickenplant = 1; + break; - case GPSPEED: - sector[sprite[i].sectnum].extra = sprite[i].lotag; - deletesprite(i); - break; + case GPSPEED: + sector[sprite[i].sectnum].extra = sprite[i].lotag; + deletesprite(i); + break; - case CYCLER: - if (numcyclers >= MAXCYCLERS) - I_Error("Too many cycling sectors."); - cyclers[numcyclers][0] = sprite[i].sectnum; - cyclers[numcyclers][1] = sprite[i].lotag; - cyclers[numcyclers][2] = sprite[i].shade; - cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade; - cyclers[numcyclers][4] = sprite[i].hitag; - cyclers[numcyclers][5] = (sprite[i].ang == 1536); - numcyclers++; - deletesprite(i); - break; + case CYCLER: + if (numcyclers >= MAXCYCLERS) + I_Error("Too many cycling sectors."); + cyclers[numcyclers][0] = sprite[i].sectnum; + cyclers[numcyclers][1] = sprite[i].lotag; + cyclers[numcyclers][2] = sprite[i].shade; + cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade; + cyclers[numcyclers][4] = sprite[i].hitag; + cyclers[numcyclers][5] = (sprite[i].ang == 1536); + numcyclers++; + deletesprite(i); + break; - case RRTILE18: - addtorch(i); - deletesprite(i); - break; + case RRTILE18: + addtorch(i); + deletesprite(i); + break; - case RRTILE35: - addlightning(i); - deletesprite(i); - break; + case RRTILE35: + addlightning(i); + deletesprite(i); + break; - case RRTILE68: - shadedsector[sprite[i].sectnum] = 1; - deletesprite(i); - break; + case RRTILE68: + shadedsector[sprite[i].sectnum] = 1; + deletesprite(i); + break; - case RRTILE67: - sprite[i].cstat |= 32768; - break; + case RRTILE67: + sprite[i].cstat |= 32768; + break; - case SOUNDFX: - if (ambientfx >= 64) - I_Error("Too many ambient effects"); - else - { - ambienthitag[ambientfx] = sprite[i].hitag; - ambientlotag[ambientfx] = sprite[i].lotag; - sprite[i].ang = ambientfx; - ambientfx++; - sprite[i].lotag = 0; - sprite[i].hitag = 0; - } - break; - } - i = nexti; - } + case SOUNDFX: + if (ambientfx >= 64) + I_Error("Too many ambient effects"); + else + { + ambienthitag[ambientfx] = sprite[i].hitag; + ambientlotag[ambientfx] = sprite[i].lotag; + sprite[i].ang = ambientfx; + ambientfx++; + sprite[i].lotag = 0; + sprite[i].hitag = 0; + } + break; + } + i = nexti; + } - for (i = 0; i < MAXSPRITES; i++) - { - if (sprite[i].picnum == RRTILE19) - { - if (geocnt > 64) - I_Error("Too many geometry effects"); - if (sprite[i].hitag == 0) - { - geosector[geocnt] = sprite[i].sectnum; - for (j = 0; j < MAXSPRITES; j++) - { - if (sprite[i].lotag == sprite[j].lotag && j != i && sprite[j].picnum == RRTILE19) - { - if (sprite[j].hitag == 1) - { - geosectorwarp[geocnt] = sprite[j].sectnum; - geox[geocnt] = sprite[i].x - sprite[j].x; - geoy[geocnt] = sprite[i].y - sprite[j].y; - //geoz[geocnt] = sprite[i].z - sprite[j].z; - } - if (sprite[j].hitag == 2) - { - geosectorwarp2[geocnt] = sprite[j].sectnum; - geox2[geocnt] = sprite[i].x - sprite[j].x; - geoy2[geocnt] = sprite[i].y - sprite[j].y; - //geoz2[geocnt] = sprite[i].z - sprite[j].z; - } - } - } - geocnt++; - } - } - } + for (i = 0; i < MAXSPRITES; i++) + { + if (sprite[i].picnum == RRTILE19) + { + if (geocnt > 64) + I_Error("Too many geometry effects"); + if (sprite[i].hitag == 0) + { + geosector[geocnt] = sprite[i].sectnum; + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[i].lotag == sprite[j].lotag && j != i && sprite[j].picnum == RRTILE19) + { + if (sprite[j].hitag == 1) + { + geosectorwarp[geocnt] = sprite[j].sectnum; + geox[geocnt] = sprite[i].x - sprite[j].x; + geoy[geocnt] = sprite[i].y - sprite[j].y; + //geoz[geocnt] = sprite[i].z - sprite[j].z; + } + if (sprite[j].hitag == 2) + { + geosectorwarp2[geocnt] = sprite[j].sectnum; + geox2[geocnt] = sprite[i].x - sprite[j].x; + geoy2[geocnt] = sprite[i].y - sprite[j].y; + //geoz2[geocnt] = sprite[i].z - sprite[j].z; + } + } + } + geocnt++; + } + } + } - for (i = 0; i < MAXSPRITES; i++) - { - if (sprite[i].statnum < MAXSTATUS) - { - if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) - continue; - fi.spawn(-1, i); - } - } + for (i = 0; i < MAXSPRITES; i++) + { + if (sprite[i].statnum < MAXSTATUS) + { + if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) + continue; + fi.spawn(-1, i); + } + } - for (i = 0; i < MAXSPRITES; i++) - { - if (sprite[i].statnum < MAXSTATUS) - { - if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) - fi.spawn(-1, i); - } - if (sprite[i].picnum == RRTILE19) - deletesprite(i); - if (sprite[i].picnum == RRTILE34) - { - sectorextra[sprite[i].sectnum] = sprite[i].lotag; - deletesprite(i); - } - } + for (i = 0; i < MAXSPRITES; i++) + { + if (sprite[i].statnum < MAXSTATUS) + { + if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) + fi.spawn(-1, i); + } + if (sprite[i].picnum == RRTILE19) + deletesprite(i); + if (sprite[i].picnum == RRTILE34) + { + sectorextra[sprite[i].sectnum] = sprite[i].lotag; + deletesprite(i); + } + } - lotaglist = 0; + lotaglist = 0; - i = headspritestat[0]; - while (i >= 0) - { - switch (sprite[i].picnum) - { - case RRTILE8464 + 1: - if (!isRRRA()) break; - case DIPSWITCH + 1: - case DIPSWITCH2 + 1: - case PULLSWITCH + 1: - case HANDSWITCH + 1: - case SLOTDOOR + 1: - case LIGHTSWITCH + 1: - case SPACELIGHTSWITCH + 1: - case SPACEDOORSWITCH + 1: - case FRANKENSTINESWITCH + 1: - case LIGHTSWITCH2 + 1: - case POWERSWITCH1 + 1: - case LOCKSWITCH1 + 1: - case POWERSWITCH2 + 1: - case NUKEBUTTON: - case NUKEBUTTON + 1: + i = headspritestat[0]; + while (i >= 0) + { + switch (sprite[i].picnum) + { + case RRTILE8464 + 1: + if (!isRRRA()) break; + case DIPSWITCH + 1: + case DIPSWITCH2 + 1: + case PULLSWITCH + 1: + case HANDSWITCH + 1: + case SLOTDOOR + 1: + case LIGHTSWITCH + 1: + case SPACELIGHTSWITCH + 1: + case SPACEDOORSWITCH + 1: + case FRANKENSTINESWITCH + 1: + case LIGHTSWITCH2 + 1: + case POWERSWITCH1 + 1: + case LOCKSWITCH1 + 1: + case POWERSWITCH2 + 1: + case NUKEBUTTON: + case NUKEBUTTON + 1: - for (j = 0; j < lotaglist; j++) - if (sprite[i].lotag == lotags[j]) - break; + for (j = 0; j < lotaglist; j++) + if (sprite[i].lotag == lotags[j]) + break; - if (j == lotaglist) - { - lotags[lotaglist] = sprite[i].lotag; - lotaglist++; - if (lotaglist > 64) - I_Error("Too many switches (64 max)."); + if (j == lotaglist) + { + lotags[lotaglist] = sprite[i].lotag; + lotaglist++; + if (lotaglist > 64) + I_Error("Too many switches (64 max)."); - j = headspritestat[3]; - while (j >= 0) - { - if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag) - hittype[j].temp_data[0] = 1; - j = nextspritestat[j]; - } - } - break; - } - i = nextspritestat[i]; - } + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag) + hittype[j].temp_data[0] = 1; + j = nextspritestat[j]; + } + } + break; + } + i = nextspritestat[i]; + } - mirrorcnt = 0; + mirrorcnt = 0; - for (i = 0; i < numwalls; i++) - { - walltype* wal; - wal = &wall[i]; + for (i = 0; i < numwalls; i++) + { + walltype* wal; + wal = &wall[i]; - if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) - { - j = wal->nextsector; + if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) + { + j = wal->nextsector; - if (mirrorcnt > 63) - I_Error("Too many mirrors (64 max.)"); - if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) - { - sector[j].ceilingpicnum = MIRROR; - sector[j].floorpicnum = MIRROR; - mirrorwall[mirrorcnt] = i; - mirrorsector[mirrorcnt] = j; - mirrorcnt++; - continue; - } - } + if (mirrorcnt > 63) + I_Error("Too many mirrors (64 max.)"); + if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) + { + sector[j].ceilingpicnum = MIRROR; + sector[j].floorpicnum = MIRROR; + mirrorwall[mirrorcnt] = i; + mirrorsector[mirrorcnt] = j; + mirrorcnt++; + continue; + } + } - if (numanimwalls >= MAXANIMWALLS) - I_Error("Too many 'anim' walls (max 512.)"); + if (numanimwalls >= MAXANIMWALLS) + I_Error("Too many 'anim' walls (max 512.)"); - animwall[numanimwalls].tag = 0; - animwall[numanimwalls].wallnum = 0; + animwall[numanimwalls].tag = 0; + animwall[numanimwalls].wallnum = 0; - switch (wal->overpicnum) - { - case FANSPRITE: - wall->cstat |= 65; - animwall[numanimwalls].wallnum = i; - numanimwalls++; - break; - case BIGFORCE: - animwall[numanimwalls].wallnum = i; - numanimwalls++; - continue; - } + switch (wal->overpicnum) + { + case FANSPRITE: + wall->cstat |= 65; + animwall[numanimwalls].wallnum = i; + numanimwalls++; + break; + case BIGFORCE: + animwall[numanimwalls].wallnum = i; + numanimwalls++; + continue; + } - wal->extra = -1; + wal->extra = -1; - switch (wal->picnum) - { - case SCREENBREAK6: - case SCREENBREAK7: - case SCREENBREAK8: - for (j = SCREENBREAK6; j <= SCREENBREAK8; j++) - tloadtile(j); - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = -1; - numanimwalls++; - break; - } - } + switch (wal->picnum) + { + case SCREENBREAK6: + case SCREENBREAK7: + case SCREENBREAK8: + for (j = SCREENBREAK6; j <= SCREENBREAK8; j++) + tloadtile(j); + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = -1; + numanimwalls++; + break; + } + } - //Invalidate textures in sector behind mirror - for (i = 0; i < mirrorcnt; i++) - { - startwall = sector[mirrorsector[i]].wallptr; - endwall = startwall + sector[mirrorsector[i]].wallnum; - for (j = startwall; j < endwall; j++) - { - wall[j].picnum = MIRROR; - wall[j].overpicnum = MIRROR; - } - } - thunder_brightness = 0; - if (!thunderon) - { - g_visibility = p->visibility; - } + //Invalidate textures in sector behind mirror + for (i = 0; i < mirrorcnt; i++) + { + startwall = sector[mirrorsector[i]].wallptr; + endwall = startwall + sector[mirrorsector[i]].wallnum; + for (j = startwall; j < endwall; j++) + { + wall[j].picnum = MIRROR; + wall[j].overpicnum = MIRROR; + } + } + thunder_brightness = 0; + if (!thunderon) + { + g_visibility = p->visibility; + } } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index f5f18d7c4..0c8bae4da 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -35,484 +35,484 @@ BEGIN_DUKE_NS static void recreateinterpolations() { - numinterpolations = 0; + numinterpolations = 0; - int k = headspritestat[STAT_EFFECTOR]; - while (k >= 0) - { - switch (sprite[k].lotag) - { - case SE_31_FLOOR_RISE_FALL: - setinterpolation(§or[sprite[k].sectnum].floorz); - break; - case SE_32_CEILING_RISE_FALL: - setinterpolation(§or[sprite[k].sectnum].ceilingz); - break; - case SE_17_WARP_ELEVATOR: - case SE_25_PISTON: - setinterpolation(§or[sprite[k].sectnum].floorz); - setinterpolation(§or[sprite[k].sectnum].ceilingz); - break; - case SE_0_ROTATING_SECTOR: - case SE_5_BOSS: - case SE_6_SUBWAY: - case SE_11_SWINGING_DOOR: - case SE_14_SUBWAY_CAR: - case SE_15_SLIDING_DOOR: - case SE_16_REACTOR: - case SE_26: - case SE_30_TWO_WAY_TRAIN: - setsectinterpolate(k); - break; - } + int k = headspritestat[STAT_EFFECTOR]; + while (k >= 0) + { + switch (sprite[k].lotag) + { + case SE_31_FLOOR_RISE_FALL: + setinterpolation(§or[sprite[k].sectnum].floorz); + break; + case SE_32_CEILING_RISE_FALL: + setinterpolation(§or[sprite[k].sectnum].ceilingz); + break; + case SE_17_WARP_ELEVATOR: + case SE_25_PISTON: + setinterpolation(§or[sprite[k].sectnum].floorz); + setinterpolation(§or[sprite[k].sectnum].ceilingz); + break; + case SE_0_ROTATING_SECTOR: + case SE_5_BOSS: + case SE_6_SUBWAY: + case SE_11_SWINGING_DOOR: + case SE_14_SUBWAY_CAR: + case SE_15_SLIDING_DOOR: + case SE_16_REACTOR: + case SE_26: + case SE_30_TWO_WAY_TRAIN: + setsectinterpolate(k); + break; + } - k = nextspritestat[k]; - } + k = nextspritestat[k]; + } - for (int i = numinterpolations - 1; i >= 0; i--) bakipos[i] = *curipos[i]; - for (int i = animatecnt - 1; i >= 0; i--) - setinterpolation(animateptr(i)); + for (int i = numinterpolations - 1; i >= 0; i--) bakipos[i] = *curipos[i]; + for (int i = animatecnt - 1; i >= 0; i--) + setinterpolation(animateptr(i)); } FSerializer& Serialize(FSerializer& arc, const char* keyname, animwalltype& w, animwalltype* def) { - if (arc.BeginObject(keyname)) - { - arc("wallnum", w.wallnum) - ("tag", w.tag) - .EndObject(); - } - return arc; + if (arc.BeginObject(keyname)) + { + arc("wallnum", w.wallnum) + ("tag", w.tag) + .EndObject(); + } + return arc; } FSerializer& Serialize(FSerializer& arc, const char* keyname, player_orig& w, player_orig* def) { - if (arc.BeginObject(keyname)) - { - arc("ox", w.ox) - ("oy", w.oy) - ("oz", w.oz) - ("oa", w.oa) - ("os", w.os) - .EndObject(); - } - return arc; + if (arc.BeginObject(keyname)) + { + arc("ox", w.ox) + ("oy", w.oy) + ("oz", w.oz) + ("oa", w.oa) + ("os", w.os) + .EndObject(); + } + return arc; } FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, player_struct* def) { - if (arc.BeginObject(keyname)) - { - arc("posx", w.posx) - ("posy", w.posy) - ("posz", w.posz) - ("q16ang", w.q16ang) - ("q16horiz", w.q16horiz) - ("q16horizoff", w.q16horizoff) - ("q16rotscrnang", w.q16rotscrnang) - ("q16look_ang", w.q16look_ang) - ("one_eighty_count", w.one_eighty_count) - ("gotweapon", w.gotweapon) - ("palette", w.palette) - ("pals", w.pals) - ("fricx", w.fric.x) - ("fricy", w.fric.y) - ("zoom", w.zoom) - ("exitx", w.exitx) - ("exity", w.exity) - ("numloogs", w.numloogs) - ("loogcnt", w.loogcnt) - .Array("loogiex", w.loogiex, w.numloogs) - .Array("loogiey", w.loogiey, w.numloogs) - ("bobposx", w.bobposx) - ("bobposy", w.bobposy) - ("pyoff", w.pyoff) - ("posxv", w.posxv) - ("posyv", w.posyv) - ("poszv", w.poszv) - ("last_pissed_time", w.last_pissed_time) - ("truefz", w.truefz) - ("truecz", w.truecz) - ("player_par", w.player_par) - ("visibility", w.visibility) - ("bobcounter", w.bobcounter) - ("weapon_sway", w.weapon_sway) - ("pals_time", w.pals_time) - ("randomflamex", w.randomflamex) - ("crack_time", w.crack_time) - ("aim.mode", w.aim_mode) - ("auto_aim", w.auto_aim) - ("weaponswitch", w.weaponswitch) - ("angvel", w.angvel) - ("cursectnum", w.cursectnum) - ("last_extra", w.last_extra) - ("subweapon", w.subweapon) - .Array("ammo_count", w.ammo_amount, MAX_WEAPONS) - ("wackedbyactor", w.wackedbyactor) - ("frag", w.frag) - ("fraggedself", w.fraggedself) - ("curr_weapon", w.curr_weapon) - ("last_weapon", w.last_weapon) - ("tipincs", w.tipincs) - ("wantweaponfire", w.wantweaponfire) - ("holoduke_amount", w.holoduke_amount) - ("newowner", w.newowner) - ("hurt_delay", w.hurt_delay) - ("hbomb_hold_delay", w.hbomb_hold_delay) - ("jumping_counter", w.jumping_counter) - ("airleft", w.airleft) - ("knee_incs", w.knee_incs) - ("access_incs", w.access_incs) - ("ftq", w.ftq) - ("access_wallnum", w.access_wallnum) - ("access_spritenum", w.access_spritenum) - ("kickback_pic", w.kickback_pic) - ("got_access", w.got_access) - ("weapon_ang", w.weapon_ang) - ("firstaid_amount", w.firstaid_amount) - ("somethingonplayer", w.somethingonplayer) - ("on_crane", w.on_crane) - ("i", w.i) - ("one_parallax_sectnum", w.one_parallax_sectnum) - ("over_shoulder_on", w.over_shoulder_on) - ("random_club_frame", w.random_club_frame) - ("fist_incs", w.fist_incs) - ("dummyplayersprite", w.dummyplayersprite) - ("extra_extra8", w.extra_extra8) - ("quick_kick", w.quick_kick) - ("heat_amount", w.heat_amount) - ("actorsqu", w.actorsqu) - ("timebeforeexit", w.timebeforeexit) - ("customexitsound", w.customexitsound) - ("weapreccnt", w.weapreccnt) - .Array("weaprecs", w.weaprecs, w.weapreccnt) - ("interface_toggle_flag", w.interface_toggle_flag) - ("dead_flag", w.dead_flag) - ("show_empty_weapon", w.show_empty_weapon) - ("scuba_amount", w.scuba_amount) - ("jetpack_amount", w.jetpack_amount) - ("steroids_amount", w.steroids_amount) - ("shield_amount", w.shield_amount) - ("holoduke_on", w.holoduke_on) - ("pycount", w.pycount) - ("weapon_pos", w.weapon_pos) - ("frag_ps", w.frag_ps) - ("transporter_hold", w.transporter_hold) - ("last_full_weapon", w.last_full_weapon) - ("footprintshade", w.footprintshade) - ("boot_amount", w.boot_amount) - ("scream_voice", w.scream_voice) - ("gm", w.gm) - ("on_warping_sector", w.on_warping_sector) - ("footprintcount", w.footprintcount) - ("hbomb_on", w.hbomb_on) - ("jumping_toggle", w.jumping_toggle) - ("rapid_fire_hold", w.rapid_fire_hold) - ("on_ground", w.on_ground) - .Array("name", w.name, 32) - ("inven_icon", w.inven_icon) - ("buttonpalette", w.buttonpalette) - ("jetpack_on", w.jetpack_on) - ("spritebridge", w.spritebridge) - ("lastrandomspot", w.lastrandomspot) - ("scuba_on", w.scuba_on) - ("footprintpal", w.footprintpal) - ("heat_on", w.heat_on) - ("holster_weapon", w.holster_weapon) - ("falling_counter", w.falling_counter) - ("refresh_inventory", w.refresh_inventory) - ("toggle_key_flag", w.toggle_key_flag) - ("knuckle_incs", w.knuckle_incs) - ("walking_snd_toggle", w.walking_snd_toggle) - ("palookup", w.palookup) - ("hard_landing", w.hard_landing) - ("return_to_center", w.return_to_center) - ("max_secret_rooms", w.max_secret_rooms) - ("secret_rooms", w.secret_rooms) - ("max_actors_killed", w.max_actors_killed) - ("actors_killed", w.actors_killed) - // RR from here on - ("stairs", w.stairs) - ("detonate_count", w.detonate_count) - ("noise_x", w.noise_x) - ("noise_y", w.noise_y) - ("noise_radius", w.noise_radius) - ("drink_timer", w.drink_timer) - ("eat_timer", w.eat_timer) - ("slotwin", w.SlotWin) - ("recoil", w.recoil) - ("detonate_time", w.detonate_time) - ("yehaa_timer", w.yehaa_timer) - ("drink_amt", w.drink_amt) - ("eat", w.eat) - ("drunkang", w.drunkang) - ("eatang", w.eatang) - .Array("shotgun_state", w.shotgun_state, 2) - ("donoise", w.donoise) - .Array("keys", w.keys, 5) - // RRRA from here on - ("drug_aspect", w.drug_aspect) - ("drug_timer", w.drug_timer) - ("seasick", w.SeaSick) - ("mamaend", w.MamaEnd) - ("motospeed", w.MotoSpeed) - ("moto_drink", w.moto_drink) - ("tiltstatus", w.TiltStatus) - ("vbumpnow", w.VBumpNow) - ("vbumptarget", w.VBumpTarget) - ("turbcount", w.TurbCount) - .Array("drug_stat", w.drug_stat, 3) - ("drugmode", w.DrugMode) - ("lotag800kill", w.lotag800kill) - ("sea_sick_stat", w.sea_sick_stat) - ("hurt_delay2", w.hurt_delay2) - ("nocheat", w.nocheat) - ("onmotorcycle", w.OnMotorcycle) - ("onboat", w.OnBoat) - ("moto_underwater", w.moto_underwater) - ("notonwater", w.NotOnWater) - ("motoonground", w.MotoOnGround) - ("moto_do_bump", w.moto_do_bump) - ("moto_bump_fast", w.moto_bump_fast) - ("moto_on_oil", w.moto_on_oil) - ("moto_on_mud", w.moto_on_mud) - // new stuff - ("crouch_toggle", w.crouch_toggle) - .EndObject(); + if (arc.BeginObject(keyname)) + { + arc("posx", w.posx) + ("posy", w.posy) + ("posz", w.posz) + ("q16ang", w.q16ang) + ("q16horiz", w.q16horiz) + ("q16horizoff", w.q16horizoff) + ("q16rotscrnang", w.q16rotscrnang) + ("q16look_ang", w.q16look_ang) + ("one_eighty_count", w.one_eighty_count) + ("gotweapon", w.gotweapon) + ("palette", w.palette) + ("pals", w.pals) + ("fricx", w.fric.x) + ("fricy", w.fric.y) + ("zoom", w.zoom) + ("exitx", w.exitx) + ("exity", w.exity) + ("numloogs", w.numloogs) + ("loogcnt", w.loogcnt) + .Array("loogiex", w.loogiex, w.numloogs) + .Array("loogiey", w.loogiey, w.numloogs) + ("bobposx", w.bobposx) + ("bobposy", w.bobposy) + ("pyoff", w.pyoff) + ("posxv", w.posxv) + ("posyv", w.posyv) + ("poszv", w.poszv) + ("last_pissed_time", w.last_pissed_time) + ("truefz", w.truefz) + ("truecz", w.truecz) + ("player_par", w.player_par) + ("visibility", w.visibility) + ("bobcounter", w.bobcounter) + ("weapon_sway", w.weapon_sway) + ("pals_time", w.pals_time) + ("randomflamex", w.randomflamex) + ("crack_time", w.crack_time) + ("aim.mode", w.aim_mode) + ("auto_aim", w.auto_aim) + ("weaponswitch", w.weaponswitch) + ("angvel", w.angvel) + ("cursectnum", w.cursectnum) + ("last_extra", w.last_extra) + ("subweapon", w.subweapon) + .Array("ammo_count", w.ammo_amount, MAX_WEAPONS) + ("wackedbyactor", w.wackedbyactor) + ("frag", w.frag) + ("fraggedself", w.fraggedself) + ("curr_weapon", w.curr_weapon) + ("last_weapon", w.last_weapon) + ("tipincs", w.tipincs) + ("wantweaponfire", w.wantweaponfire) + ("holoduke_amount", w.holoduke_amount) + ("newowner", w.newowner) + ("hurt_delay", w.hurt_delay) + ("hbomb_hold_delay", w.hbomb_hold_delay) + ("jumping_counter", w.jumping_counter) + ("airleft", w.airleft) + ("knee_incs", w.knee_incs) + ("access_incs", w.access_incs) + ("ftq", w.ftq) + ("access_wallnum", w.access_wallnum) + ("access_spritenum", w.access_spritenum) + ("kickback_pic", w.kickback_pic) + ("got_access", w.got_access) + ("weapon_ang", w.weapon_ang) + ("firstaid_amount", w.firstaid_amount) + ("somethingonplayer", w.somethingonplayer) + ("on_crane", w.on_crane) + ("i", w.i) + ("one_parallax_sectnum", w.one_parallax_sectnum) + ("over_shoulder_on", w.over_shoulder_on) + ("random_club_frame", w.random_club_frame) + ("fist_incs", w.fist_incs) + ("dummyplayersprite", w.dummyplayersprite) + ("extra_extra8", w.extra_extra8) + ("quick_kick", w.quick_kick) + ("heat_amount", w.heat_amount) + ("actorsqu", w.actorsqu) + ("timebeforeexit", w.timebeforeexit) + ("customexitsound", w.customexitsound) + ("weapreccnt", w.weapreccnt) + .Array("weaprecs", w.weaprecs, w.weapreccnt) + ("interface_toggle_flag", w.interface_toggle_flag) + ("dead_flag", w.dead_flag) + ("show_empty_weapon", w.show_empty_weapon) + ("scuba_amount", w.scuba_amount) + ("jetpack_amount", w.jetpack_amount) + ("steroids_amount", w.steroids_amount) + ("shield_amount", w.shield_amount) + ("holoduke_on", w.holoduke_on) + ("pycount", w.pycount) + ("weapon_pos", w.weapon_pos) + ("frag_ps", w.frag_ps) + ("transporter_hold", w.transporter_hold) + ("last_full_weapon", w.last_full_weapon) + ("footprintshade", w.footprintshade) + ("boot_amount", w.boot_amount) + ("scream_voice", w.scream_voice) + ("gm", w.gm) + ("on_warping_sector", w.on_warping_sector) + ("footprintcount", w.footprintcount) + ("hbomb_on", w.hbomb_on) + ("jumping_toggle", w.jumping_toggle) + ("rapid_fire_hold", w.rapid_fire_hold) + ("on_ground", w.on_ground) + .Array("name", w.name, 32) + ("inven_icon", w.inven_icon) + ("buttonpalette", w.buttonpalette) + ("jetpack_on", w.jetpack_on) + ("spritebridge", w.spritebridge) + ("lastrandomspot", w.lastrandomspot) + ("scuba_on", w.scuba_on) + ("footprintpal", w.footprintpal) + ("heat_on", w.heat_on) + ("holster_weapon", w.holster_weapon) + ("falling_counter", w.falling_counter) + ("refresh_inventory", w.refresh_inventory) + ("toggle_key_flag", w.toggle_key_flag) + ("knuckle_incs", w.knuckle_incs) + ("walking_snd_toggle", w.walking_snd_toggle) + ("palookup", w.palookup) + ("hard_landing", w.hard_landing) + ("return_to_center", w.return_to_center) + ("max_secret_rooms", w.max_secret_rooms) + ("secret_rooms", w.secret_rooms) + ("max_actors_killed", w.max_actors_killed) + ("actors_killed", w.actors_killed) + // RR from here on + ("stairs", w.stairs) + ("detonate_count", w.detonate_count) + ("noise_x", w.noise_x) + ("noise_y", w.noise_y) + ("noise_radius", w.noise_radius) + ("drink_timer", w.drink_timer) + ("eat_timer", w.eat_timer) + ("slotwin", w.SlotWin) + ("recoil", w.recoil) + ("detonate_time", w.detonate_time) + ("yehaa_timer", w.yehaa_timer) + ("drink_amt", w.drink_amt) + ("eat", w.eat) + ("drunkang", w.drunkang) + ("eatang", w.eatang) + .Array("shotgun_state", w.shotgun_state, 2) + ("donoise", w.donoise) + .Array("keys", w.keys, 5) + // RRRA from here on + ("drug_aspect", w.drug_aspect) + ("drug_timer", w.drug_timer) + ("seasick", w.SeaSick) + ("mamaend", w.MamaEnd) + ("motospeed", w.MotoSpeed) + ("moto_drink", w.moto_drink) + ("tiltstatus", w.TiltStatus) + ("vbumpnow", w.VBumpNow) + ("vbumptarget", w.VBumpTarget) + ("turbcount", w.TurbCount) + .Array("drug_stat", w.drug_stat, 3) + ("drugmode", w.DrugMode) + ("lotag800kill", w.lotag800kill) + ("sea_sick_stat", w.sea_sick_stat) + ("hurt_delay2", w.hurt_delay2) + ("nocheat", w.nocheat) + ("onmotorcycle", w.OnMotorcycle) + ("onboat", w.OnBoat) + ("moto_underwater", w.moto_underwater) + ("notonwater", w.NotOnWater) + ("motoonground", w.MotoOnGround) + ("moto_do_bump", w.moto_do_bump) + ("moto_bump_fast", w.moto_bump_fast) + ("moto_on_oil", w.moto_on_oil) + ("moto_on_mud", w.moto_on_mud) + // new stuff + ("crouch_toggle", w.crouch_toggle) + .EndObject(); - w.invdisptime = 0; - w.oq16ang = w.q16ang; - w.oq16horiz = w.q16horiz; - w.oq16horizoff = w.q16horizoff; - w.oq16rotscrnang = w.q16rotscrnang; - w.oposx = w.posx; - w.oposy = w.posy; - w.oposz = w.posz; - w.opyoff = w.pyoff; - w.horizAngleAdjust = 0; - w.horizSkew = 0; - w.lookLeft = false; - w.lookRight = false; - } - return arc; + w.invdisptime = 0; + w.oq16ang = w.q16ang; + w.oq16horiz = w.q16horiz; + w.oq16horizoff = w.q16horizoff; + w.oq16rotscrnang = w.q16rotscrnang; + w.oposx = w.posx; + w.oposy = w.posy; + w.oposz = w.posz; + w.opyoff = w.pyoff; + w.horizAngleAdjust = 0; + w.horizSkew = 0; + w.lookLeft = false; + w.lookRight = false; + } + return arc; } FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weaponhit* def) { - if (arc.BeginObject(keyname)) - { - arc("cgg", w.cgg) - ("picnum", w.picnum) - ("ang", w.ang) - ("extra", w.extra) - ("owner", w.owner) - ("movflag", w.movflag) - ("tempang", w.tempang) - ("actorstayput", w.actorstayput) - ("dispicnum", w.dispicnum) - ("timetosleep", w.timetosleep) - ("floorz", w.floorz) - ("ceilingz", w.ceilingz) - ("lastvx", w.lastvx) - ("lastvy", w.lastvy) - ("bposx", w.bposx) - ("bposy", w.bposy) - ("bposz", w.bposz) - ("aflags", w.aflags) - .Array("temp_data", w.temp_data, 6) - .EndObject(); - } - return arc; + if (arc.BeginObject(keyname)) + { + arc("cgg", w.cgg) + ("picnum", w.picnum) + ("ang", w.ang) + ("extra", w.extra) + ("owner", w.owner) + ("movflag", w.movflag) + ("tempang", w.tempang) + ("actorstayput", w.actorstayput) + ("dispicnum", w.dispicnum) + ("timetosleep", w.timetosleep) + ("floorz", w.floorz) + ("ceilingz", w.ceilingz) + ("lastvx", w.lastvx) + ("lastvy", w.lastvy) + ("bposx", w.bposx) + ("bposy", w.bposy) + ("bposz", w.bposz) + ("aflags", w.aflags) + .Array("temp_data", w.temp_data, 6) + .EndObject(); + } + return arc; } void SerializeGlobals(FSerializer& arc) { - if (arc.isReading()) - { - memset(sectorextra, 0, sizeof(sectorextra)); - memset(spriteextra, 0, sizeof(spriteextra)); - memset(shadedsector, 0, sizeof(shadedsector)); - memset(geosectorwarp, -1, sizeof(geosectorwarp)); - memset(geosectorwarp2, -1, sizeof(geosectorwarp2)); - memset(ambienthitag, -1, sizeof(ambienthitag)); - memset(ambientlotag, -1, sizeof(ambientlotag)); - } - if (arc.BeginObject("globals")) - { - arc("multimode", ud.multimode); - if (ud.multimode > 1) arc.Array("frags", &frags[0][0], MAXPLAYERS * MAXPLAYERS); - arc("skill", ud.player_skill) + if (arc.isReading()) + { + memset(sectorextra, 0, sizeof(sectorextra)); + memset(spriteextra, 0, sizeof(spriteextra)); + memset(shadedsector, 0, sizeof(shadedsector)); + memset(geosectorwarp, -1, sizeof(geosectorwarp)); + memset(geosectorwarp2, -1, sizeof(geosectorwarp2)); + memset(ambienthitag, -1, sizeof(ambienthitag)); + memset(ambientlotag, -1, sizeof(ambientlotag)); + } + if (arc.BeginObject("globals")) + { + arc("multimode", ud.multimode); + if (ud.multimode > 1) arc.Array("frags", &frags[0][0], MAXPLAYERS * MAXPLAYERS); + arc("skill", ud.player_skill) - ("from_bonus", ud.from_bonus) - ("secretlevel", ud.secretlevel) - ("respawn_monsters", ud.respawn_monsters) - ("respawn_items", ud.respawn_items) - ("respawn_inventory", ud.respawn_inventory) - ("god", ud.god) - //("auto_run", ud.auto_run) - ("monsters_off", ud.monsters_off) - ("last_level", ud.last_level) - ("eog", ud.eog) - ("coop", ud.coop) - ("marker", ud.marker) - ("ffire", ud.ffire) + ("from_bonus", ud.from_bonus) + ("secretlevel", ud.secretlevel) + ("respawn_monsters", ud.respawn_monsters) + ("respawn_items", ud.respawn_items) + ("respawn_inventory", ud.respawn_inventory) + ("god", ud.god) + //("auto_run", ud.auto_run) + ("monsters_off", ud.monsters_off) + ("last_level", ud.last_level) + ("eog", ud.eog) + ("coop", ud.coop) + ("marker", ud.marker) + ("ffire", ud.ffire) - .Array("spriteextra", spriteextra, MAXSPRITES) - .Array("weaponhit", hittype, MAXSPRITES) - .Array("sectorextra", sectorextra, numsectors) - ("rtsplaying", rtsplaying) - ("tempwallptr", tempwallptr) - ("sound445done", sound445done) - ("leveltexttime", levelTextTime) - .Array("players", ps, ud.multimode) - ("spriteqamount", spriteqamount) - .Array("shadedsector", shadedsector, numsectors) - ("lastvisinc", lastvisinc) - ("numanimwalls", numanimwalls) - .Array("animwall", animwall, numanimwalls) - ("camsprite", camsprite) - ("earthquaketime", earthquaketime) - ("freezerhurtowner", freezerhurtowner) - ("global_random", global_random) - ("impact_damage", impact_damage) - ("numplayersprites", numplayersprites) - ("spriteqloc", spriteqloc) - ("animatecnt", animatecnt) + .Array("spriteextra", spriteextra, MAXSPRITES) + .Array("weaponhit", hittype, MAXSPRITES) + .Array("sectorextra", sectorextra, numsectors) + ("rtsplaying", rtsplaying) + ("tempwallptr", tempwallptr) + ("sound445done", sound445done) + ("leveltexttime", levelTextTime) + .Array("players", ps, ud.multimode) + ("spriteqamount", spriteqamount) + .Array("shadedsector", shadedsector, numsectors) + ("lastvisinc", lastvisinc) + ("numanimwalls", numanimwalls) + .Array("animwall", animwall, numanimwalls) + ("camsprite", camsprite) + ("earthquaketime", earthquaketime) + ("freezerhurtowner", freezerhurtowner) + ("global_random", global_random) + ("impact_damage", impact_damage) + ("numplayersprites", numplayersprites) + ("spriteqloc", spriteqloc) + ("animatecnt", animatecnt) - .Array("animatesect", animatesect, animatecnt) - .Array("animatetype", animatetype, animatecnt) - .Array("animatetarget", animatetarget, animatecnt) - .Array("animategoal", animategoal, animatecnt) - .Array("animatevel", animatevel, animatecnt) + .Array("animatesect", animatesect, animatecnt) + .Array("animatetype", animatetype, animatecnt) + .Array("animatetarget", animatetarget, animatecnt) + .Array("animategoal", animategoal, animatecnt) + .Array("animatevel", animatevel, animatecnt) - ("numclouds", numclouds) - ("cloudx", cloudx) - ("cloudy", cloudy) - ("cloudtotalclock", cloudtotalclock) - .Array("clouds", clouds, numclouds) + ("numclouds", numclouds) + ("cloudx", cloudx) + ("cloudy", cloudy) + ("cloudtotalclock", cloudtotalclock) + .Array("clouds", clouds, numclouds) - .Array("spriteq", spriteq, 1024) - ("numcyclers", numcyclers) - .Array("cyclers", &cyclers[0][0], 6 * numcyclers) - ("mirrorcnt", mirrorcnt) - .Array("mirrorsector", mirrorsector, mirrorcnt) - .Array("mirrorwall", mirrorwall, mirrorcnt) - ("lockclock", lockclock) - ("wupass", wupass) - ("chickenplant", chickenplant) - ("thunderon", thunderon) - ("ufospawn", ufospawn) - ("ufocnt", ufocnt) - ("hulkspawn", hulkspawn) - ("lastlevel", lastlevel) - ("geocnt", geocnt) - .Array("geosectorwarp", geosectorwarp, geocnt) - .Array("geosectorwarp2", geosectorwarp2, geocnt) - .Array("geosector", geosector, geocnt) - .Array("geox", geox, geocnt) - .Array("geoy", geoy, geocnt) - .Array("geox2", geox2, geocnt) - .Array("geoy2", geoy2, geocnt) - ("ambientfx", ambientfx) - .Array("ambientlotag", ambientlotag, ambientfx) - .Array("ambienthitag", ambienthitag, ambientfx) - .Array("msx", msx, MAXANIMPOINTS) - .Array("msy", msy, MAXANIMPOINTS) - ("windtime", WindTime) - ("winddir", WindDir) - ("fakebubba_spawn", fakebubba_spawn) - ("mamaspawn_count", mamaspawn_count) - ("banjosound", banjosound) - ("belltime", BellTime) - ("bellsprite", BellSprite) - ("enemysizecheat", enemysizecheat) - ("ufospawnsminion", ufospawnsminion) - ("pistonsound", pistonsound) - ("chickenphase", chickenphase) - ("RRRA_ExitedLevel", RRRA_ExitedLevel) - ("fogactive", fogactive) - ("thunder_brightness", thunder_brightness) + .Array("spriteq", spriteq, 1024) + ("numcyclers", numcyclers) + .Array("cyclers", &cyclers[0][0], 6 * numcyclers) + ("mirrorcnt", mirrorcnt) + .Array("mirrorsector", mirrorsector, mirrorcnt) + .Array("mirrorwall", mirrorwall, mirrorcnt) + ("lockclock", lockclock) + ("wupass", wupass) + ("chickenplant", chickenplant) + ("thunderon", thunderon) + ("ufospawn", ufospawn) + ("ufocnt", ufocnt) + ("hulkspawn", hulkspawn) + ("lastlevel", lastlevel) + ("geocnt", geocnt) + .Array("geosectorwarp", geosectorwarp, geocnt) + .Array("geosectorwarp2", geosectorwarp2, geocnt) + .Array("geosector", geosector, geocnt) + .Array("geox", geox, geocnt) + .Array("geoy", geoy, geocnt) + .Array("geox2", geox2, geocnt) + .Array("geoy2", geoy2, geocnt) + ("ambientfx", ambientfx) + .Array("ambientlotag", ambientlotag, ambientfx) + .Array("ambienthitag", ambienthitag, ambientfx) + .Array("msx", msx, MAXANIMPOINTS) + .Array("msy", msy, MAXANIMPOINTS) + ("windtime", WindTime) + ("winddir", WindDir) + ("fakebubba_spawn", fakebubba_spawn) + ("mamaspawn_count", mamaspawn_count) + ("banjosound", banjosound) + ("belltime", BellTime) + ("bellsprite", BellSprite) + ("enemysizecheat", enemysizecheat) + ("ufospawnsminion", ufospawnsminion) + ("pistonsound", pistonsound) + ("chickenphase", chickenphase) + ("RRRA_ExitedLevel", RRRA_ExitedLevel) + ("fogactive", fogactive) + ("thunder_brightness", thunder_brightness) - // Todo: move to backend - ("totalclock", totalclock) - ("ototalclock", ototalclock) - ("totalclocklock", totalclocklock) + // Todo: move to backend + ("totalclock", totalclock) + ("ototalclock", ototalclock) + ("totalclocklock", totalclocklock) - ("lockclock", lockclock) + ("lockclock", lockclock) - .Array("po", po, ud.multimode) - .EndObject(); + .Array("po", po, ud.multimode) + .EndObject(); - if (arc.isReading()) - { - screenpeek = myconnectindex; - ps[myconnectindex].gm = MODE_GAME; - ud.recstat = 0; + if (arc.isReading()) + { + screenpeek = myconnectindex; + ps[myconnectindex].gm = MODE_GAME; + ud.recstat = 0; - ud.m_player_skill = ud.player_skill; - ud.m_respawn_monsters = ud.respawn_monsters; - ud.m_respawn_items = ud.respawn_items; - ud.m_respawn_inventory = ud.respawn_inventory; - ud.m_monsters_off = ud.monsters_off; - ud.m_coop = ud.coop; - ud.m_marker = ud.marker; - ud.m_ffire = ud.ffire; - if (ps[myconnectindex].over_shoulder_on != 0) - { - cameradist = 0; - cameraclock = 0; - ps[myconnectindex].over_shoulder_on = 1; - } - setpal(&ps[myconnectindex]); + ud.m_player_skill = ud.player_skill; + ud.m_respawn_monsters = ud.respawn_monsters; + ud.m_respawn_items = ud.respawn_items; + ud.m_respawn_inventory = ud.respawn_inventory; + ud.m_monsters_off = ud.monsters_off; + ud.m_coop = ud.coop; + ud.m_marker = ud.marker; + ud.m_ffire = ud.ffire; + if (ps[myconnectindex].over_shoulder_on != 0) + { + cameradist = 0; + cameraclock = 0; + ps[myconnectindex].over_shoulder_on = 1; + } + setpal(&ps[myconnectindex]); - memset(gotpic, 0, sizeof(gotpic)); - if (isRR()) cacheit_r(); else cacheit_d(); + memset(gotpic, 0, sizeof(gotpic)); + if (isRR()) cacheit_r(); else cacheit_d(); - Mus_ResumeSaved(); - Mus_SetPaused(false); + Mus_ResumeSaved(); + Mus_SetPaused(false); - FX_SetReverb(0); - recreateinterpolations(); - show_shareware = 0; - everyothertime = 0; - clearfifo(); + FX_SetReverb(0); + recreateinterpolations(); + show_shareware = 0; + everyothertime = 0; + clearfifo(); - // should be unnecessary with the sounds getting serialized as well. - #if 0 - if (ps[myconnectindex].jetpack_on) - spritesound(DUKE_JETPACK_IDLE, ps[myconnectindex].i); + // should be unnecessary with the sounds getting serialized as well. + #if 0 + if (ps[myconnectindex].jetpack_on) + spritesound(DUKE_JETPACK_IDLE, ps[myconnectindex].i); - // Update sound state in SFX sprites. - for (int i = headspritestat[STAT_FX]; i >= 0; i = nextspritestat[i]) - if (sprite[i].picnum == MUSICANDSFX) - { - hittype[i].temp_data[1] = SoundEnabled(); - hittype[i].temp_data[0] = 0; - } + // Update sound state in SFX sprites. + for (int i = headspritestat[STAT_FX]; i >= 0; i = nextspritestat[i]) + if (sprite[i].picnum == MUSICANDSFX) + { + hittype[i].temp_data[1] = SoundEnabled(); + hittype[i].temp_data[0] = 0; + } - #endif - FX_SetReverb(0); + #endif + FX_SetReverb(0); - } - else - { - ototalclock = totalclock; - } - ready2send = 1; - } + } + else + { + ototalclock = totalclock; + } + ready2send = 1; + } } bool GameInterface::LoadGame(FSaveGameNode* sv) { - return 0; + return 0; } bool GameInterface::SaveGame(FSaveGameNode* sv) { - return 0; + return 0; } diff --git a/source/games/duke/src/sbar.h b/source/games/duke/src/sbar.h index 6100cbdeb..a9456a5e9 100644 --- a/source/games/duke/src/sbar.h +++ b/source/games/duke/src/sbar.h @@ -10,20 +10,20 @@ BEGIN_DUKE_NS class DDukeCommonStatusBar : public DBaseStatusBar { protected: - DHUDFont numberFont; - DHUDFont indexFont; - DHUDFont miniFont; - DHUDFont digiFont; - double scale = 1; - std::array ammo_sprites; - std::array item_icons; + DHUDFont numberFont; + DHUDFont indexFont; + DHUDFont miniFont; + DHUDFont digiFont; + double scale = 1; + std::array ammo_sprites; + std::array item_icons; DDukeCommonStatusBar(); - std::pair ontext(struct player_struct *p); - void DrawInventory(const struct player_struct* p, double x, double y, int align); - PalEntry LightForShade(int shade); + std::pair ontext(struct player_struct *p); + void DrawInventory(const struct player_struct* p, double x, double y, int align); + PalEntry LightForShade(int shade); public: - void PrintLevelStats(int bottomy); + void PrintLevelStats(int bottomy); }; diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index 5bd18c3d2..80ca0334f 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -55,15 +55,15 @@ BEGIN_DUKE_NS class DDukeStatusBar : public DDukeCommonStatusBar { public: - DDukeStatusBar() - { - // optionally draw at the top of the screen. - SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y); - scale = 1; + DDukeStatusBar() + { + // optionally draw at the top of the screen. + SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y); + scale = 1; - ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO/*, FLAMETHROWERAMMO + 1*/ }; + ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO/*, FLAMETHROWERAMMO + 1*/ }; item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON }; - } + } //========================================================================== // @@ -103,301 +103,301 @@ public: } - //========================================================================== - // - // Fullscreen HUD variant #1 - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD variant #1 + // + //========================================================================== - void FullscreenHUD1(struct player_struct* p, int snum) - { - // - // Health - // - DrawGraphic(tileGetTexture(COLA), 2, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); + void FullscreenHUD1(struct player_struct* p, int snum) + { + // + // Health + // + DrawGraphic(tileGetTexture(COLA), 2, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); - FString format; - if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) - { - int s = -8; - if (althud_flashing && p->last_extra > max_player_health) - s += (sintable[((int)totalclock << 5) & 2047] >> 10); - int intens = clamp(255 - 4 * s, 0, 255); - auto pe = PalEntry(255, intens, intens, intens); - format.Format("%d", p->last_extra); - SBar_DrawString(this, &numberFont, format, 40, -BigFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } + FString format; + if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) + { + int s = -8; + if (althud_flashing && p->last_extra > max_player_health) + s += (sintable[((int)totalclock << 5) & 2047] >> 10); + int intens = clamp(255 - 4 * s, 0, 255); + auto pe = PalEntry(255, intens, intens, intens); + format.Format("%d", p->last_extra); + SBar_DrawString(this, &numberFont, format, 40, -BigFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + } - // - // Armor - // - DrawGraphic(tileGetTexture(SHIELD), 62, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); + // + // Armor + // + DrawGraphic(tileGetTexture(SHIELD), 62, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); - format.Format("%d", GetMoraleOrShield(p, snum)); - SBar_DrawString(this, &numberFont, format, 105, -numberFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + format.Format("%d", GetMoraleOrShield(p, snum)); + SBar_DrawString(this, &numberFont, format, 105, -numberFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - // - // Weapon - // + // + // Weapon + // - int wicon = ammo_sprites[p->curr_weapon]; - if (wicon > 0) - { - auto img = tileGetTexture(wicon); - auto scale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; - DrawGraphic(img, -57, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - } + int wicon = ammo_sprites[p->curr_weapon]; + if (wicon > 0) + { + auto img = tileGetTexture(wicon); + auto scale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; + DrawGraphic(img, -57, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + } - int weapon = p->curr_weapon; - if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_WEAPON; + int weapon = p->curr_weapon; + if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_WEAPON; - if (p->curr_weapon != KNEE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10))) - { - format.Format("%d", p->ammo_amount[weapon]); - SBar_DrawString(this, &numberFont, format, -22, -numberFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } + if (p->curr_weapon != KNEE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10))) + { + format.Format("%d", p->ammo_amount[weapon]); + SBar_DrawString(this, &numberFont, format, -22, -numberFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + } - // - // Selected inventory item - // + // + // Selected inventory item + // - unsigned icon = p->inven_icon; - if (icon > 0) - { - int x = 131; + unsigned icon = p->inven_icon; + if (icon > 0) + { + int x = 131; - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1); + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1); - int percentv = getinvamount(p); - format.Format("%3d%%", percentv); - EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; - SBar_DrawString(this, &indexFont, format, x + 35, -indexFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); + int percentv = getinvamount(p); + format.Format("%3d%%", percentv); + EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; + SBar_DrawString(this, &indexFont, format, x + 35, -indexFont.mFont->GetHeight() - 0.5, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); - auto text = ontext(p); - if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 35, -miniFont.mFont->GetHeight() - 9.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); - } + auto text = ontext(p); + if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 35, -miniFont.mFont->GetHeight() - 9.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); + } - // - // keys - // - if (p->got_access & 1) DrawGraphic(tileGetTexture(ACCESSCARD), -29, -30, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 0)); - if (p->got_access & 4) DrawGraphic(tileGetTexture(ACCESSCARD), -24, -28, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 23)); - if (p->got_access & 2) DrawGraphic(tileGetTexture(ACCESSCARD), -19, -26, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 21)); - } + // + // keys + // + if (p->got_access & 1) DrawGraphic(tileGetTexture(ACCESSCARD), -29, -30, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 0)); + if (p->got_access & 4) DrawGraphic(tileGetTexture(ACCESSCARD), -24, -28, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 23)); + if (p->got_access & 2) DrawGraphic(tileGetTexture(ACCESSCARD), -19, -26, DI_ITEM_CENTER, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 21)); + } - //========================================================================== - // - // Fullscreen HUD variant #2 - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD variant #2 + // + //========================================================================== - void FullscreenHUD2(struct player_struct *p) - { - // - // health - // - DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; - FStringf format("%d", health); - SBar_DrawString(this, &digiFont, format, 19, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + void FullscreenHUD2(struct player_struct *p) + { + // + // health + // + DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + FStringf format("%d", health); + SBar_DrawString(this, &digiFont, format, 19, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // ammo - // - DrawGraphic(tileGetTexture(AMMOBOX), 37, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon; - format.Format("%d", p->ammo_amount[wp]); - SBar_DrawString(this, &digiFont, format, 53, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + // + // ammo + // + DrawGraphic(tileGetTexture(AMMOBOX), 37, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon; + format.Format("%d", p->ammo_amount[wp]); + SBar_DrawString(this, &digiFont, format, 53, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // inventory - // - unsigned icon = p->inven_icon; - if (icon > 0) - { - int x = 73; - DrawGraphic(tileGetTexture(INVENTORYBOX), 69, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, -1, -1, scale, scale); + // + // inventory + // + unsigned icon = p->inven_icon; + if (icon > 0) + { + int x = 73; + DrawGraphic(tileGetTexture(INVENTORYBOX), 69, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, -1, -1, scale, scale); - int percentv = getinvamount(p); - format.Format("%3d%%", percentv); - EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; - SBar_DrawString(this, &indexFont, format, x + 34, -indexFont.mFont->GetHeight() - 5.5, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); + int percentv = getinvamount(p); + format.Format("%3d%%", percentv); + EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; + SBar_DrawString(this, &indexFont, format, x + 34, -indexFont.mFont->GetHeight() - 5.5, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); - auto text = ontext(p); - if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, -miniFont.mFont->GetHeight() - 14.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); + auto text = ontext(p); + if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, -miniFont.mFont->GetHeight() - 14.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); - } - } + } + } - //========================================================================== - // - // Fullscreen HUD drawer - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD drawer + // + //========================================================================== - void DrawHud(int snum, int style) - { - auto p = &ps[snum]; - BeginHUD(320, 200, 1.f, false); - if (style == 1) - { - DrawInventory(p, 0, -46, DI_SCREEN_CENTER_BOTTOM); - FullscreenHUD1(p, snum); - PrintLevelStats(tilesiz[BIGALPHANUM].y +10); - } - else if (style == 2) - { + void DrawHud(int snum, int style) + { + auto p = &ps[snum]; + BeginHUD(320, 200, 1.f, false); + if (style == 1) + { + DrawInventory(p, 0, -46, DI_SCREEN_CENTER_BOTTOM); + FullscreenHUD1(p, snum); + PrintLevelStats(tilesiz[BIGALPHANUM].y +10); + } + else if (style == 2) + { DrawInventory(p, (ud.multimode > 1) ? 56 : 65, -28, DI_SCREEN_CENTER_BOTTOM); FullscreenHUD2(p); - PrintLevelStats(tilesiz[HEALTHBOX].y + 4); - } - else - { - DrawInventory(p, 0, -28, DI_SCREEN_CENTER_BOTTOM); - PrintLevelStats(2); - } - } + PrintLevelStats(tilesiz[HEALTHBOX].y + 4); + } + else + { + DrawInventory(p, 0, -28, DI_SCREEN_CENTER_BOTTOM); + PrintLevelStats(2); + } + } - //========================================================================== - // - // Helper for weapon display - // - //========================================================================== + //========================================================================== + // + // Helper for weapon display + // + //========================================================================== - void DrawWeaponNum(int index, int x, int y, int num1, int num2, int shade, int numdigits) - { - /* - if (VOLUMEONE && (ind > HANDBOMB_WEAPON || ind < 0)) - { - minitextshade(x + 1, y - 4, "ORDER", 20, 11, 2 + 8 + 16 + ROTATESPRITE_MAX); - return; - } - */ - FString format; + void DrawWeaponNum(int index, int x, int y, int num1, int num2, int shade, int numdigits) + { + /* + if (VOLUMEONE && (ind > HANDBOMB_WEAPON || ind < 0)) + { + minitextshade(x + 1, y - 4, "ORDER", 20, 11, 2 + 8 + 16 + ROTATESPRITE_MAX); + return; + } + */ + FString format; - if (numdigits == 2) - { - if (num1 > 99) num1 = 99; - if (num2 > 99) num2 = 99; - format.Format("%2d/%d", num1, num2); - } - else - { - if (num1 > 999) num1 = 999; - if (num2 > 999) num2 = 999; - format.Format("%3d/%d", num1, num2); - } - y--; - DrawGraphic(tileGetTexture(THREEBYFIVE + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7)); - auto pe = LightForShade(shade); - DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe); - for (size_t i = 0; i < format.Len(); i++) - { - if (format[i] != ' ') - { - char c = format[i] == '/' ? 11 : format[i] - '0'; - DrawGraphic(tileGetTexture(THREEBYFIVE + c), x + 4 * i, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe); - } - } - } + if (numdigits == 2) + { + if (num1 > 99) num1 = 99; + if (num2 > 99) num2 = 99; + format.Format("%2d/%d", num1, num2); + } + else + { + if (num1 > 999) num1 = 999; + if (num2 > 999) num2 = 999; + format.Format("%3d/%d", num1, num2); + } + y--; + DrawGraphic(tileGetTexture(THREEBYFIVE + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7)); + auto pe = LightForShade(shade); + DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe); + for (size_t i = 0; i < format.Len(); i++) + { + if (format[i] != ' ') + { + char c = format[i] == '/' ? 11 : format[i] - '0'; + DrawGraphic(tileGetTexture(THREEBYFIVE + c), x + 4 * i, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe); + } + } + } - //========================================================================== - // - // Weapon display (Duke only) - // - //========================================================================== + //========================================================================== + // + // Weapon display (Duke only) + // + //========================================================================== - void DrawWeaponAmounts(const struct player_struct* p, int x, int y) - { - int cw = p->curr_weapon; + void DrawWeaponAmounts(const struct player_struct* p, int x, int y) + { + int cw = p->curr_weapon; - auto ShadeForWeapon = [=](int weapon, int optweapon = -1) - { - // Headache-inducing math at play here. - return (((!p->ammo_amount[weapon]) | (!p->gotweapon[weapon])) * 9) + 12 - 18 * ((cw == weapon) || (optweapon != -1 && cw == optweapon)); - }; + auto ShadeForWeapon = [=](int weapon, int optweapon = -1) + { + // Headache-inducing math at play here. + return (((!p->ammo_amount[weapon]) | (!p->gotweapon[weapon])) * 9) + 12 - 18 * ((cw == weapon) || (optweapon != -1 && cw == optweapon)); + }; - DrawWeaponNum(2, x, y, p->ammo_amount[PISTOL_WEAPON], max_ammo_amount[PISTOL_WEAPON], 12 - 20 * (cw == PISTOL_WEAPON), 3); - DrawWeaponNum(3, x, y + 6, p->ammo_amount[SHOTGUN_WEAPON], max_ammo_amount[SHOTGUN_WEAPON], ShadeForWeapon(SHOTGUN_WEAPON), 3); - DrawWeaponNum(4, x, y + 12, p->ammo_amount[CHAINGUN_WEAPON], max_ammo_amount[CHAINGUN_WEAPON], ShadeForWeapon(CHAINGUN_WEAPON), 3); - DrawWeaponNum(5, x + 39, y, p->ammo_amount[RPG_WEAPON], max_ammo_amount[RPG_WEAPON], ShadeForWeapon(RPG_WEAPON), 2); - DrawWeaponNum(6, x + 39, y + 6, p->ammo_amount[HANDBOMB_WEAPON], max_ammo_amount[HANDBOMB_WEAPON], ShadeForWeapon(HANDBOMB_WEAPON, HANDREMOTE_WEAPON), 2); - if (p->subweapon & (1 << GROW_WEAPON)) // original code says: if(!p->ammo_amount[SHRINKER_WEAPON] || cw == GROW_WEAPON) - DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2); - else - DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2); - DrawWeaponNum(8, x + 70, y, p->ammo_amount[DEVISTATOR_WEAPON], max_ammo_amount[DEVISTATOR_WEAPON], ShadeForWeapon(DEVISTATOR_WEAPON), 2); - DrawWeaponNum(9, x + 70, y + 6, p->ammo_amount[TRIPBOMB_WEAPON], max_ammo_amount[TRIPBOMB_WEAPON], ShadeForWeapon(TRIPBOMB_WEAPON), 2); - DrawWeaponNum(0, x + 70, y + 12, p->ammo_amount[FREEZE_WEAPON], max_ammo_amount[FREEZE_WEAPON], ShadeForWeapon(FREEZE_WEAPON), 2); - } + DrawWeaponNum(2, x, y, p->ammo_amount[PISTOL_WEAPON], max_ammo_amount[PISTOL_WEAPON], 12 - 20 * (cw == PISTOL_WEAPON), 3); + DrawWeaponNum(3, x, y + 6, p->ammo_amount[SHOTGUN_WEAPON], max_ammo_amount[SHOTGUN_WEAPON], ShadeForWeapon(SHOTGUN_WEAPON), 3); + DrawWeaponNum(4, x, y + 12, p->ammo_amount[CHAINGUN_WEAPON], max_ammo_amount[CHAINGUN_WEAPON], ShadeForWeapon(CHAINGUN_WEAPON), 3); + DrawWeaponNum(5, x + 39, y, p->ammo_amount[RPG_WEAPON], max_ammo_amount[RPG_WEAPON], ShadeForWeapon(RPG_WEAPON), 2); + DrawWeaponNum(6, x + 39, y + 6, p->ammo_amount[HANDBOMB_WEAPON], max_ammo_amount[HANDBOMB_WEAPON], ShadeForWeapon(HANDBOMB_WEAPON, HANDREMOTE_WEAPON), 2); + if (p->subweapon & (1 << GROW_WEAPON)) // original code says: if(!p->ammo_amount[SHRINKER_WEAPON] || cw == GROW_WEAPON) + DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2); + else + DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2); + DrawWeaponNum(8, x + 70, y, p->ammo_amount[DEVISTATOR_WEAPON], max_ammo_amount[DEVISTATOR_WEAPON], ShadeForWeapon(DEVISTATOR_WEAPON), 2); + DrawWeaponNum(9, x + 70, y + 6, p->ammo_amount[TRIPBOMB_WEAPON], max_ammo_amount[TRIPBOMB_WEAPON], ShadeForWeapon(TRIPBOMB_WEAPON), 2); + DrawWeaponNum(0, x + 70, y + 12, p->ammo_amount[FREEZE_WEAPON], max_ammo_amount[FREEZE_WEAPON], ShadeForWeapon(FREEZE_WEAPON), 2); + } - //========================================================================== - // - // Status bar drawer - // - //========================================================================== + //========================================================================== + // + // Status bar drawer + // + //========================================================================== - void Statusbar(int snum) - { - auto p = &ps[snum]; - int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; - int top = 200 - h; - BeginStatusBar(320, 200, h, true); - DrawInventory(p, 160, 154, 0); - DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); + void Statusbar(int snum) + { + auto p = &ps[snum]; + int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; + int top = 200 - h; + BeginStatusBar(320, 200, h, true); + DrawInventory(p, 160, 154, 0); + DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); - FString format; + FString format; - if (ud.multimode > 1 && !ud.coop) - { - DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); - format.Format("%d", max(p->frag - p->fraggedself, 0)); - SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } - else - { - auto key = tileGetTexture(ACCESS_ICON); - if (p->got_access & 4) DrawGraphic(key, 275, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 23)); - if (p->got_access & 2) DrawGraphic(key, 288, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 21)); - if (p->got_access & 1) DrawGraphic(key, 281, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 0)); - } - DrawWeaponAmounts(p, 96, top + 16); + if (ud.multimode > 1 && !ud.coop) + { + DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); + format.Format("%d", max(p->frag - p->fraggedself, 0)); + SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + } + else + { + auto key = tileGetTexture(ACCESS_ICON); + if (p->got_access & 4) DrawGraphic(key, 275, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 23)); + if (p->got_access & 2) DrawGraphic(key, 288, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 21)); + if (p->got_access & 1) DrawGraphic(key, 281, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, 0)); + } + DrawWeaponAmounts(p, 96, top + 16); - int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; - format.Format("%d", num); - SBar_DrawString(this, &digiFont, format, 32, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - format.Format("%d", GetMoraleOrShield(p, snum)); - SBar_DrawString(this, &digiFont, format, 64, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + format.Format("%d", num); + SBar_DrawString(this, &digiFont, format, 32, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + format.Format("%d", GetMoraleOrShield(p, snum)); + SBar_DrawString(this, &digiFont, format, 64, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - if (p->curr_weapon != KNEE_WEAPON) - { - int wep = (p->curr_weapon == HANDREMOTE_WEAPON)? HANDBOMB_WEAPON : p->curr_weapon; - format.Format("%d", p->ammo_amount[wep]); - SBar_DrawString(this, &digiFont, format, 208, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); - } + if (p->curr_weapon != KNEE_WEAPON) + { + int wep = (p->curr_weapon == HANDREMOTE_WEAPON)? HANDBOMB_WEAPON : p->curr_weapon; + format.Format("%d", p->ammo_amount[wep]); + SBar_DrawString(this, &digiFont, format, 208, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + } - int icon = p->inven_icon; - if (icon) - { - int x = 231; - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, 1, 1); + int icon = p->inven_icon; + if (icon) + { + int x = 231; + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, 1, 1); - int percentv = getinvamount(p); - format.Format("%3d%%", percentv); - EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; - SBar_DrawString(this, &indexFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); + int percentv = getinvamount(p); + format.Format("%3d%%", percentv); + EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; + SBar_DrawString(this, &indexFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1); - auto text = ontext(p); - if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, top + 14, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); - } - PrintLevelStats(-1); - } + auto text = ontext(p); + if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, top + 14, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); + } + PrintLevelStats(-1); + } }; @@ -414,15 +414,15 @@ void drawstatusbar_d(int snum) else { dsb.Statusbar(snum); - } + } - if (hud_showmapname && levelTextTime > 1 && !M_Active()) - { - double alpha; - if (levelTextTime > 16) alpha = 1.; - else alpha = (levelTextTime) / 16.; - PrintLevelName_d(alpha); - } + if (hud_showmapname && levelTextTime > 1 && !M_Active()) + { + double alpha; + if (levelTextTime > 16) alpha = 1.; + else alpha = (levelTextTime) / 16.; + PrintLevelName_d(alpha); + } } diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index 5f13d15af..7abee4eb3 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -48,180 +48,180 @@ class DRedneckStatusBar : public DDukeCommonStatusBar { public: - DRedneckStatusBar() - { - // optionally draw at the top of the screen. - SetSize(tilesiz[BOTTOMSTATUSBAR].y); - scale = 0.5; - ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, HBOMBAMMO, HBOMBAMMO, RRTILE43, DEVISTATORAMMO, TRIPBOMBSPRITE, GROWSPRITEICON, HBOMBAMMO, -1, BOWLINGBALLSPRITE, MOTOAMMO, BOATAMMO, -1, RPG2SPRITE }; + DRedneckStatusBar() + { + // optionally draw at the top of the screen. + SetSize(tilesiz[BOTTOMSTATUSBAR].y); + scale = 0.5; + ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, HBOMBAMMO, HBOMBAMMO, RRTILE43, DEVISTATORAMMO, TRIPBOMBSPRITE, GROWSPRITEICON, HBOMBAMMO, -1, BOWLINGBALLSPRITE, MOTOAMMO, BOATAMMO, -1, RPG2SPRITE }; item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON }; - } + } int getinvamount(const struct player_struct* p) { switch (p->inven_icon) { - case ICON_FIRSTAID: - return p->firstaid_amount; - case ICON_STEROIDS: - return (p->steroids_amount + 3) >> 2; - case ICON_HOLODUKE: - return (p->holoduke_amount) / 400; - case ICON_JETPACK: - return (p->jetpack_amount) / 100; - case ICON_HEATS: - return p->heat_amount / 12; - case ICON_SCUBA: - return (p->scuba_amount + 63) >> 6; - case ICON_BOOTS: - return (p->boot_amount / 10) >> 1; + case ICON_FIRSTAID: + return p->firstaid_amount; + case ICON_STEROIDS: + return (p->steroids_amount + 3) >> 2; + case ICON_HOLODUKE: + return (p->holoduke_amount) / 400; + case ICON_JETPACK: + return (p->jetpack_amount) / 100; + case ICON_HEATS: + return p->heat_amount / 12; + case ICON_SCUBA: + return (p->scuba_amount + 63) >> 6; + case ICON_BOOTS: + return (p->boot_amount / 10) >> 1; } return -1; } - //========================================================================== - // - // Fullscreen HUD variant #1 for RR - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD variant #1 for RR + // + //========================================================================== - void FullscreenHUD1(struct player_struct* p, int snum) - { - // - // Health - // + void FullscreenHUD1(struct player_struct* p, int snum) + { + // + // Health + // - DrawGraphic(tileGetTexture(SPINNINGNUKEICON+1), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.); + DrawGraphic(tileGetTexture(SPINNINGNUKEICON+1), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.); - FString format; - if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) - { - int s = -8; - if (althud_flashing && p->last_extra > max_player_health) - s += (sintable[((int)totalclock << 5) & 2047] >> 10); - int intens = clamp(255 - 4 * s, 0, 255); - auto pe = PalEntry(255, intens, intens, intens); - format.Format("%d", p->last_extra); - SBar_DrawString(this, &numberFont, format, 44, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } + FString format; + if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) + { + int s = -8; + if (althud_flashing && p->last_extra > max_player_health) + s += (sintable[((int)totalclock << 5) & 2047] >> 10); + int intens = clamp(255 - 4 * s, 0, 255); + auto pe = PalEntry(255, intens, intens, intens); + format.Format("%d", p->last_extra); + SBar_DrawString(this, &numberFont, format, 44, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } - // - // drink - // - DrawGraphic(tileGetTexture(COLA), 70, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.); - format.Format("%d", p->drink_amt); - SBar_DrawString(this, &numberFont, format, 98, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + // + // drink + // + DrawGraphic(tileGetTexture(COLA), 70, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.); + format.Format("%d", p->drink_amt); + SBar_DrawString(this, &numberFont, format, 98, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // eat - // - DrawGraphic(tileGetTexture(JETPACK), 122, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 20000. / 65536., 20000. / 65536.); - format.Format("%d", p->eat); - SBar_DrawString(this, &numberFont, format, 175, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + // + // eat + // + DrawGraphic(tileGetTexture(JETPACK), 122, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 20000. / 65536., 20000. / 65536.); + format.Format("%d", p->eat); + SBar_DrawString(this, &numberFont, format, 175, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // selected weapon - // - int wicon = ammo_sprites[p->curr_weapon]; - if (wicon > 0) - { - auto img = tileGetTexture(wicon); - auto myscale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; - DrawGraphic(img, -50, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, myscale, myscale); - } + // + // selected weapon + // + int wicon = ammo_sprites[p->curr_weapon]; + if (wicon > 0) + { + auto img = tileGetTexture(wicon); + auto myscale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; + DrawGraphic(img, -50, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, myscale, myscale); + } - int weapon = p->curr_weapon; - if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_WEAPON; + int weapon = p->curr_weapon; + if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_WEAPON; - if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10))) - { - format.Format("%d", p->ammo_amount[weapon]); - SBar_DrawString(this, &numberFont, format, -20, -numberFont.mFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } + if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10))) + { + format.Format("%d", p->ammo_amount[weapon]); + SBar_DrawString(this, &numberFont, format, -20, -numberFont.mFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } - // - // Selected inventory item - // + // + // Selected inventory item + // - unsigned icon = p->inven_icon; - if (icon > 0) - { - int x = -122; + unsigned icon = p->inven_icon; + if (icon > 0) + { + int x = -122; - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int percentv = getinvamount(p); - if (icon <= 2) format.Format("%3d%%", percentv); - else format.Format("%3d ", percentv); - SBar_DrawString(this, &miniFont, format, x + 35, -miniFont.mFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + int percentv = getinvamount(p); + if (icon <= 2) format.Format("%3d%%", percentv); + else format.Format("%3d ", percentv); + SBar_DrawString(this, &miniFont, format, x + 35, -miniFont.mFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - auto text = ontext(p); - if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 35, -miniFont.mFont->GetHeight() * scale - 9.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } - if (p->keys[1]) DrawGraphic(tileGetTexture(ACCESSCARD), -29, -32, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 0)); - if (p->keys[3]) DrawGraphic(tileGetTexture(ACCESSCARD), -24, -30, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 23)); - if (p->keys[2]) DrawGraphic(tileGetTexture(ACCESSCARD), -19, -28, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 21)); - } + auto text = ontext(p); + if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 35, -miniFont.mFont->GetHeight() * scale - 9.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } + if (p->keys[1]) DrawGraphic(tileGetTexture(ACCESSCARD), -29, -32, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 0)); + if (p->keys[3]) DrawGraphic(tileGetTexture(ACCESSCARD), -24, -30, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 23)); + if (p->keys[2]) DrawGraphic(tileGetTexture(ACCESSCARD), -19, -28, DI_ITEM_BOTTOM, 1, -1, -1, 0.5, 0.5, 0xffffffff, TRANSLATION(Translation_Remap, 21)); + } - //========================================================================== - // - // Fullscreen HUD variant #2 for RR - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD variant #2 for RR + // + //========================================================================== - void FullscreenHUD2(struct player_struct* p) - { - // - // health - // - DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; - FStringf format("%d", health); - SBar_DrawString(this, &digiFont, format, 17, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + void FullscreenHUD2(struct player_struct* p) + { + // + // health + // + DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + FStringf format("%d", health); + SBar_DrawString(this, &digiFont, format, 17, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // ammo - // - DrawGraphic(tileGetTexture(AMMOBOX), 41, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon; - format.Format("%d", p->ammo_amount[wp]); - SBar_DrawString(this, &digiFont, format, 57, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + // + // ammo + // + DrawGraphic(tileGetTexture(AMMOBOX), 41, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon; + format.Format("%d", p->ammo_amount[wp]); + SBar_DrawString(this, &digiFont, format, 57, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - // - // inventory - // - unsigned icon = p->inven_icon; - if (icon > 0) - { - int x = 81; - DrawGraphic(tileGetTexture(INVENTORYBOX), 77, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); + // + // inventory + // + unsigned icon = p->inven_icon; + if (icon > 0) + { + int x = 81; + DrawGraphic(tileGetTexture(INVENTORYBOX), 77, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); - int percentv = getinvamount(p); - if (icon <= 2) format.Format("%3d%%", percentv); - else format.Format("%3d ", percentv); - SBar_DrawString(this, &miniFont, format, x + 34, -miniFont.mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } - } + int percentv = getinvamount(p); + if (icon <= 2) format.Format("%3d%%", percentv); + else format.Format("%3d ", percentv); + SBar_DrawString(this, &miniFont, format, x + 34, -miniFont.mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } + } - //========================================================================== - // - // Fullscreen HUD drawer - // - //========================================================================== + //========================================================================== + // + // Fullscreen HUD drawer + // + //========================================================================== - void DrawHud(int snum, int style) - { - auto p = &ps[snum]; - BeginHUD(320, 200, 1.f, false); - if (style == 1) - { + void DrawHud(int snum, int style) + { + auto p = &ps[snum]; + BeginHUD(320, 200, 1.f, false); + if (style == 1) + { double y = -40; if (ud.multimode > 1) y -= 4; @@ -229,161 +229,161 @@ public: y -= 4; DrawInventory(p, 0, y, DI_SCREEN_CENTER_BOTTOM); FullscreenHUD1(p, snum); - PrintLevelStats(scale * tilesiz[BIGALPHANUM].y + 10); - } - else if (style == 2) - { - DrawInventory(p, 56, -20, DI_SCREEN_CENTER_BOTTOM); - FullscreenHUD2(p); - PrintLevelStats(scale * tilesiz[HEALTHBOX].y + 4); - } - else - { - DrawInventory(p, 0, -20, DI_SCREEN_CENTER_BOTTOM); - PrintLevelStats(2); - } - } + PrintLevelStats(scale * tilesiz[BIGALPHANUM].y + 10); + } + else if (style == 2) + { + DrawInventory(p, 56, -20, DI_SCREEN_CENTER_BOTTOM); + FullscreenHUD2(p); + PrintLevelStats(scale * tilesiz[HEALTHBOX].y + 4); + } + else + { + DrawInventory(p, 0, -20, DI_SCREEN_CENTER_BOTTOM); + PrintLevelStats(2); + } + } - //========================================================================== - // - // Status bar drawer (RR) - // - //========================================================================== + //========================================================================== + // + // Status bar drawer (RR) + // + //========================================================================== - void DrawWeaponBar(const struct player_struct* p, int top) - { - double sbscale = 32800. / 65536.; + void DrawWeaponBar(const struct player_struct* p, int top) + { + double sbscale = 32800. / 65536.; - DrawGraphic(tileGetTexture(WEAPONBAR), 0, 158, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); + DrawGraphic(tileGetTexture(WEAPONBAR), 0, 158, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); - FString format; - for (int i = 0; i < 9; i++) - { - if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON) - { - DrawGraphic(tileGetTexture(AMMO_ICON + 10), 18 + i * 32, top - 6, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); - format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]); - } - else - { - if (p->gotweapon[i+1]) { - DrawGraphic(tileGetTexture(AMMO_ICON + i), 18 + i * 32, top - 6, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); - } - format.Format("%d", p->ammo_amount[i+1]); - } - SBar_DrawString(this, &miniFont, format, 38 + i * 32, 162 - miniFont.mFont->GetHeight() * scale * 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } - } + FString format; + for (int i = 0; i < 9; i++) + { + if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON) + { + DrawGraphic(tileGetTexture(AMMO_ICON + 10), 18 + i * 32, top - 6, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); + format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]); + } + else + { + if (p->gotweapon[i+1]) { + DrawGraphic(tileGetTexture(AMMO_ICON + i), 18 + i * 32, top - 6, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); + } + format.Format("%d", p->ammo_amount[i+1]); + } + SBar_DrawString(this, &miniFont, format, 38 + i * 32, 162 - miniFont.mFont->GetHeight() * scale * 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } + } - //========================================================================== - // - // Status bar drawer (RR) - // - //========================================================================== + //========================================================================== + // + // Status bar drawer (RR) + // + //========================================================================== - void Statusbar(int snum) - { - auto p = &ps[snum]; - double h = tilesiz[BOTTOMSTATUSBAR].y * scale; - double top = 200 - h; - BeginStatusBar(320, 200, h, true); - DrawInventory(p, 160, 154, 0); + void Statusbar(int snum) + { + auto p = &ps[snum]; + double h = tilesiz[BOTTOMSTATUSBAR].y * scale; + double top = 200 - h; + BeginStatusBar(320, 200, h, true); + DrawInventory(p, 160, 154, 0); - if (ud.screen_size > 8) - DrawWeaponBar(p, top); + if (ud.screen_size > 8) + DrawWeaponBar(p, top); - DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale); + DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale); - FString format; + FString format; - if (ud.multimode > 1 && !ud.coop) - { - DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); - format.Format("%d", max(p->frag - p->fraggedself, 0)); - SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } - else - { - auto key = tileGetTexture(ACCESS_ICON); - if (p->keys[3]) DrawGraphic(key, 140, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 23)); - if (p->keys[2]) DrawGraphic(key, 153, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 21)); - if (p->keys[1]) DrawGraphic(key, 146, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0)); - } + if (ud.multimode > 1 && !ud.coop) + { + DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); + format.Format("%d", max(p->frag - p->fraggedself, 0)); + SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } + else + { + auto key = tileGetTexture(ACCESS_ICON); + if (p->keys[3]) DrawGraphic(key, 140, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 23)); + if (p->keys[2]) DrawGraphic(key, 153, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 21)); + if (p->keys[1]) DrawGraphic(key, 146, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0)); + } - int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; - format.Format("%d", num); - SBar_DrawString(this, &digiFont, format, 64, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + format.Format("%d", num); + SBar_DrawString(this, &digiFont, format, 64, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - if (p->curr_weapon != KNEE_WEAPON) - { - int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon; - format.Format("%d", p->ammo_amount[wep]); - SBar_DrawString(this, &digiFont, format, 107, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } + if (p->curr_weapon != KNEE_WEAPON) + { + int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon; + format.Format("%d", p->ammo_amount[wep]); + SBar_DrawString(this, &digiFont, format, 107, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } - int icon = p->inven_icon; - if (icon) - { - int x = 183; - if (icon < ICON_MAX) - DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); + int icon = p->inven_icon; + if (icon) + { + int x = 183; + if (icon < ICON_MAX) + DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); - int percentv = getinvamount(p); - if (icon <= 2) format.Format("%3d%%", percentv); - else format.Format("%3d ", percentv); - SBar_DrawString(this, &miniFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + int percentv = getinvamount(p); + if (icon <= 2) format.Format("%3d%%", percentv); + else format.Format("%3d ", percentv); + SBar_DrawString(this, &miniFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - if (p->inven_icon == ICON_SCUBA || p->inven_icon == ICON_BOOTS) - SBar_DrawString(this, &miniFont, "AUTO", x + 34, top + 14, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); - } + if (p->inven_icon == ICON_SCUBA || p->inven_icon == ICON_BOOTS) + SBar_DrawString(this, &miniFont, "AUTO", x + 34, top + 14, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); + } - p->drunkang = ((p->drink_amt * 8) + 1647) & 2047; - if (p->drink_amt >= 100) - { - p->drink_amt = 100; - p->drunkang = 400; - } + p->drunkang = ((p->drink_amt * 8) + 1647) & 2047; + if (p->drink_amt >= 100) + { + p->drink_amt = 100; + p->drunkang = 400; + } // Todo: These need rotation support which currently does not exist. - DrawGraphic(tileGetTexture(GUTMETER), 257, top + 24, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, 0 /*, p->drunkang * 360. / 2048 */ ); - DrawGraphic(tileGetTexture(GUTMETER), 293, top + 24, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, 0 /*, p->eatang * 360. / 2048 */); + DrawGraphic(tileGetTexture(GUTMETER), 257, top + 24, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, 0 /*, p->drunkang * 360. / 2048 */ ); + DrawGraphic(tileGetTexture(GUTMETER), 293, top + 24, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, 0xffffffff, 0 /*, p->eatang * 360. / 2048 */); - if (p->drink_amt >= 0 && p->drink_amt <= 30) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 239, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else if (p->drink_amt >= 31 && p->drink_amt <= 65) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 248, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else if (p->drink_amt >= 66 && p->drink_amt <= 87) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 256, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 265, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } + if (p->drink_amt >= 0 && p->drink_amt <= 30) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 239, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else if (p->drink_amt >= 31 && p->drink_amt <= 65) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 248, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else if (p->drink_amt >= 66 && p->drink_amt <= 87) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 256, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 265, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } - if (p->eat >= 0 && p->eat <= 30) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 276, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else if (p->eat >= 31 && p->eat <= 65) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 285, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else if (p->eat >= 66 && p->eat <= 87) - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 294, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - else - { - DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 302, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); - } - PrintLevelStats(-1); - } + if (p->eat >= 0 && p->eat <= 30) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 276, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else if (p->eat >= 31 && p->eat <= 65) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 285, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else if (p->eat >= 66 && p->eat <= 87) + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 294, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + else + { + DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 302, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); + } + PrintLevelStats(-1); + } }; void PrintLevelName_r(double alpha); @@ -400,13 +400,13 @@ void drawstatusbar_r(int snum) dsb.Statusbar(snum); } - if (hud_showmapname && levelTextTime > 1 && !M_Active()) - { - double alpha; - if (levelTextTime > 16) alpha = 1.; - else alpha = (levelTextTime) / 16.; - PrintLevelName_r(alpha); - } + if (hud_showmapname && levelTextTime > 1 && !M_Active()) + { + double alpha; + if (levelTextTime > 16) alpha = 1.; + else alpha = (levelTextTime) / 16.; + PrintLevelName_r(alpha); + } } diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 099430b80..bb03eadc5 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -401,7 +401,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh if (foundone) return -1; } - int32_t sndist; + int32_t sndist; FVector3 sndpos; // this is in sound engine space. vec3_t* campos; @@ -409,7 +409,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh S_GetCamera(&campos, nullptr, &camsect); GetPositionInfo(spriteNum, sndnum, camsect, campos, pos, &sndist, &sndpos); - int pitch = S_GetPitch(sndnum); + int pitch = S_GetPitch(sndnum); bool explosion = ((userflags & (SF_GLOBAL | SF_DTAG)) == (SF_GLOBAL | SF_DTAG)) || ((sndnum == PIPEBOMB_EXPLODE || sndnum == LASERTRIP_EXPLODE || sndnum == RPG_EXPLODE)); diff --git a/source/games/duke/src/sounds.h b/source/games/duke/src/sounds.h index 781287b74..1b150af7d 100644 --- a/source/games/duke/src/sounds.h +++ b/source/games/duke/src/sounds.h @@ -15,31 +15,31 @@ BEGIN_DUKE_NS // Sound flags enum { - SF_LOOP = 1, - SF_MSFX = 2, - SF_TALK = 4, - SF_ADULT = 8, - SF_GLOBAL = 16, - SF_ONEINST_INTERNAL = 32, + SF_LOOP = 1, + SF_MSFX = 2, + SF_TALK = 4, + SF_ADULT = 8, + SF_GLOBAL = 16, + SF_ONEINST_INTERNAL = 32, - SF_DTAG = 128, + SF_DTAG = 128, }; enum esound_t { - kPitchStart, - kPitchEnd, - kVolAdjust, - kPriority, - kFlags, - kMaxUserData + kPitchStart, + kPitchEnd, + kVolAdjust, + kPriority, + kFlags, + kMaxUserData }; int A_CheckSoundPlaying(int spriteNum, int soundNum, int channel = 0); int A_PlaySound(int soundNum, int spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0); inline int spritesound(int soundnum, int spritenum) { - return A_PlaySound(soundnum, spritenum); + return A_PlaySound(soundnum, spritenum); } int A_CheckAnySoundPlaying(int spriteNum); int S_CheckSoundPlaying(int soundNum); @@ -54,13 +54,13 @@ void S_ContinueLevelMusic(void); int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0); inline int sound(int num) { - return S_PlaySound(num); + return S_PlaySound(num); } int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos, int channel = CHAN_AUTO, EChanFlags flags = 0); void S_StopEnvSound(int sndNum,int sprNum, int flags = -1); inline void stopsound(int snd) { - S_StopEnvSound(snd, -1); + S_StopEnvSound(snd, -1); } #define S_StopSound(num) S_StopEnvSound(num, -1) @@ -74,7 +74,7 @@ void PlayBonusMusic(); inline bool S_IsSoundValid(int num) { - return (!soundEngine->isValidSoundId(num + 1)); + return (!soundEngine->isValidSoundId(num + 1)); } @@ -84,7 +84,7 @@ inline void StopCommentary() inline bool StartCommentary(int tag, int sprnum) { - return false; + return false; } extern TArray specialmusic; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 00374e182..13f92c521 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -37,1454 +37,1454 @@ BEGIN_DUKE_NS int spawn_r(int j, int pn) { - int x; - + int x; + int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4 }); if (!(i & 0x1000000)) return i; i &= 0xffffff; - auto sp = &sprite[i]; - auto t = hittype[i].temp_data; - int sect = sp->sectnum; + auto sp = &sprite[i]; + auto t = hittype[i].temp_data; + int sect = sp->sectnum; - switch(sp->picnum) - { - default: - default_case: + switch(sp->picnum) + { + default: + default_case: spawninitdefault(j, i); - break; - case RRTILE280: - case RRTILE281: - case RRTILE282: - case RRTILE283: - case RRTILE2025: - case RRTILE2026: - case RRTILE2027: - case RRTILE2028: - sp->cstat = 0; - sp->cstat |= 32768; - sp->xrepeat = 0; - sp->yrepeat = 0; - sp->clipdist = 0; - sp->extra = 0; - changespritestat(i,105); - break; - case RRTILE3410: - sp->extra = 0; - changespritestat(i,107); - break; - case RRTILE8450: - if (!isRRRA()) goto default_case; - sp->xrepeat = 64; - sp->yrepeat = 64; - sp->extra = sp->lotag; - sp->cstat |= 257; - changespritestat(i,116); - break; - case PIG+11: - if (!isRRRA()) goto default_case; - sp->xrepeat = 16; - sp->yrepeat = 16; - sp->clipdist = 0; - sp->extra = 0; - sp->cstat = 0; - changespritestat(i,121); - break; - case RRTILE8487: - case RRTILE8489: - if (!isRRRA()) goto default_case; - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->extra = 0; - sp->cstat |= 257; - sp->hitag = 0; - changespritestat(i,117); - break; - case RRTILE7424: - if (!isRRRA()) goto default_case; - sp->extra = 0; - sp->xrepeat = 0; - sp->yrepeat = 0; - changespritestat(i,11); - break; - case RRTILE7936: - if (!isRRRA()) goto default_case; - sp->xrepeat = 0; - sp->yrepeat = 0; - fogactive = 1; - break; - case RRTILE6144: - if (!isRRRA()) goto default_case; - sp->xrepeat = 0; - sp->yrepeat = 0; - ps[screenpeek].sea_sick_stat = 1; - break; - case RRTILE8448: - if (!isRRRA()) goto default_case; - sp->lotag = 1; - sp->clipdist = 0; - break; - case RRTILE8099: - if (!isRRRA()) goto default_case; - sp->lotag = 5; - sp->clipdist = 0; - changespritestat(i,123); - break; - case RRTILE8704: - if (!isRRRA()) goto default_case; - sp->lotag = 1; - sp->clipdist = 0; - break; - case RRTILE8192: - if (!isRRRA()) goto default_case; - sp->xrepeat = 0; - sp->yrepeat = 0; - ufospawnsminion = 1; - break; - case RRTILE8193: - if (!isRRRA()) goto default_case; - sp->xrepeat = 0; - sp->yrepeat = 0; - pistonsound = 1; - break; - case RRTILE8165: - if (!isRRRA()) goto default_case; - sp->lotag = 1; - sp->clipdist = 0; - sp->owner = i; - sp->extra = 0; - changespritestat(i,115); - break; - case RRTILE8593: - if (!isRRRA()) goto default_case; - sp->lotag = 1; - sp->clipdist = 0; - sp->owner = i; - sp->extra = 0; - changespritestat(i,122); - break; - case RRTILE285: - case RRTILE286: - case RRTILE287: - case RRTILE288: - case RRTILE289: - case RRTILE290: - case RRTILE291: - case RRTILE292: - case RRTILE293: - sp->cstat = 0; - sp->cstat |= 32768; - sp->xrepeat = 0; - sp->yrepeat = 0; - sp->clipdist = 0; - sp->lotag = 0; - changespritestat(i,106); - break; + break; + case RRTILE280: + case RRTILE281: + case RRTILE282: + case RRTILE283: + case RRTILE2025: + case RRTILE2026: + case RRTILE2027: + case RRTILE2028: + sp->cstat = 0; + sp->cstat |= 32768; + sp->xrepeat = 0; + sp->yrepeat = 0; + sp->clipdist = 0; + sp->extra = 0; + changespritestat(i,105); + break; + case RRTILE3410: + sp->extra = 0; + changespritestat(i,107); + break; + case RRTILE8450: + if (!isRRRA()) goto default_case; + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->extra = sp->lotag; + sp->cstat |= 257; + changespritestat(i,116); + break; + case PIG+11: + if (!isRRRA()) goto default_case; + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = 0; + sp->extra = 0; + sp->cstat = 0; + changespritestat(i,121); + break; + case RRTILE8487: + case RRTILE8489: + if (!isRRRA()) goto default_case; + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->extra = 0; + sp->cstat |= 257; + sp->hitag = 0; + changespritestat(i,117); + break; + case RRTILE7424: + if (!isRRRA()) goto default_case; + sp->extra = 0; + sp->xrepeat = 0; + sp->yrepeat = 0; + changespritestat(i,11); + break; + case RRTILE7936: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + fogactive = 1; + break; + case RRTILE6144: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + ps[screenpeek].sea_sick_stat = 1; + break; + case RRTILE8448: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + break; + case RRTILE8099: + if (!isRRRA()) goto default_case; + sp->lotag = 5; + sp->clipdist = 0; + changespritestat(i,123); + break; + case RRTILE8704: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + break; + case RRTILE8192: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + ufospawnsminion = 1; + break; + case RRTILE8193: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + pistonsound = 1; + break; + case RRTILE8165: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + sp->owner = i; + sp->extra = 0; + changespritestat(i,115); + break; + case RRTILE8593: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + sp->owner = i; + sp->extra = 0; + changespritestat(i,122); + break; + case RRTILE285: + case RRTILE286: + case RRTILE287: + case RRTILE288: + case RRTILE289: + case RRTILE290: + case RRTILE291: + case RRTILE292: + case RRTILE293: + sp->cstat = 0; + sp->cstat |= 32768; + sp->xrepeat = 0; + sp->yrepeat = 0; + sp->clipdist = 0; + sp->lotag = 0; + changespritestat(i,106); + break; - case RRTILE2460: - case RRTILE2465: - case BIKEJIBA: - case BIKEJIBB: - case BIKEJIBC: - case BIKERJIBA: - case BIKERJIBB: - case BIKERJIBC: - case BIKERJIBD: - case CHEERJIBA: - case CHEERJIBB: - case CHEERJIBC: - case CHEERJIBD: - case FBOATJIBA: - case FBOATJIBB: - case RABBITJIBA: - case RABBITJIBB: - case RABBITJIBC: - case MAMAJIBA: - case MAMAJIBB: - // impossible to do with better methods outside of redoing the entire switch/case block - if (isRRRA()) goto rrra_badguy; - else goto default_case; + case RRTILE2460: + case RRTILE2465: + case BIKEJIBA: + case BIKEJIBB: + case BIKEJIBC: + case BIKERJIBA: + case BIKERJIBB: + case BIKERJIBC: + case BIKERJIBD: + case CHEERJIBA: + case CHEERJIBB: + case CHEERJIBC: + case CHEERJIBD: + case FBOATJIBA: + case FBOATJIBB: + case RABBITJIBA: + case RABBITJIBB: + case RABBITJIBC: + case MAMAJIBA: + case MAMAJIBB: + // impossible to do with better methods outside of redoing the entire switch/case block + if (isRRRA()) goto rrra_badguy; + else goto default_case; - case WATERSPLASH2: - case MUD: - if (j >= 0) - { - setsprite(i, sprite[j].x, sprite[j].y, sprite[j].z); - sp->xrepeat = sp->yrepeat = 8+(krand()&7); - } - else sp->xrepeat = sp->yrepeat = 16+(krand()&15); + case WATERSPLASH2: + case MUD: + if (j >= 0) + { + setsprite(i, sprite[j].x, sprite[j].y, sprite[j].z); + sp->xrepeat = sp->yrepeat = 8+(krand()&7); + } + else sp->xrepeat = sp->yrepeat = 16+(krand()&15); - sp->shade = -16; - sp->cstat |= 128; - if (j >= 0) - { - if (sector[sprite[j].sectnum].lotag == 2) - { - sp->z = getceilzofslope(sp->sectnum, sp->x, sp->y) + (16 << 8); - sp->cstat |= 8; - } - else if (sector[sprite[j].sectnum].lotag == 1) - sp->z = getflorzofslope(sp->sectnum, sp->x, sp->y); - } + sp->shade = -16; + sp->cstat |= 128; + if (j >= 0) + { + if (sector[sprite[j].sectnum].lotag == 2) + { + sp->z = getceilzofslope(sp->sectnum, sp->x, sp->y) + (16 << 8); + sp->cstat |= 8; + } + else if (sector[sprite[j].sectnum].lotag == 1) + sp->z = getflorzofslope(sp->sectnum, sp->x, sp->y); + } - if(sector[sect].floorpicnum == FLOORSLIME || - sector[sect].ceilingpicnum == FLOORSLIME) - sp->pal = 7; - case NEON1: - case NEON2: - case NEON3: - case NEON4: - case NEON5: - case NEON6: - case DOMELITE: - if(sp->picnum != WATERSPLASH2) - sp->cstat |= 257; - if(sp->picnum == DOMELITE) - sp->cstat |= 257; - case JIBS1: - case JIBS2: - case JIBS3: - case JIBS4: - case JIBS5: - case JIBS6: - case DUKETORSO: - case DUKEGUN: - case DUKELEG: - case BILLYJIBA: - case BILLYJIBB: - case HULKJIBA: - case HULKJIBB: - case HULKJIBC: - case MINJIBA: - case MINJIBB: - case MINJIBC: - case COOTJIBA: - case COOTJIBB: - case COOTJIBC: - rrra_badguy: - if (sp->picnum == JIBS6) - { - sp->xrepeat >>= 1; - sp->yrepeat >>= 1; - } - else if (isRRRA()) - { - if (sp->picnum == RABBITJIBA) - { - sp->xrepeat = 18; - sp->yrepeat = 18; - } - else if (sp->picnum == RABBITJIBB) - { - sp->xrepeat = 36; - sp->yrepeat = 36; - } - else if (sp->picnum == RABBITJIBC) - { - sp->xrepeat = 54; - sp->yrepeat = 54; - } - } - changespritestat(i,5); - break; - case TONGUE: - if(j >= 0) - sp->ang = sprite[j].ang; - sp->z -= 38<<8; - sp->zvel = 256-(krand()&511); - sp->xvel = 64-(krand()&127); - changespritestat(i,4); - break; - case TRANSPORTERSTAR: - case TRANSPORTERBEAM: + if(sector[sect].floorpicnum == FLOORSLIME || + sector[sect].ceilingpicnum == FLOORSLIME) + sp->pal = 7; + case NEON1: + case NEON2: + case NEON3: + case NEON4: + case NEON5: + case NEON6: + case DOMELITE: + if(sp->picnum != WATERSPLASH2) + sp->cstat |= 257; + if(sp->picnum == DOMELITE) + sp->cstat |= 257; + case JIBS1: + case JIBS2: + case JIBS3: + case JIBS4: + case JIBS5: + case JIBS6: + case DUKETORSO: + case DUKEGUN: + case DUKELEG: + case BILLYJIBA: + case BILLYJIBB: + case HULKJIBA: + case HULKJIBB: + case HULKJIBC: + case MINJIBA: + case MINJIBB: + case MINJIBC: + case COOTJIBA: + case COOTJIBB: + case COOTJIBC: + rrra_badguy: + if (sp->picnum == JIBS6) + { + sp->xrepeat >>= 1; + sp->yrepeat >>= 1; + } + else if (isRRRA()) + { + if (sp->picnum == RABBITJIBA) + { + sp->xrepeat = 18; + sp->yrepeat = 18; + } + else if (sp->picnum == RABBITJIBB) + { + sp->xrepeat = 36; + sp->yrepeat = 36; + } + else if (sp->picnum == RABBITJIBC) + { + sp->xrepeat = 54; + sp->yrepeat = 54; + } + } + changespritestat(i,5); + break; + case TONGUE: + if(j >= 0) + sp->ang = sprite[j].ang; + sp->z -= 38<<8; + sp->zvel = 256-(krand()&511); + sp->xvel = 64-(krand()&127); + changespritestat(i,4); + break; + case TRANSPORTERSTAR: + case TRANSPORTERBEAM: spawntransporter(j, i, sp->picnum == TRANSPORTERBEAM); - break; + break; - case FRAMEEFFECT1: - if (j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - if (sprite[j].picnum == APLAYER) - t[1] = SMALLSMOKE; - else - t[1] = sprite[j].picnum; - } - else sp->xrepeat = sp->yrepeat = 0; + case FRAMEEFFECT1: + if (j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + if (sprite[j].picnum == APLAYER) + t[1] = SMALLSMOKE; + else + t[1] = sprite[j].picnum; + } + else sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; + changespritestat(i,5); + break; - case FORCESPHERE: - if (j == -1) - { - sp->cstat = (short)32768; - changespritestat(i,2); - } - else - { - sp->xrepeat = sp->yrepeat = 1; - changespritestat(i,5); - } - break; + case FORCESPHERE: + if (j == -1) + { + sp->cstat = (short)32768; + changespritestat(i,2); + } + else + { + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + } + break; - case BLOOD: - sp->xrepeat = sp->yrepeat = 4; - sp->z -= (26<<8); - changespritestat(i,5); - break; - case BLOODPOOL: + case BLOOD: + sp->xrepeat = sp->yrepeat = 4; + sp->z -= (26<<8); + changespritestat(i,5); + break; + case BLOODPOOL: if (spawnbloodpoolpart1(j, i)) break; - if(j >= 0) - { - if( sprite[j].pal == 1) - sp->pal = 1; - else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE ) - { - sp->pal = 2; // Red - } - else sp->pal = 0; // green + if(j >= 0) + { + if( sprite[j].pal == 1) + sp->pal = 1; + else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE ) + { + sp->pal = 2; // Red + } + else sp->pal = 0; // green - if(sprite[j].picnum == TIRE) - sp->shade = 127; - } - sp->cstat |= 32; + if(sprite[j].picnum == TIRE) + sp->shade = 127; + } + sp->cstat |= 32; - case BLOODSPLAT1: - case BLOODSPLAT2: - case BLOODSPLAT3: - case BLOODSPLAT4: - sp->cstat |= 16; - sp->xrepeat = 7+(krand()&7); - sp->yrepeat = 7+(krand()&7); - sp->z -= (16<<8); - if(j >= 0 && sprite[j].pal == 6) - sp->pal = 6; - insertspriteq(i); - changespritestat(i,5); - break; + case BLOODSPLAT1: + case BLOODSPLAT2: + case BLOODSPLAT3: + case BLOODSPLAT4: + sp->cstat |= 16; + sp->xrepeat = 7+(krand()&7); + sp->yrepeat = 7+(krand()&7); + sp->z -= (16<<8); + if(j >= 0 && sprite[j].pal == 6) + sp->pal = 6; + insertspriteq(i); + changespritestat(i,5); + break; - case HYDRENT: - case SATELITE: - case FUELPOD: - case SOLARPANNEL: - case ANTENNA: - case GRATE1: - case CHAIR1: - case CHAIR2: - case CHAIR3: - case BOTTLE1: - case BOTTLE2: - case BOTTLE3: - case BOTTLE4: - case BOTTLE5: - case BOTTLE6: - case BOTTLE7: - case BOTTLE8: - case BOTTLE10: - case BOTTLE11: - case BOTTLE12: - case BOTTLE13: - case BOTTLE14: - case BOTTLE15: - case BOTTLE16: - case BOTTLE17: - case BOTTLE18: - case BOTTLE19: - case SCALE: - case VACUUM: - case FANSPRITE: - case CACTUS: - case CACTUSBROKE: - case CAMERALIGHT: - case MOVIECAMERA: - case IVUNIT: - case POT1: - case POT2: - case POT3: - case SUSHIPLATE1: - case SUSHIPLATE2: - case SUSHIPLATE3: - case SUSHIPLATE4: - case SUSHIPLATE5: - case WAITTOBESEATED: - case VASE: - case PIPE1: - case PIPE2: - case PIPE3: - case PIPE4: - case PIPE5: - case PIPE6: - sp->clipdist = 32; - sp->cstat |= 257; - changespritestat(i,0); - break; - case FEMMAG1: - case FEMMAG2: - sp->cstat &= ~257; - changespritestat(i,0); - break; + case HYDRENT: + case SATELITE: + case FUELPOD: + case SOLARPANNEL: + case ANTENNA: + case GRATE1: + case CHAIR1: + case CHAIR2: + case CHAIR3: + case BOTTLE1: + case BOTTLE2: + case BOTTLE3: + case BOTTLE4: + case BOTTLE5: + case BOTTLE6: + case BOTTLE7: + case BOTTLE8: + case BOTTLE10: + case BOTTLE11: + case BOTTLE12: + case BOTTLE13: + case BOTTLE14: + case BOTTLE15: + case BOTTLE16: + case BOTTLE17: + case BOTTLE18: + case BOTTLE19: + case SCALE: + case VACUUM: + case FANSPRITE: + case CACTUS: + case CACTUSBROKE: + case CAMERALIGHT: + case MOVIECAMERA: + case IVUNIT: + case POT1: + case POT2: + case POT3: + case SUSHIPLATE1: + case SUSHIPLATE2: + case SUSHIPLATE3: + case SUSHIPLATE4: + case SUSHIPLATE5: + case WAITTOBESEATED: + case VASE: + case PIPE1: + case PIPE2: + case PIPE3: + case PIPE4: + case PIPE5: + case PIPE6: + sp->clipdist = 32; + sp->cstat |= 257; + changespritestat(i,0); + break; + case FEMMAG1: + case FEMMAG2: + sp->cstat &= ~257; + changespritestat(i,0); + break; - case MASKWALL7: - j = sp->cstat&60; - sp->cstat = j|1; - changespritestat(i,0); - break; - case FOOTPRINTS: - case FOOTPRINTS2: - case FOOTPRINTS3: - case FOOTPRINTS4: + case MASKWALL7: + j = sp->cstat&60; + sp->cstat = j|1; + changespritestat(i,0); + break; + case FOOTPRINTS: + case FOOTPRINTS2: + case FOOTPRINTS3: + case FOOTPRINTS4: initfootprint(j, i); - break; - case FEM10: - case NAKED1: - case STATUE: - case TOUGHGAL: - sp->yvel = sp->hitag; - sp->hitag = -1; - case QUEBALL: - case STRIPEBALL: - if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) - { - sp->cstat = 256; - sp->clipdist = 8; - } - else - { - sp->cstat |= 257; - sp->clipdist = 32; - } - changespritestat(i,2); - break; - case BOWLINGBALL: - sp->cstat = 256; - sp->clipdist = 64; - sp->xrepeat = 11; - sp->yrepeat = 9; - changespritestat(i,2); - break; - case HENSTAND: - sp->cstat = 257; - sp->clipdist = 48; - sp->xrepeat = 21; - sp->yrepeat = 15; - changespritestat(i,2); - break; - case RRTILE295: - sp->cstat |= 32768; - changespritestat(i,107); - break; - case RRTILE296: - case RRTILE297: - sp->xrepeat = 64; - sp->yrepeat = 64; - sp->clipdist = 64; - changespritestat(i,108); - break; - case RRTILE3190: - case RRTILE3191: - case RRTILE3192: - sp->cstat = 257; - sp->clipdist = 8; - sp->xrepeat = 32; - sp->yrepeat = 26; - sp->xvel = 32; - changespritestat(i,1); - break; - case RRTILE3120: - sp->cstat = 257; - sp->clipdist = 8; - sp->xrepeat = 12; - sp->yrepeat = 10; - sp->xvel = 32; - changespritestat(i,1); - break; - case RRTILE3122: - sp->cstat = 257; - sp->clipdist = 2; - sp->xrepeat = 8; - sp->yrepeat = 6; - sp->xvel = 16; - changespritestat(i,1); - break; - case RRTILE3123: - sp->cstat = 257; - sp->clipdist = 8; - sp->xrepeat = 13; - sp->yrepeat = 13; - sp->xvel = 16; - changespritestat(i,1); - break; - case RRTILE3124: - sp->cstat = 257; - sp->clipdist = 8; - sp->xrepeat = 17; - sp->yrepeat = 12; - sp->xvel = 32; - changespritestat(i,1); - break; - case RRTILE3132: - sp->cstat = 257; - sp->clipdist = 8; - sp->xrepeat = 13; - sp->yrepeat = 10; - sp->xvel = 0; - changespritestat(i,1); - break; - case RRTILE3440: - sp->cstat = 257; - sp->clipdist = 48; - sp->xrepeat = 23; - sp->yrepeat = 23; - changespritestat(i,2); - break; - case DUKELYINGDEAD: - if(j >= 0 && sprite[j].picnum == APLAYER) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->shade = sprite[j].shade; - sp->pal = ps[sprite[j].yvel].palookup; - } - sp->cstat = 0; - sp->extra = 1; - sp->xvel = 292; - sp->zvel = 360; - case RESPAWNMARKERRED: - if(sp->picnum == RESPAWNMARKERRED) - { - sp->xrepeat = sp->yrepeat = 8; - if(j >= 0) sp->z = hittype[j].floorz; - } - else - { - sp->cstat |= 257; - sp->clipdist = 128; - } - case MIKE: - if(sp->picnum == MIKE) - sp->yvel = sp->hitag; - changespritestat(i,1); - break; + break; + case FEM10: + case NAKED1: + case STATUE: + case TOUGHGAL: + sp->yvel = sp->hitag; + sp->hitag = -1; + case QUEBALL: + case STRIPEBALL: + if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) + { + sp->cstat = 256; + sp->clipdist = 8; + } + else + { + sp->cstat |= 257; + sp->clipdist = 32; + } + changespritestat(i,2); + break; + case BOWLINGBALL: + sp->cstat = 256; + sp->clipdist = 64; + sp->xrepeat = 11; + sp->yrepeat = 9; + changespritestat(i,2); + break; + case HENSTAND: + sp->cstat = 257; + sp->clipdist = 48; + sp->xrepeat = 21; + sp->yrepeat = 15; + changespritestat(i,2); + break; + case RRTILE295: + sp->cstat |= 32768; + changespritestat(i,107); + break; + case RRTILE296: + case RRTILE297: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->clipdist = 64; + changespritestat(i,108); + break; + case RRTILE3190: + case RRTILE3191: + case RRTILE3192: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 32; + sp->yrepeat = 26; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3120: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 12; + sp->yrepeat = 10; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3122: + sp->cstat = 257; + sp->clipdist = 2; + sp->xrepeat = 8; + sp->yrepeat = 6; + sp->xvel = 16; + changespritestat(i,1); + break; + case RRTILE3123: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 13; + sp->yrepeat = 13; + sp->xvel = 16; + changespritestat(i,1); + break; + case RRTILE3124: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 17; + sp->yrepeat = 12; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3132: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 13; + sp->yrepeat = 10; + sp->xvel = 0; + changespritestat(i,1); + break; + case RRTILE3440: + sp->cstat = 257; + sp->clipdist = 48; + sp->xrepeat = 23; + sp->yrepeat = 23; + changespritestat(i,2); + break; + case DUKELYINGDEAD: + if(j >= 0 && sprite[j].picnum == APLAYER) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + sp->shade = sprite[j].shade; + sp->pal = ps[sprite[j].yvel].palookup; + } + sp->cstat = 0; + sp->extra = 1; + sp->xvel = 292; + sp->zvel = 360; + case RESPAWNMARKERRED: + if(sp->picnum == RESPAWNMARKERRED) + { + sp->xrepeat = sp->yrepeat = 8; + if(j >= 0) sp->z = hittype[j].floorz; + } + else + { + sp->cstat |= 257; + sp->clipdist = 128; + } + case MIKE: + if(sp->picnum == MIKE) + sp->yvel = sp->hitag; + changespritestat(i,1); + break; - case SPOTLITE: - t[0] = sp->x; - t[1] = sp->y; - break; - case BULLETHOLE: - sp->xrepeat = sp->yrepeat = 3; - sp->cstat = 16+(krand()&12); - insertspriteq(i); - case MONEY: - if(sp->picnum == MONEY) - { - hittype[i].temp_data[0] = krand()&2047; - sp->cstat = krand()&12; - sp->xrepeat = sp->yrepeat = 8; - sp->ang = krand()&2047; - } - changespritestat(i,5); - break; + case SPOTLITE: + t[0] = sp->x; + t[1] = sp->y; + break; + case BULLETHOLE: + sp->xrepeat = sp->yrepeat = 3; + sp->cstat = 16+(krand()&12); + insertspriteq(i); + case MONEY: + if(sp->picnum == MONEY) + { + hittype[i].temp_data[0] = krand()&2047; + sp->cstat = krand()&12; + sp->xrepeat = sp->yrepeat = 8; + sp->ang = krand()&2047; + } + changespritestat(i,5); + break; - case SHELL: //From the player - case SHOTGUNSHELL: + case SHELL: //From the player + case SHOTGUNSHELL: initshell(j, i, sp->picnum == SHELL); - break; - case RESPAWN: - sp->extra = 66-13; - case MUSICANDSFX: - if (ud.multimode < 2 && sp->pal == 1) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - sp->cstat = (short)32768; - changespritestat(i,11); - break; - case SOUNDFX: - { - short tg; - sp->cstat |= 32768; - changespritestat(i,2); - tg = sp->hitag; - tg = sp->lotag; - } - break; - case EXPLOSION2: - case EXPLOSION3: - case BURNING: - case SMALLSMOKE: - if(j >= 0) - { - sp->ang = sprite[j].ang; - sp->shade = -64; - sp->cstat = 128|(krand()&4); - } + break; + case RESPAWN: + sp->extra = 66-13; + case MUSICANDSFX: + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + sp->cstat = (short)32768; + changespritestat(i,11); + break; + case SOUNDFX: + { + short tg; + sp->cstat |= 32768; + changespritestat(i,2); + tg = sp->hitag; + tg = sp->lotag; + } + break; + case EXPLOSION2: + case EXPLOSION3: + case BURNING: + case SMALLSMOKE: + if(j >= 0) + { + sp->ang = sprite[j].ang; + sp->shade = -64; + sp->cstat = 128|(krand()&4); + } - if(sp->picnum == EXPLOSION2) - { - sp->xrepeat = 48; - sp->yrepeat = 48; - sp->shade = -127; - sp->cstat |= 128; - } - else if(sp->picnum == EXPLOSION3) - { - sp->xrepeat = 128; - sp->yrepeat = 128; - sp->shade = -127; - sp->cstat |= 128; - } - else if(sp->picnum == SMALLSMOKE) - { - sp->xrepeat = 12; - sp->yrepeat = 12; - } - else if(sp->picnum == BURNING) - { - sp->xrepeat = 4; - sp->yrepeat = 4; - } + if(sp->picnum == EXPLOSION2) + { + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->shade = -127; + sp->cstat |= 128; + } + else if(sp->picnum == EXPLOSION3) + { + sp->xrepeat = 128; + sp->yrepeat = 128; + sp->shade = -127; + sp->cstat |= 128; + } + else if(sp->picnum == SMALLSMOKE) + { + sp->xrepeat = 12; + sp->yrepeat = 12; + } + else if(sp->picnum == BURNING) + { + sp->xrepeat = 4; + sp->yrepeat = 4; + } - if(j >= 0) - { - x = getflorzofslope(sp->sectnum,sp->x,sp->y); - if(sp->z > x-(12<<8) ) - sp->z = x-(12<<8); - } + if(j >= 0) + { + x = getflorzofslope(sp->sectnum,sp->x,sp->y); + if(sp->z > x-(12<<8) ) + sp->z = x-(12<<8); + } - changespritestat(i,5); + changespritestat(i,5); - break; + break; - case PLAYERONWATER: - if(j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->zvel = 128; - if(sector[sp->sectnum].lotag != 2) - sp->cstat |= 32768; - } - changespritestat(i,13); - break; + case PLAYERONWATER: + if(j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + sp->zvel = 128; + if(sector[sp->sectnum].lotag != 2) + sp->cstat |= 32768; + } + changespritestat(i,13); + break; - case APLAYER: - sp->xrepeat = sp->yrepeat = 0; - j = ud.coop; - if(j == 2) j = 0; + case APLAYER: + sp->xrepeat = sp->yrepeat = 0; + j = ud.coop; + if(j == 2) j = 0; - if( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) - changespritestat(i,5); - else - changespritestat(i,10); - break; + if( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) + changespritestat(i,5); + else + changespritestat(i,10); + break; - case WATERBUBBLE: - if(j >= 0 && sprite[j].picnum == APLAYER) - sp->z-= (16<<8); - if(sp->picnum == WATERBUBBLE) - { - if(j >= 0) - sp->ang = sprite[j].ang; - sp->xrepeat = sp->yrepeat = 1+(krand()&7); - } - else - sp->xrepeat = sp->yrepeat = 32; - changespritestat(i,5); - break; - case CRANE: + case WATERBUBBLE: + if(j >= 0 && sprite[j].picnum == APLAYER) + sp->z-= (16<<8); + if(sp->picnum == WATERBUBBLE) + { + if(j >= 0) + sp->ang = sprite[j].ang; + sp->xrepeat = sp->yrepeat = 1+(krand()&7); + } + else + sp->xrepeat = sp->yrepeat = 32; + changespritestat(i,5); + break; + case CRANE: initcrane(j, i, CRANEPOLE); - break; - case WATERDRIP: - initwaterdrip(j, i); - break; - case TRASH: + break; + case WATERDRIP: + initwaterdrip(j, i); + break; + case TRASH: - if(sp->picnum != WATERDRIP) sp->ang = krand()&2047; + if(sp->picnum != WATERDRIP) sp->ang = krand()&2047; - sp->xrepeat = 24; - sp->yrepeat = 24; - changespritestat(i,6); - break; + sp->xrepeat = 24; + sp->yrepeat = 24; + changespritestat(i,6); + break; - case PLUG: - sp->lotag = 9999; - changespritestat(i,6); - break; - case TOUCHPLATE: - t[2] = sector[sect].floorz; - if(sector[sect].lotag != 1 && sector[sect].lotag != 2) - sector[sect].floorz = sp->z; - if(sp->pal && ud.multimode > 1) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - case WATERBUBBLEMAKER: - sp->cstat |= 32768; - changespritestat(i,6); - break; - case BOLT1: - case BOLT1+1: - case BOLT1+2: - case BOLT1+3: - t[0] = sp->xrepeat; - t[1] = sp->yrepeat; - case MASTERSWITCH: - if(sp->picnum == MASTERSWITCH) - sp->cstat |= 32768; - sp->yvel = 0; - changespritestat(i,6); - break; + case PLUG: + sp->lotag = 9999; + changespritestat(i,6); + break; + case TOUCHPLATE: + t[2] = sector[sect].floorz; + if(sector[sect].lotag != 1 && sector[sect].lotag != 2) + sector[sect].floorz = sp->z; + if(sp->pal && ud.multimode > 1) + { + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); + break; + } + case WATERBUBBLEMAKER: + sp->cstat |= 32768; + changespritestat(i,6); + break; + case BOLT1: + case BOLT1+1: + case BOLT1+2: + case BOLT1+3: + t[0] = sp->xrepeat; + t[1] = sp->yrepeat; + case MASTERSWITCH: + if(sp->picnum == MASTERSWITCH) + sp->cstat |= 32768; + sp->yvel = 0; + changespritestat(i,6); + break; - // this is not really nice... - case BIKERB: - case BIKERBV2: - case BIKER: - case MAKEOUT: - case CHEERB: - case CHEER: - case COOTPLAY: - case BILLYPLAY: - case MINIONBOAT: - case HULKBOAT: - case CHEERBOAT: - case RABBIT: - case ROCK: - case ROCK2: - case MAMACLOUD: - case MAMA: - case UFO1_RRRA: - if (isRRRA()) goto rrra_badguy2; - else goto default_case; + // this is not really nice... + case BIKERB: + case BIKERBV2: + case BIKER: + case MAKEOUT: + case CHEERB: + case CHEER: + case COOTPLAY: + case BILLYPLAY: + case MINIONBOAT: + case HULKBOAT: + case CHEERBOAT: + case RABBIT: + case ROCK: + case ROCK2: + case MAMACLOUD: + case MAMA: + case UFO1_RRRA: + if (isRRRA()) goto rrra_badguy2; + else goto default_case; - case UFO1_RR: - if (!isRRRA()) goto rrra_badguy2; - else goto default_case; + case UFO1_RR: + if (!isRRRA()) goto rrra_badguy2; + else goto default_case; - case SBSWIPE: - case CHEERSTAYPUT: - if (isRRRA()) goto rrra_stayput; - else goto default_case; - case SBMOVE: - if (isRRRA()) goto default_case; + case SBSWIPE: + case CHEERSTAYPUT: + if (isRRRA()) goto rrra_stayput; + else goto default_case; + case SBMOVE: + if (isRRRA()) goto default_case; - case BILLYRAYSTAYPUT: - case BRAYSNIPER: - case BUBBASTAND: - case HULKSTAYPUT: - case HENSTAYPUT: - case PIGSTAYPUT: - case MINIONSTAYPUT: - case COOTSTAYPUT: - rrra_stayput: - hittype[i].actorstayput = sp->sectnum; - case BOULDER: - case BOULDER1: - case RAT: - case TORNADO: - case BILLYCOCK: - case BILLYRAY: - case DOGRUN: - case LTH: - case HULK: - case HEN: - case DRONE: - case PIG: - case MINION: - case UFO2: - case UFO3: - case UFO4: - case UFO5: - case COW: - case COOT: - case SHARK: - case VIXEN: - rrra_badguy2: - sp->xrepeat = 40; - sp->yrepeat = 40; - // Note: All inappropriate tiles have already been weeded out by the outer switch block so this does not need game type checks anymore. - switch (sp->picnum) - { - case VIXEN: - if (sp->pal == 34) - { - sp->xrepeat = 22; - sp->yrepeat = 21; - } - else - { - sp->xrepeat = 22; - sp->yrepeat = 20; - } - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case HULKHANG: - case HULKHANGDEAD: - case HULKJUMP: - case HULK: - case HULKSTAYPUT: - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case COOTPLAY: - case COOT: - case COOTSTAYPUT: - sp->xrepeat = 24; - sp->yrepeat = 18; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - sp->clipdist <<= 2; - break; - case DRONE: - sp->xrepeat = 14; - sp->yrepeat = 7; - sp->clipdist = 128; - break; - case SBSWIPE: - case BILLYPLAY: - case BILLYCOCK: - case BILLYRAY: - case BILLYRAYSTAYPUT: - case BRAYSNIPER: - case BUBBASTAND: - sp->xrepeat = 25; - sp->yrepeat = 21; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case COW: - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case HEN: - case HENSTAYPUT: - case HENSTAND: - if(sp->pal == 35) - { - sp->xrepeat = 42; - sp->yrepeat = 30; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - } - else - { - sp->xrepeat = 21; - sp->yrepeat = 15; - sp->clipdist = 64; - } - break; - case MINION: - case MINIONSTAYPUT: - sp->xrepeat = 16; - sp->yrepeat = 16; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - if (isRRRA() && ufospawnsminion) - sp->pal = 8; - break; - case DOGRUN: - case PIG: - sp->xrepeat = 16; - sp->yrepeat = 16; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case RABBIT: - sp->xrepeat = 18; - sp->yrepeat = 18; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case MAMACLOUD: - sp->xrepeat = 64; - sp->yrepeat = 64; - sp->cstat = 2; - sp->cstat |= 512; - sp->x += (krand()&2047)-1024; - sp->y += (krand()&2047)-1024; - sp->z += (krand()&2047)-1024; - break; - case MAMA: - if (sp->pal == 30) - { - sp->xrepeat = 26; - sp->yrepeat = 26; - sp->clipdist = 75; - } - else if (sp->pal == 31) - { - sp->xrepeat = 36; - sp->yrepeat = 36; - sp->clipdist = 100; - } - else if (sp->pal == 32) - { - sp->xrepeat = 50; - sp->yrepeat = 50; - sp->clipdist = 100; - } - else - { - sp->xrepeat = 50; - sp->yrepeat = 50; - sp->clipdist = 100; - } - break; - case BIKERB: - sp->xrepeat = 28; - sp->yrepeat = 22; - sp->clipdist = 72; - break; - case BIKERBV2: - sp->xrepeat = 28; - sp->yrepeat = 22; - sp->clipdist = 72; - break; - case BIKER: - sp->xrepeat = 28; - sp->yrepeat = 22; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case CHEERB: - sp->xrepeat = 28; - sp->yrepeat = 22; - sp->clipdist = 72; - break; - case CHEER: - case CHEERSTAYPUT: - sp->xrepeat = 20; - sp->yrepeat = 20; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case MAKEOUT: - sp->xrepeat = 26; - sp->yrepeat = 26; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case MINIONBOAT: - sp->xrepeat = 16; - sp->yrepeat = 16; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case HULKBOAT: - sp->xrepeat = 48; - sp->yrepeat = 48; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case CHEERBOAT: - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; + case BILLYRAYSTAYPUT: + case BRAYSNIPER: + case BUBBASTAND: + case HULKSTAYPUT: + case HENSTAYPUT: + case PIGSTAYPUT: + case MINIONSTAYPUT: + case COOTSTAYPUT: + rrra_stayput: + hittype[i].actorstayput = sp->sectnum; + case BOULDER: + case BOULDER1: + case RAT: + case TORNADO: + case BILLYCOCK: + case BILLYRAY: + case DOGRUN: + case LTH: + case HULK: + case HEN: + case DRONE: + case PIG: + case MINION: + case UFO2: + case UFO3: + case UFO4: + case UFO5: + case COW: + case COOT: + case SHARK: + case VIXEN: + rrra_badguy2: + sp->xrepeat = 40; + sp->yrepeat = 40; + // Note: All inappropriate tiles have already been weeded out by the outer switch block so this does not need game type checks anymore. + switch (sp->picnum) + { + case VIXEN: + if (sp->pal == 34) + { + sp->xrepeat = 22; + sp->yrepeat = 21; + } + else + { + sp->xrepeat = 22; + sp->yrepeat = 20; + } + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HULKHANG: + case HULKHANGDEAD: + case HULKJUMP: + case HULK: + case HULKSTAYPUT: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case COOTPLAY: + case COOT: + case COOTSTAYPUT: + sp->xrepeat = 24; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->clipdist <<= 2; + break; + case DRONE: + sp->xrepeat = 14; + sp->yrepeat = 7; + sp->clipdist = 128; + break; + case SBSWIPE: + case BILLYPLAY: + case BILLYCOCK: + case BILLYRAY: + case BILLYRAYSTAYPUT: + case BRAYSNIPER: + case BUBBASTAND: + sp->xrepeat = 25; + sp->yrepeat = 21; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case COW: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HEN: + case HENSTAYPUT: + case HENSTAND: + if(sp->pal == 35) + { + sp->xrepeat = 42; + sp->yrepeat = 30; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + } + else + { + sp->xrepeat = 21; + sp->yrepeat = 15; + sp->clipdist = 64; + } + break; + case MINION: + case MINIONSTAYPUT: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + if (isRRRA() && ufospawnsminion) + sp->pal = 8; + break; + case DOGRUN: + case PIG: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case RABBIT: + sp->xrepeat = 18; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MAMACLOUD: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->cstat = 2; + sp->cstat |= 512; + sp->x += (krand()&2047)-1024; + sp->y += (krand()&2047)-1024; + sp->z += (krand()&2047)-1024; + break; + case MAMA: + if (sp->pal == 30) + { + sp->xrepeat = 26; + sp->yrepeat = 26; + sp->clipdist = 75; + } + else if (sp->pal == 31) + { + sp->xrepeat = 36; + sp->yrepeat = 36; + sp->clipdist = 100; + } + else if (sp->pal == 32) + { + sp->xrepeat = 50; + sp->yrepeat = 50; + sp->clipdist = 100; + } + else + { + sp->xrepeat = 50; + sp->yrepeat = 50; + sp->clipdist = 100; + } + break; + case BIKERB: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case BIKERBV2: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case BIKER: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case CHEERB: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case CHEER: + case CHEERSTAYPUT: + sp->xrepeat = 20; + sp->yrepeat = 20; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MAKEOUT: + sp->xrepeat = 26; + sp->yrepeat = 26; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MINIONBOAT: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HULKBOAT: + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case CHEERBOAT: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; - case TORNADO: - sp->xrepeat = 64; - sp->yrepeat = 128; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - sp->clipdist >>= 2; - sp->cstat = 2; - break; - case LTH: - sp->xrepeat = 24; - sp->yrepeat = 22; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; - case ROCK: - case ROCK2: - sp->xrepeat = 64; - sp->yrepeat = 64; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; + case TORNADO: + sp->xrepeat = 64; + sp->yrepeat = 128; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->clipdist >>= 2; + sp->cstat = 2; + break; + case LTH: + sp->xrepeat = 24; + sp->yrepeat = 22; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case ROCK: + case ROCK2: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; - case UFO1_RRRA: - case UFO1_RR: - case UFO2: - case UFO3: - case UFO4: - case UFO5: - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - sp->extra = 50; - break; - case SBMOVE: - sp->xrepeat = 48; - sp->yrepeat = 48; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - break; + case UFO1_RRRA: + case UFO1_RR: + case UFO2: + case UFO3: + case UFO4: + case UFO5: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->extra = 50; + break; + case SBMOVE: + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; - default: - break; - } + default: + break; + } - if(j >= 0) sp->lotag = 0; + if(j >= 0) sp->lotag = 0; - if( ( sp->lotag > ud.player_skill ) || ud.monsters_off == 1 ) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - else - { - makeitfall(i); + if( ( sp->lotag > ud.player_skill ) || ud.monsters_off == 1 ) + { + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); + break; + } + else + { + makeitfall(i); - if(sp->picnum == RAT) - { - sp->ang = krand()&2047; - sp->xrepeat = sp->yrepeat = 48; - sp->cstat = 0; - } - else - { - sp->cstat |= 257; + if(sp->picnum == RAT) + { + sp->ang = krand()&2047; + sp->xrepeat = sp->yrepeat = 48; + sp->cstat = 0; + } + else + { + sp->cstat |= 257; - if(sp->picnum != 5501) - if (actorfella(i)) - ps[myconnectindex].max_actors_killed++; - } + if(sp->picnum != 5501) + if (actorfella(i)) + ps[myconnectindex].max_actors_killed++; + } - if(j >= 0) - { - hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); - changespritestat(i,1); - } - else changespritestat(i,2); + if(j >= 0) + { + hittype[i].timetosleep = 0; + fi.check_fta_sounds(i); + changespritestat(i,1); + } + else changespritestat(i,2); - sp->shade = sprite[j].shade; - } + sp->shade = sprite[j].shade; + } - break; - case LOCATORS: + break; + case LOCATORS: // sp->xrepeat=sp->yrepeat=0; - sp->cstat |= 32768; - changespritestat(i,7); - break; - - case ACTIVATORLOCKED: - case ACTIVATOR: + sp->cstat |= 32768; + changespritestat(i,7); + break; + + case ACTIVATORLOCKED: + case ACTIVATOR: // sp->xrepeat=sp->yrepeat=0; - sp->cstat |= 32768; - if (sp->picnum == ACTIVATORLOCKED) - sector[sect].lotag ^= 16384; - changespritestat(i,8); - break; - case DOORSHOCK: - sp->cstat |= 1+256; - sp->shade = -12; + sp->cstat |= 32768; + if (sp->picnum == ACTIVATORLOCKED) + sector[sect].lotag ^= 16384; + changespritestat(i,8); + break; + case DOORSHOCK: + sp->cstat |= 1+256; + sp->shade = -12; - changespritestat(i,6); - break; + changespritestat(i,6); + break; - case OOZ: - sp->shade = -12; + case OOZ: + sp->shade = -12; - if(j >= 0) - if( sprite[j].picnum == NUKEBARREL ) - sp->pal = 8; + if(j >= 0) + if( sprite[j].picnum == NUKEBARREL ) + sp->pal = 8; - changespritestat(i,1); + changespritestat(i,1); - getglobalz(i); + getglobalz(i); - j = (hittype[i].floorz-hittype[i].ceilingz)>>9; + j = (hittype[i].floorz-hittype[i].ceilingz)>>9; - sp->yrepeat = j; - sp->xrepeat = 25-(j>>1); - sp->cstat |= (krand()&4); - break; + sp->yrepeat = j; + sp->xrepeat = 25-(j>>1); + sp->cstat |= (krand()&4); + break; - case HEAVYHBOMB: - sp->owner = i; - sp->xrepeat = sp->yrepeat = 9; - sp->yvel = 4; - case REACTOR2: - case REACTOR: - case RECON: + case HEAVYHBOMB: + sp->owner = i; + sp->xrepeat = sp->yrepeat = 9; + sp->yvel = 4; + case REACTOR2: + case REACTOR: + case RECON: if (initreactor(j, i, sp->picnum == RECON)) return i; - break; + break; - case RPG2SPRITE: - case MOTOAMMO: - case BOATAMMO: - if (!isRRRA()) goto default_case; + case RPG2SPRITE: + case MOTOAMMO: + case BOATAMMO: + if (!isRRRA()) goto default_case; - case ATOMICHEALTH: - case STEROIDS: - case HEATSENSOR: - case SHIELD: - case AIRTANK: - case TRIPBOMBSPRITE: - case JETPACK: - case HOLODUKE: + case ATOMICHEALTH: + case STEROIDS: + case HEATSENSOR: + case SHIELD: + case AIRTANK: + case TRIPBOMBSPRITE: + case JETPACK: + case HOLODUKE: - case FIRSTGUNSPRITE: - case CHAINGUNSPRITE: - case SHOTGUNSPRITE: - case RPGSPRITE: - case SHRINKERSPRITE: - case FREEZESPRITE: - case DEVISTATORSPRITE: + case FIRSTGUNSPRITE: + case CHAINGUNSPRITE: + case SHOTGUNSPRITE: + case RPGSPRITE: + case SHRINKERSPRITE: + case FREEZESPRITE: + case DEVISTATORSPRITE: - case SHOTGUNAMMO: - case FREEZEAMMO: - case HBOMBAMMO: - case CRYSTALAMMO: - case GROWAMMO: - case BATTERYAMMO: - case DEVISTATORAMMO: - case RPGAMMO: - case BOOTS: - case AMMO: - case AMMOLOTS: - case COLA: - case FIRSTAID: - case SIXPAK: + case SHOTGUNAMMO: + case FREEZEAMMO: + case HBOMBAMMO: + case CRYSTALAMMO: + case GROWAMMO: + case BATTERYAMMO: + case DEVISTATORAMMO: + case RPGAMMO: + case BOOTS: + case AMMO: + case AMMOLOTS: + case COLA: + case FIRSTAID: + case SIXPAK: - case RRTILE43: - case BOWLINGBALLSPRITE: - if (j >= 0) - { - sp->lotag = 0; - if (sp->picnum != BOWLINGBALLSPRITE) - { - sp->z -= (32 << 8); - sp->zvel = -(4 << 8); - } - else - { - sp->zvel = 0; - } - ssp(i,CLIPMASK0); - sp->cstat = krand()&4; - } - else - { - sp->owner = i; - sp->cstat = 0; - } + case RRTILE43: + case BOWLINGBALLSPRITE: + if (j >= 0) + { + sp->lotag = 0; + if (sp->picnum != BOWLINGBALLSPRITE) + { + sp->z -= (32 << 8); + sp->zvel = -(4 << 8); + } + else + { + sp->zvel = 0; + } + ssp(i,CLIPMASK0); + sp->cstat = krand()&4; + } + else + { + sp->owner = i; + sp->cstat = 0; + } - if( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) ) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } + if( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) ) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } - sp->pal = 0; + sp->pal = 0; - case ACCESSCARD: + case ACCESSCARD: - if (sp->picnum == ATOMICHEALTH) - sp->cstat |= 128; + if (sp->picnum == ATOMICHEALTH) + sp->cstat |= 128; - if(ud.multimode > 1 && ud.coop != 1 && sp->picnum == ACCESSCARD) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - else - { - if(sp->picnum == AMMO) - sp->xrepeat = sp->yrepeat = 16; - else sp->xrepeat = sp->yrepeat = 32; - } + if(ud.multimode > 1 && ud.coop != 1 && sp->picnum == ACCESSCARD) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + else + { + if(sp->picnum == AMMO) + sp->xrepeat = sp->yrepeat = 16; + else sp->xrepeat = sp->yrepeat = 32; + } - sp->shade = -17; + sp->shade = -17; - if(j >= 0) changespritestat(i,1); - else - { - changespritestat(i,2); - makeitfall(i); - } - switch (sp->picnum) - { - case FIRSTGUNSPRITE: - sp->xrepeat = 16; - sp->yrepeat = 16; - break; - case SHOTGUNAMMO: - sp->xrepeat = 18; - sp->yrepeat = 17; - if (isRRRA()) sp->cstat = 256; - break; - case SIXPAK: - sp->xrepeat = 13; - sp->yrepeat = 9; - if (isRRRA()) sp->cstat = 256; - break; - case FIRSTAID: - sp->xrepeat = 8; - sp->yrepeat = 8; - break; - case COLA: - sp->xrepeat = 5; - sp->yrepeat = 4; - break; - case AMMO: - sp->xrepeat = 9; - sp->yrepeat = 9; - break; - case MOTOAMMO: - if (!isRRRA()) goto default_case; - sp->xrepeat = 23; - sp->yrepeat = 23; - break; - case BOATAMMO: - if (!isRRRA()) goto default_case; - sp->xrepeat = 16; - sp->yrepeat = 16; - break; - case JETPACK: - sp->xrepeat = 8; - sp->yrepeat = 6; - break; - case STEROIDS: - sp->xrepeat = 13; - sp->yrepeat = 9; - break; - case ACCESSCARD: - sp->xrepeat = 11; - sp->yrepeat = 12; - break; - case HEATSENSOR: - sp->xrepeat = 6; - sp->yrepeat = 4; - break; - case AIRTANK: - sp->xrepeat = 19; - sp->yrepeat = 16; - break; - case BATTERYAMMO: - sp->xrepeat = 15; - sp->yrepeat = 15; - break; - case BOWLINGBALLSPRITE: - sp->xrepeat = 11; - sp->yrepeat = 11; - break; - case TRIPBOMBSPRITE: - sp->xrepeat = 11; - sp->yrepeat = 11; - sp->yvel = 4; - sp->xvel = 32; - break; - case RPGSPRITE: - sp->xrepeat = 16; - sp->yrepeat = 14; - break; - case RPG2SPRITE: - if (!isRRRA()) goto default_case; - sp->xrepeat = 20; - sp->yrepeat = 20; - break; - case SHRINKERSPRITE: - sp->xrepeat = 22; - sp->yrepeat = 13; - break; - case DEVISTATORSPRITE: - sp->xrepeat = 18; - sp->yrepeat = 17; - break; - case RRTILE43: - sp->xrepeat = 12; - sp->yrepeat = 7; - break; - case GROWSPRITEICON: - sp->xrepeat = 10; - sp->yrepeat = 9; - break; - case DEVISTATORAMMO: - sp->xrepeat = 10; - sp->yrepeat = 9; - break; - case ATOMICHEALTH: - sp->xrepeat = 8; - sp->yrepeat = 8; - break; - case FREEZESPRITE: - sp->xrepeat = 17; - sp->yrepeat = 16; - break; - } - sp->shade = sector[sp->sectnum].floorshade; - break; - case WATERFOUNTAIN: - sp->lotag = 1; - case TREE1: - case TREE2: - case TIRE: - sp->cstat = 257; // Make it hitable - sprite[i].extra = 1; - changespritestat(i,6); - break; + if(j >= 0) changespritestat(i,1); + else + { + changespritestat(i,2); + makeitfall(i); + } + switch (sp->picnum) + { + case FIRSTGUNSPRITE: + sp->xrepeat = 16; + sp->yrepeat = 16; + break; + case SHOTGUNAMMO: + sp->xrepeat = 18; + sp->yrepeat = 17; + if (isRRRA()) sp->cstat = 256; + break; + case SIXPAK: + sp->xrepeat = 13; + sp->yrepeat = 9; + if (isRRRA()) sp->cstat = 256; + break; + case FIRSTAID: + sp->xrepeat = 8; + sp->yrepeat = 8; + break; + case COLA: + sp->xrepeat = 5; + sp->yrepeat = 4; + break; + case AMMO: + sp->xrepeat = 9; + sp->yrepeat = 9; + break; + case MOTOAMMO: + if (!isRRRA()) goto default_case; + sp->xrepeat = 23; + sp->yrepeat = 23; + break; + case BOATAMMO: + if (!isRRRA()) goto default_case; + sp->xrepeat = 16; + sp->yrepeat = 16; + break; + case JETPACK: + sp->xrepeat = 8; + sp->yrepeat = 6; + break; + case STEROIDS: + sp->xrepeat = 13; + sp->yrepeat = 9; + break; + case ACCESSCARD: + sp->xrepeat = 11; + sp->yrepeat = 12; + break; + case HEATSENSOR: + sp->xrepeat = 6; + sp->yrepeat = 4; + break; + case AIRTANK: + sp->xrepeat = 19; + sp->yrepeat = 16; + break; + case BATTERYAMMO: + sp->xrepeat = 15; + sp->yrepeat = 15; + break; + case BOWLINGBALLSPRITE: + sp->xrepeat = 11; + sp->yrepeat = 11; + break; + case TRIPBOMBSPRITE: + sp->xrepeat = 11; + sp->yrepeat = 11; + sp->yvel = 4; + sp->xvel = 32; + break; + case RPGSPRITE: + sp->xrepeat = 16; + sp->yrepeat = 14; + break; + case RPG2SPRITE: + if (!isRRRA()) goto default_case; + sp->xrepeat = 20; + sp->yrepeat = 20; + break; + case SHRINKERSPRITE: + sp->xrepeat = 22; + sp->yrepeat = 13; + break; + case DEVISTATORSPRITE: + sp->xrepeat = 18; + sp->yrepeat = 17; + break; + case RRTILE43: + sp->xrepeat = 12; + sp->yrepeat = 7; + break; + case GROWSPRITEICON: + sp->xrepeat = 10; + sp->yrepeat = 9; + break; + case DEVISTATORAMMO: + sp->xrepeat = 10; + sp->yrepeat = 9; + break; + case ATOMICHEALTH: + sp->xrepeat = 8; + sp->yrepeat = 8; + break; + case FREEZESPRITE: + sp->xrepeat = 17; + sp->yrepeat = 16; + break; + } + sp->shade = sector[sp->sectnum].floorshade; + break; + case WATERFOUNTAIN: + sp->lotag = 1; + case TREE1: + case TREE2: + case TIRE: + sp->cstat = 257; // Make it hitable + sprite[i].extra = 1; + changespritestat(i,6); + break; - case CAMERA1: - case CAMERA1+1: - case CAMERA1+2: - case CAMERA1+3: - case CAMERA1+4: - case CAMERAPOLE: - sp->extra = 1; + case CAMERA1: + case CAMERA1+1: + case CAMERA1+2: + case CAMERA1+3: + case CAMERA1+4: + case CAMERAPOLE: + sp->extra = 1; - if(camerashitable) sp->cstat = 257; - else sp->cstat = 0; + if(camerashitable) sp->cstat = 257; + else sp->cstat = 0; - if( ud.multimode < 2 && sp->pal != 0 ) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - else sp->pal = 0; - if(sp->picnum == CAMERAPOLE) break; - sp->picnum = CAMERA1; - changespritestat(i,1); - break; - case STEAM: - if(j >= 0) - { - sp->ang = sprite[j].ang; - sp->cstat = 16+128+2; - sp->xrepeat=sp->yrepeat=1; - sp->xvel = -8; - ssp(i,CLIPMASK0); - } - case CEILINGSTEAM: - changespritestat(i,6); - break; - case SECTOREFFECTOR: + if( ud.multimode < 2 && sp->pal != 0 ) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + else sp->pal = 0; + if(sp->picnum == CAMERAPOLE) break; + sp->picnum = CAMERA1; + changespritestat(i,1); + break; + case STEAM: + if(j >= 0) + { + sp->ang = sprite[j].ang; + sp->cstat = 16+128+2; + sp->xrepeat=sp->yrepeat=1; + sp->xvel = -8; + ssp(i,CLIPMASK0); + } + case CEILINGSTEAM: + changespritestat(i,6); + break; + case SECTOREFFECTOR: spawneffector(i); - break; + break; - case SEENINE: - case OOZFILTER: + case SEENINE: + case OOZFILTER: - sp->shade = -16; - if(sp->xrepeat <= 8) - { - sp->cstat = (short)32768; - sp->xrepeat=sp->yrepeat=0; - } - else sp->cstat = 1+256; - sp->extra = impact_damage<<2; - sp->owner = i; + sp->shade = -16; + if(sp->xrepeat <= 8) + { + sp->cstat = (short)32768; + sp->xrepeat=sp->yrepeat=0; + } + else sp->cstat = 1+256; + sp->extra = impact_damage<<2; + sp->owner = i; - changespritestat(i,6); - break; + changespritestat(i,6); + break; - case CRACK1: - case CRACK2: - case CRACK3: - case CRACK4: - sp->cstat |= 17; - sp->extra = 1; - if( ud.multimode < 2 && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } + case CRACK1: + case CRACK2: + case CRACK3: + case CRACK4: + sp->cstat |= 17; + sp->extra = 1; + if( ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } - sp->pal = 0; - sp->owner = i; - changespritestat(i,6); - sp->xvel = 8; - ssp(i,CLIPMASK0); - break; + sp->pal = 0; + sp->owner = i; + changespritestat(i,6); + sp->xvel = 8; + ssp(i,CLIPMASK0); + break; - case EMPTYBIKE: - if (!isRRRA()) goto default_case; - if (ud.multimode < 2 && sp->pal == 1) - { - sp->xrepeat = sp->yrepeat = 0; - break; - } - sp->pal = 0; - sp->xrepeat = 18; - sp->yrepeat = 18; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - sp->owner = 100; - sp->cstat = 257; - sp->lotag = 1; - changespritestat(i,1); - break; - case EMPTYBOAT: - if (!isRRRA()) goto default_case; - if (ud.multimode < 2 && sp->pal == 1) - { - sp->xrepeat = sp->yrepeat = 0; - break; - } - sp->pal = 0; - sp->xrepeat = 32; - sp->yrepeat = 32; - sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); - sp->owner = 20; - sp->cstat = 257; - sp->lotag = 1; - changespritestat(i,1); - break; + case EMPTYBIKE: + if (!isRRRA()) goto default_case; + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + sp->pal = 0; + sp->xrepeat = 18; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->owner = 100; + sp->cstat = 257; + sp->lotag = 1; + changespritestat(i,1); + break; + case EMPTYBOAT: + if (!isRRRA()) goto default_case; + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + sp->pal = 0; + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->owner = 20; + sp->cstat = 257; + sp->lotag = 1; + changespritestat(i,1); + break; - case TOILET: - case STALL: - case RRTILE2121: - case RRTILE2122: - sp->lotag = 1; - sp->cstat |= 257; - sp->clipdist = 8; - sp->owner = i; - break; - case CANWITHSOMETHING: - case RUBBERCAN: - sp->extra = 0; - case EXPLODINGBARREL: - case HORSEONSIDE: - case FIREBARREL: - case NUKEBARREL: - case FIREVASE: - case NUKEBARRELDENTED: - case NUKEBARRELLEAKED: - case WOODENHORSE: + case TOILET: + case STALL: + case RRTILE2121: + case RRTILE2122: + sp->lotag = 1; + sp->cstat |= 257; + sp->clipdist = 8; + sp->owner = i; + break; + case CANWITHSOMETHING: + case RUBBERCAN: + sp->extra = 0; + case EXPLODINGBARREL: + case HORSEONSIDE: + case FIREBARREL: + case NUKEBARREL: + case FIREVASE: + case NUKEBARRELDENTED: + case NUKEBARRELLEAKED: + case WOODENHORSE: - if(j >= 0) - sp->xrepeat = sp->yrepeat = 32; - sp->clipdist = 72; - makeitfall(i); - if(j >= 0) - sp->owner = j; - else sp->owner = i; - case EGG: - if( ud.monsters_off == 1 && sp->picnum == EGG ) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - } - else - { - if(sp->picnum == EGG) - sp->clipdist = 24; - sp->cstat = 257|(krand()&4); - changespritestat(i,2); - } - break; - case TOILETWATER: - sp->shade = -16; - changespritestat(i,6); - break; - case RRTILE63: - sp->cstat |= 32768; - sp->xrepeat = 1; - sp->yrepeat = 1; - sp->clipdist = 1; - changespritestat(i,100); - break; - } - return i; + if(j >= 0) + sp->xrepeat = sp->yrepeat = 32; + sp->clipdist = 72; + makeitfall(i); + if(j >= 0) + sp->owner = j; + else sp->owner = i; + case EGG: + if( ud.monsters_off == 1 && sp->picnum == EGG ) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + } + else + { + if(sp->picnum == EGG) + sp->clipdist = 24; + sp->cstat = 257|(krand()&4); + changespritestat(i,2); + } + break; + case TOILETWATER: + sp->shade = -16; + changespritestat(i,6); + break; + case RRTILE63: + sp->cstat |= 32768; + sp->xrepeat = 1; + sp->yrepeat = 1; + sp->clipdist = 1; + changespritestat(i,100); + break; + } + return i; } END_DUKE_NS diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 81003f1ab..ed5fe4c89 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -7,13 +7,13 @@ BEGIN_DUKE_NS struct STATUSBARTYPE { - short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon; - short ammo_amount[MAX_WEAPONS], holoduke_on; - unsigned char inven_icon, jetpack_on, heat_on; - short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount; - short heat_amount, scuba_amount, boot_amount; - short last_weapon, weapon_pos, kickback_pic; - FixedBitArray gotweapon; // must be the same type as in player_struct + short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon; + short ammo_amount[MAX_WEAPONS], holoduke_on; + unsigned char inven_icon, jetpack_on, heat_on; + short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount; + short heat_amount, scuba_amount, boot_amount; + short last_weapon, weapon_pos, kickback_pic; + FixedBitArray gotweapon; // must be the same type as in player_struct }; struct weaponhit @@ -28,7 +28,7 @@ struct weaponhit struct animwalltype { - short wallnum, tag; + short wallnum, tag; }; // Todo - put more state in here @@ -42,195 +42,195 @@ struct ActorInfo // for now just flags not related to actors, may get more info later. struct TileInfo { - int flags; + int flags; }; struct input_t // original name was input which is too generic for a type name. { - fixed_t q16avel, q16horz; // These were expanded to 16.16 fixed point. - short fvel, svel; - ESyncBits bits; + fixed_t q16avel, q16horz; // These were expanded to 16.16 fixed point. + short fvel, svel; + ESyncBits bits; }; struct user_defs { - unsigned char god, cashman, eog, showallmap; - unsigned char show_help, scrollmode, clipping; - char user_name[MAXPLAYERS][32]; - unsigned char overhead_on, last_overhead, showweapons; - unsigned char user_pals[MAXPLAYERS]; + unsigned char god, cashman, eog, showallmap; + unsigned char show_help, scrollmode, clipping; + char user_name[MAXPLAYERS][32]; + unsigned char overhead_on, last_overhead, showweapons; + unsigned char user_pals[MAXPLAYERS]; - short from_bonus; - short camerasprite, last_camsprite; - short last_level, secretlevel; + short from_bonus; + short camerasprite, last_camsprite; + short last_level, secretlevel; - int const_visibility; - int folfvel, folavel, folx, foly, fola; - int reccnt; + int const_visibility; + int folfvel, folavel, folx, foly, fola; + int reccnt; - int runkey_mode, statusbarscale, mouseaiming, weaponswitch; + int runkey_mode, statusbarscale, mouseaiming, weaponswitch; - int entered_name, shadows, executions, auto_run; - int coords, tickrate, levelstats, m_coop, coop, screen_size, lockout, crosshair; - int wchoice[MAXPLAYERS][MAX_WEAPONS], playerai; + int entered_name, shadows, executions, auto_run; + int coords, tickrate, levelstats, m_coop, coop, screen_size, lockout, crosshair; + int wchoice[MAXPLAYERS][MAX_WEAPONS], playerai; - int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness; - int m_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off, detail; - int m_ffire, ffire, m_player_skill, multimode; - int player_skill, m_marker, marker, mouseflip; - int statusbarmode, althud; - MapRecord* nextLevel; + int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness; + int m_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off, detail; + int m_ffire, ffire, m_player_skill, multimode; + int player_skill, m_marker, marker, mouseflip; + int statusbarmode, althud; + MapRecord* nextLevel; }; struct player_orig { - int ox, oy, oz; - short oa, os; + int ox, oy, oz; + short oa, os; }; struct player_struct { - // This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze. - - // The sound code wants to read a vector out of this so we need to define one for the main coordinate. - union - { - vec3_t pos; - struct { int32_t posx, posy, posz; }; - }; + // This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze. + + // The sound code wants to read a vector out of this so we need to define one for the main coordinate. + union + { + vec3_t pos; + struct { int32_t posx, posy, posz; }; + }; - // input handles angle and horizon as fixed16 numbers. We need to account for that as well. - fixed_t q16ang, q16horiz, q16horizoff, q16rotscrnang, q16look_ang; - fixed_t oq16ang, oq16horiz, oq16horizoff, oq16rotscrnang; // These are only needed with synchronous mouse input. - fixed_t one_eighty_count; + // input handles angle and horizon as fixed16 numbers. We need to account for that as well. + fixed_t q16ang, q16horiz, q16horizoff, q16rotscrnang, q16look_ang; + fixed_t oq16ang, oq16horiz, oq16horizoff, oq16rotscrnang; // These are only needed with synchronous mouse input. + fixed_t one_eighty_count; - // using a bit field for this to save a bit of space. - FixedBitArray gotweapon; + // using a bit field for this to save a bit of space. + FixedBitArray gotweapon; - // Palette management uses indices into the engine's palette table now. - unsigned int palette; - PalEntry pals; + // Palette management uses indices into the engine's palette table now. + unsigned int palette; + PalEntry pals; - // this was a global variable originally. - vec2_t fric; + // this was a global variable originally. + vec2_t fric; - // From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed. - int zoom, exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; - int invdisptime; - int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; - int posxv, posyv, poszv, last_pissed_time, truefz, truecz; - int player_par, visibility; - int bobcounter, weapon_sway; - int pals_time, randomflamex, crack_time; + // From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed. + int zoom, exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; + int invdisptime; + int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; + int posxv, posyv, poszv, last_pissed_time, truefz, truecz; + int player_par, visibility; + int bobcounter, weapon_sway; + int pals_time, randomflamex, crack_time; - int aim_mode, auto_aim, weaponswitch; + int aim_mode, auto_aim, weaponswitch; - short angvel, cursectnum, last_extra, subweapon; - short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; + short angvel, cursectnum, last_extra, subweapon; + short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; - short curr_weapon, last_weapon, tipincs, wantweaponfire; - short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; - short jumping_counter, airleft, knee_incs, access_incs; - short ftq, access_wallnum, access_spritenum; - short kickback_pic, got_access, weapon_ang, firstaid_amount; - short somethingonplayer, on_crane, i, one_parallax_sectnum; - short over_shoulder_on, random_club_frame, fist_incs; - short cheat_phase; - short dummyplayersprite, extra_extra8, quick_kick; - short heat_amount, actorsqu, timebeforeexit, customexitsound; + short curr_weapon, last_weapon, tipincs, wantweaponfire; + short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; + short jumping_counter, airleft, knee_incs, access_incs; + short ftq, access_wallnum, access_spritenum; + short kickback_pic, got_access, weapon_ang, firstaid_amount; + short somethingonplayer, on_crane, i, one_parallax_sectnum; + short over_shoulder_on, random_club_frame, fist_incs; + short cheat_phase; + short dummyplayersprite, extra_extra8, quick_kick; + short heat_amount, actorsqu, timebeforeexit, customexitsound; - short weaprecs[256], weapreccnt; - unsigned int interface_toggle_flag; + short weaprecs[256], weapreccnt; + unsigned int interface_toggle_flag; - short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang - short scuba_amount, jetpack_amount, steroids_amount, shield_amount; - short holoduke_on, pycount, weapon_pos, frag_ps; - short transporter_hold, last_full_weapon, footprintshade, boot_amount; + short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang + short scuba_amount, jetpack_amount, steroids_amount, shield_amount; + short holoduke_on, pycount, weapon_pos, frag_ps; + short transporter_hold, last_full_weapon, footprintshade, boot_amount; - int scream_voice; + int scream_voice; - unsigned char gm; - unsigned char on_warping_sector, footprintcount; - unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground; - char name[32]; - unsigned char inven_icon, buttonpalette; + unsigned char gm; + unsigned char on_warping_sector, footprintcount; + unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground; + char name[32]; + unsigned char inven_icon, buttonpalette; - unsigned char jetpack_on, spritebridge, lastrandomspot; - unsigned char scuba_on, footprintpal, heat_on; + unsigned char jetpack_on, spritebridge, lastrandomspot; + unsigned char scuba_on, footprintpal, heat_on; - unsigned char holster_weapon; - unsigned char falling_counter; - unsigned char refresh_inventory; + unsigned char holster_weapon; + unsigned char falling_counter; + unsigned char refresh_inventory; - unsigned char toggle_key_flag, knuckle_incs; // ,select_dir; - unsigned char walking_snd_toggle, palookup, hard_landing; - unsigned char return_to_center; + unsigned char toggle_key_flag, knuckle_incs; // ,select_dir; + unsigned char walking_snd_toggle, palookup, hard_landing; + unsigned char return_to_center; - int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed; + int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed; - // Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem. - // Items were reordered by size. - int stairs; - int detonate_count; // at57e - int noise_x, noise_y, noise_radius; // at286, at28a, at290 - int drink_timer; // at58e - int eat_timer; // at592 - int SlotWin; - short recoil; - short detonate_time; // at57c - short yehaa_timer; - short drink_amt, eat, drunkang, eatang; - uint8_t shotgun_state[2]; - uint8_t donoise; // at28e - uint8_t keys[5]; + // Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem. + // Items were reordered by size. + int stairs; + int detonate_count; // at57e + int noise_x, noise_y, noise_radius; // at286, at28a, at290 + int drink_timer; // at58e + int eat_timer; // at592 + int SlotWin; + short recoil; + short detonate_time; // at57c + short yehaa_timer; + short drink_amt, eat, drunkang, eatang; + uint8_t shotgun_state[2]; + uint8_t donoise; // at28e + uint8_t keys[5]; - // RRRA. The same as for the RR block applies. - int drug_aspect; - int drug_timer; - int SeaSick; - short MamaEnd; // raat609 - short MotoSpeed, moto_drink; - float TiltStatus; - short VBumpNow, VBumpTarget, TurbCount; - short drug_stat[3]; // raat5f1..5 - uint8_t DrugMode, lotag800kill; - uint8_t sea_sick_stat; // raat5dd - uint8_t hurt_delay2, nocheat; - uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround; - uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud; + // RRRA. The same as for the RR block applies. + int drug_aspect; + int drug_timer; + int SeaSick; + short MamaEnd; // raat609 + short MotoSpeed, moto_drink; + float TiltStatus; + short VBumpNow, VBumpTarget, TurbCount; + short drug_stat[3]; // raat5f1..5 + uint8_t DrugMode, lotag800kill; + uint8_t sea_sick_stat; // raat5dd + uint8_t hurt_delay2, nocheat; + uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround; + uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud; - int8_t crouch_toggle; + int8_t crouch_toggle; - // input stuff. - float horizAngleAdjust; - fix16_t horizSkew; - bool lookLeft; - bool lookRight; + // input stuff. + float horizAngleAdjust; + fix16_t horizSkew; + bool lookLeft; + bool lookRight; - // Access helpers for the widened angle and horizon fields. - int getlookang() { return q16look_ang >> FRACBITS; } - void setlookang(int b) { q16look_ang = b << FRACBITS; } - void addlookang(int b) { q16look_ang += b << FRACBITS; } - void addlookang(double b) { q16look_ang += int(b *65536.); } - int getrotscrnang() { return q16rotscrnang >> FRACBITS; } - void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; } - void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; } - void addrotscrnang(double b) { q16rotscrnang += int(b *65536.); } - int getang() { return q16ang >> FRACBITS; } - int getoang() { return oq16ang >> FRACBITS; } - void setang(int v, bool smooth = false) { q16ang = v << FRACBITS; } - void addang(int v, bool smooth = false) { q16ang = (q16ang + (v << FRACBITS)) & ((2048 << FRACBITS) - 1); } - void setoang(int v) { oq16ang = v << FRACBITS; } - void addhoriz(int v) { q16horiz += (v << FRACBITS); } - void addhorizoff(int v) { q16horiz += (v << FRACBITS); } - void addhorizoff(double v) { q16horiz += int(v * 65536.); } - void sethoriz(int v) { q16horiz = (v << FRACBITS); } - void sethorizoff(int v) { q16horizoff = (v << FRACBITS); } - int gethoriz() { return q16horiz >> FRACBITS; } - int gethorizof() { return q16horizoff >> FRACBITS; } - int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; } + // Access helpers for the widened angle and horizon fields. + int getlookang() { return q16look_ang >> FRACBITS; } + void setlookang(int b) { q16look_ang = b << FRACBITS; } + void addlookang(int b) { q16look_ang += b << FRACBITS; } + void addlookang(double b) { q16look_ang += int(b *65536.); } + int getrotscrnang() { return q16rotscrnang >> FRACBITS; } + void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; } + void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; } + void addrotscrnang(double b) { q16rotscrnang += int(b *65536.); } + int getang() { return q16ang >> FRACBITS; } + int getoang() { return oq16ang >> FRACBITS; } + void setang(int v, bool smooth = false) { q16ang = v << FRACBITS; } + void addang(int v, bool smooth = false) { q16ang = (q16ang + (v << FRACBITS)) & ((2048 << FRACBITS) - 1); } + void setoang(int v) { oq16ang = v << FRACBITS; } + void addhoriz(int v) { q16horiz += (v << FRACBITS); } + void addhorizoff(int v) { q16horiz += (v << FRACBITS); } + void addhorizoff(double v) { q16horiz += int(v * 65536.); } + void sethoriz(int v) { q16horiz = (v << FRACBITS); } + void sethorizoff(int v) { q16horizoff = (v << FRACBITS); } + int gethoriz() { return q16horiz >> FRACBITS; } + int gethorizof() { return q16horizoff >> FRACBITS; } + int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; } };