- cache, cheats, colormap and enums.

This commit is contained in:
Christoph Oelckers 2021-10-31 21:00:21 +01:00
parent f5c7ccd6af
commit cde4b1f19e
4 changed files with 100 additions and 93 deletions

View file

@ -59,11 +59,10 @@ void PreCacheRange(int start_pic, int end_pic, int pal = 0)
void PreCacheOverride(void) void PreCacheOverride(void)
{ {
int i; SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); while (auto actor = it.Next())
while ((i = it.NextIndex()) >= 0)
{ {
auto sp = &sprite[i]; auto sp = &actor->s();
int j = SP_TAG2(sp); int j = SP_TAG2(sp);
if(j >= 0 && j <= MAXTILES) if(j >= 0 && j <= MAXTILES)
markTileForPrecache(j, 0); markTileForPrecache(j, 0);
@ -349,13 +348,13 @@ void PreCachePachinko(int pal)
void void
PreCacheActor(void) PreCacheActor(void)
{ {
int i;
int pic; int pic;
for (i=0; i < MAXSPRITES; i++) SWSpriteIterator it;
while (auto actor = it.Next())
{ {
auto pUsr = User[i].Data(); auto pUsr = actor->u();
auto pSpr = &sprite[i]; auto pSpr = &actor->s();
if (pSpr->statnum >= MAXSTATUS) if (pSpr->statnum >= MAXSTATUS)
continue; continue;

View file

@ -196,7 +196,7 @@ static cheatseq_t swcheats[] = {
static void WeaponCheat(int player) static void WeaponCheat(int player)
{ {
auto p = &Player[player]; auto p = &Player[player];
auto u = User[p->PlayerSprite].Data(); auto u = p->Actor()->u();
if (!TEST(p->Flags, PF_TWO_UZI)) if (!TEST(p->Flags, PF_TWO_UZI))
{ {
@ -266,9 +266,9 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
break; break;
case GIVE_HEALTH: case GIVE_HEALTH:
if (User[Player[player].PlayerSprite]->Health < Player[player].MaxHealth) if (Player[player].Actor()->u()->Health < Player[player].MaxHealth)
{ {
User[Player[player].PlayerSprite]->Health += 25; Player[player].Actor()->u()->Health += 25;
PutStringInfo(&Player[player], GStrings("TXTS_ADDEDHEALTH")); PutStringInfo(&Player[player], GStrings("TXTS_ADDEDHEALTH"));
} }
break; break;
@ -280,7 +280,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
case GIVE_AMMO: case GIVE_AMMO:
{ {
auto p = &Player[player]; auto p = &Player[player];
auto u = User[p->PlayerSprite].Data(); auto u = p->Actor()->u();
p->WpnShotgunAuto = 50; p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5; p->WpnRocketHeat = 5;
@ -296,7 +296,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
} }
case GIVE_ARMOR: case GIVE_ARMOR:
if (User[Player[player].PlayerSprite]->Health < Player[player].MaxHealth) if (Player[player].Actor()->u()->Health < Player[player].MaxHealth)
{ {
Player[player].Armor = 100; Player[player].Armor = 100;
PutStringInfo(&Player[player], GStrings("TXTB_FULLARM")); PutStringInfo(&Player[player], GStrings("TXTB_FULLARM"));

View file

@ -229,8 +229,8 @@ void GameInterface::loadPalette(void)
// //
// Dive palettes // Dive palettes
// //
#define FOG_AMT 60 // is 15 in SWP. const int FOG_AMT = 60; // is 15 in SWP.
#define LAVA_AMT 44 // is 11 in SWP. const int LAVA_AMT = 44; // is 11 in SWP.
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
tempbuf[i] = i; tempbuf[i] = i;

View file

@ -23,99 +23,107 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#pragma once
BEGIN_SW_NS
//// ////
// //
// Misc Defines // Misc Defines
// //
//// ////
#define LT_GREY (16 * 0 + 1) enum
#define DK_GREY (16 * 1) {
#define LT_BROWN (16 * 2) LT_GREY = (16 * 0 + 1),
#define DK_BROWN (16 * 3) DK_GREY = (16 * 1),
#define LT_TAN (16 * 4) LT_BROWN = (16 * 2),
#define DK_TAN (16 * 5) DK_BROWN = (16 * 3),
#define RUST_RED (16 * 6) LT_TAN = (16 * 4),
#define RED (16 * 7) DK_TAN = (16 * 5),
#define YELLOW (16 * 8) RUST_RED = (16 * 6),
#define BRIGHT_GREEN (16 * 9) RED = (16 * 7),
#define DK_GREEN (16 * 10) YELLOW = (16 * 8),
#define GREEN (16 * 11) BRIGHT_GREEN = (16 * 9),
#define LT_BLUE (16 * 12) DK_GREEN = (16 * 10),
#define DK_BLUE (16 * 13) GREEN = (16 * 11),
#define PURPLE (16 * 14) LT_BLUE = (16 * 12),
#define FIRE (16 * 15) DK_BLUE = (16 * 13),
PURPLE = (16 * 14),
FIRE = (16 * 15),
};
// //
// Palette numbers and meanings // Palette numbers and meanings
// //
#define PALETTE_DEFAULT 0 enum
#define PALETTE_FOG 1 {
// blue sword blade test PALETTE_DEFAULT = 0,
#define PALETTE_MENU_HIGHLIGHT 2 PALETTE_FOG = 1,
// used for the elector gore pieces // blue sword blade test
#define PALETTE_ELECTRO_GORE 3 PALETTE_MENU_HIGHLIGHT = 2,
// turns ninjas belt and headband red // used for the elector gore pieces
#define PALETTE_BASIC_NINJA 4 PALETTE_ELECTRO_GORE = 3,
// diving in lava // turns ninjas belt and headband red
#define PALETTE_DIVE_LAVA 5 PALETTE_BASIC_NINJA = 4,
// turns ninjas belt and headband red // diving in lava
#define PALETTE_RED_NINJA 6 PALETTE_DIVE_LAVA = 5,
// used for the mother ripper - she is bigger/stronger/brown // turns ninjas belt and headband red
#define PALETTE_BROWN_RIPPER 7 PALETTE_RED_NINJA = 6,
// turns ninjas belt and headband red // used for the mother ripper - she is bigger/stronger/brown
#define PALETTE_GREEN_NINJA 8 PALETTE_BROWN_RIPPER = 7,
// reserved diving palette this is copied over the default palette // turns ninjas belt and headband red
// when needed - NOTE: could move this to a normal memory buffer if palette PALETTE_GREEN_NINJA = 8,
// slot is needed. // reserved diving palette this is copied over the default palette
#define PALETTE_DIVE 9 // when needed - NOTE: could move this to a normal memory buffer if palette
#define PALETTE_SKEL_GORE 10 // slot is needed.
// turns ALL colors to shades of GREEN/BLUE/RED PALETTE_DIVE = 9,
#define PALETTE_GREEN_LIGHTING 11 PALETTE_SKEL_GORE = 10,
#define PALETTE_BLUE_LIGHTING 13 // turns ALL colors to shades of GREEN/BLUE/RED
#define PALETTE_RED_LIGHTING 14 PALETTE_GREEN_LIGHTING = 11,
PALETTE_BLUE_LIGHTING = 13,
// for brown bubbling sludge PALETTE_RED_LIGHTING = 14,
#define PALETTE_SLUDGE 15
// for brown bubbling sludge
PALETTE_SLUDGE = 15,
};
// Player 0 uses default palette - others use these // Player 0 uses default palette - others use these
// turns ninja's vests (when we get them) into different color ranges // turns ninja's vests (when we get them) into different color ranges
#define PALETTE_PLAYER0 16 enum
#define PAL_XLAT_BROWN 16 {
#define PALETTE_PLAYER1 17 PALETTE_PLAYER0 = 16,
#define PAL_XLAT_LT_GREY 17 PAL_XLAT_BROWN = 16,
#define PALETTE_PLAYER2 18 PALETTE_PLAYER1 = 17,
#define PAL_XLAT_PURPLE 18 PAL_XLAT_LT_GREY = 17,
#define PALETTE_PLAYER3 19 PALETTE_PLAYER2 = 18,
#define PAL_XLAT_RUST_RED 19 PAL_XLAT_PURPLE = 18,
#define PALETTE_PLAYER4 20 PALETTE_PLAYER3 = 19,
#define PAL_XLAT_YELLOW 20 PAL_XLAT_RUST_RED = 19,
#define PALETTE_PLAYER5 21 PALETTE_PLAYER4 = 20,
#define PAL_XLAT_DK_GREEN 21 PAL_XLAT_YELLOW = 20,
#define PALETTE_PLAYER6 22 PALETTE_PLAYER5 = 21,
#define PAL_XLAT_GREEN 22 PAL_XLAT_DK_GREEN = 21,
#define PALETTE_PLAYER7 23 PALETTE_PLAYER6 = 22,
#define PAL_XLAT_LT_BLUE 23 PAL_XLAT_GREEN = 22,
#define PALETTE_PLAYER8 24 PALETTE_PLAYER7 = 23,
#define PAL_XLAT_LT_TAN 24 PAL_XLAT_LT_BLUE = 23,
#define PALETTE_PLAYER9 25 PALETTE_PLAYER8 = 24,
#define PAL_XLAT_RED 25 PAL_XLAT_LT_TAN = 24,
#define PALETTE_PLAYER10 26 PALETTE_PLAYER9 = 25,
#define PAL_XLAT_DK_GREY 26 PAL_XLAT_RED = 25,
#define PALETTE_PLAYER11 27 PALETTE_PLAYER10 = 26,
#define PAL_XLAT_BRIGHT_GREEN 27 PAL_XLAT_DK_GREY = 26,
#define PALETTE_PLAYER12 28 PALETTE_PLAYER11 = 27,
#define PAL_XLAT_DK_BLUE 28 PAL_XLAT_BRIGHT_GREEN = 27,
#define PALETTE_PLAYER13 29 PALETTE_PLAYER12 = 28,
#define PAL_XLAT_FIRE 29 PAL_XLAT_DK_BLUE = 28,
#define PALETTE_PLAYER14 30 PALETTE_PLAYER13 = 29,
#define PALETTE_PLAYER15 31 PAL_XLAT_FIRE = 29,
PALETTE_PLAYER14 = 30,
#define PALETTE_ILLUMINATE 32 // Used to make sprites bright green in night vision PALETTE_PLAYER15 = 31,
PALETTE_ILLUMINATE = 32, // Used to make sprites bright green in night vision
};
END_SW_NS