- properly tabified everything.

This commit is contained in:
Christoph Oelckers 2020-07-20 23:21:27 +02:00
parent ba7997b611
commit 7eb158bf72
29 changed files with 5091 additions and 5091 deletions

View file

@ -52,73 +52,73 @@ BEGIN_DUKE_NS
void InitFonts_d() void InitFonts_d()
{ {
GlyphSet fontdata; GlyphSet fontdata;
// Small font // Small font
for (int i = 0; i < 95; i++) for (int i = 0; i < 95; i++)
{ {
auto tile = tileGetTexture(STARTALPHANUM + i); auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{ {
fontdata.Insert('!' + i, tile); fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont(); tile->SetOffsetsNotForFont();
} }
} }
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear(); fontdata.Clear();
// Big font // Big font
// This font is VERY messy... // This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11)); fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
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 < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i)); for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD)); fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA)); fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX)); fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ)); fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI)); fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN)); fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68)); fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68)); fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69)); fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS)); fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS)); 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. // 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::Iterator it(fontdata);
GlyphSet::Pair* pair; GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont(); while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 5, false, false, false, &fontdata); BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear(); fontdata.Clear();
// Tiny font // Tiny font
for (int i = 0; i < 95; i++) for (int i = 0; i < 95; i++)
{ {
auto tile = tileGetTexture(MINIFONT + i); auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0) if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
fontdata.Insert('!' + i, tile); 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. 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 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 3, false, false, false, &fontdata);
SmallFont2->SetKerning(1); SmallFont2->SetKerning(1);
fontdata.Clear(); fontdata.Clear();
// SBAR index font // SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); 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. 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); IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear(); fontdata.Clear();
// digital font // digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); 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. 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); DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
} }
@ -1064,7 +1064,7 @@ public:
void PrintPaused_d() void PrintPaused_d()
{ {
BigText(160, 100, GStrings("Game Paused")); BigText(160, 100, GStrings("Game Paused"));
} }
void PrintLevelName_d(double alpha) void PrintLevelName_d(double alpha)

View file

@ -58,8 +58,8 @@ int adjustfall(spritetype* s, int c);
void RANDOMSCRAP(spritetype *s, int i) void RANDOMSCRAP(spritetype *s, int i)
{ {
int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand();
int v = isRR() ? 16 : 48; 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); 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);
} }

View file

@ -186,7 +186,7 @@ void addweapon_r(struct player_struct* p, int weapon)
case SLINGBLADE_WEAPON: case SLINGBLADE_WEAPON:
if (!isRRRA()) break; if (!isRRRA()) break;
case KNEE_WEAPON: case KNEE_WEAPON:
case DYNAMITE_WEAPON: case DYNAMITE_WEAPON:
case TRIPBOMB_WEAPON: case TRIPBOMB_WEAPON:
case THROWINGDYNAMITE_WEAPON: case THROWINGDYNAMITE_WEAPON:
break; break;
@ -4050,10 +4050,10 @@ void moveeffectors_r(void) //STATNUM 3
int adjustfall(spritetype *s, int c) int adjustfall(spritetype *s, int c)
{ {
if ((s->picnum == BIKERB || s->picnum == CHEERB) && c == gc) if ((s->picnum == BIKERB || s->picnum == CHEERB) && c == gc)
c = gc>>2; c = gc>>2;
else if (s->picnum == BIKERBV2 && c == gc) else if (s->picnum == BIKERBV2 && c == gc)
c = gc>>3; c = gc>>3;
return c; return c;
} }

View file

@ -46,229 +46,229 @@ bool cheatInventory(cheatseq_t* s);
static void dowarp(MapRecord *map) 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_items = 0;
ud.m_respawn_inventory = 0; ud.m_respawn_inventory = 0;
ud.multimode = 1; ud.multimode = 1;
if (ps[myconnectindex].gm & MODE_GAME) if (ps[myconnectindex].gm & MODE_GAME)
{ {
ready2send = 0; ready2send = 0;
donewgame(map, ud.m_player_skill); donewgame(map, ud.m_player_skill);
ps[myconnectindex].gm = MODE_RESTART; ps[myconnectindex].gm = MODE_RESTART;
} }
else startnewgame(map, ud.m_player_skill); else startnewgame(map, ud.m_player_skill);
} }
static int ccmd_levelwarp(CCmdFuncPtr parm) static int ccmd_levelwarp(CCmdFuncPtr parm)
{ {
if (parm->numparms != 2) if (parm->numparms != 2)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
int e = atoi(parm->parms[0]); int e = atoi(parm->parms[0]);
int m = atoi(parm->parms[1]); int m = atoi(parm->parms[1]);
if (e == 0 || m == 0) if (e == 0 || m == 0)
{ {
Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]); Printf(TEXTCOLOR_RED "Invalid level!: E%sL%s\n", parm->parms[0], parm->parms[1]);
return CCMD_OK; return CCMD_OK;
} }
auto map = FindMapByLevelNum(levelnum(e - 1, m - 1)); auto map = FindMapByLevelNum(levelnum(e - 1, m - 1));
if (!map) if (!map)
{ {
Printf(TEXTCOLOR_RED "Level not found!: E%sL%s\n", parm->parms[0], parm->parms[1]); Printf(TEXTCOLOR_RED "Level not found!: E%sL%s\n", parm->parms[0], parm->parms[1]);
return CCMD_OK; return CCMD_OK;
} }
dowarp(map); dowarp(map);
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_map(CCmdFuncPtr parm) static int ccmd_map(CCmdFuncPtr parm)
{ {
if (parm->numparms != 1) if (parm->numparms != 1)
{ {
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
FString mapname = parm->parms[0]; FString mapname = parm->parms[0];
if (!fileSystem.Lookup(mapname, "MAP")) if (!fileSystem.Lookup(mapname, "MAP"))
{ {
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars());
return CCMD_OK; return CCMD_OK;
} }
// Check if the map is already defined. // Check if the map is already defined.
auto map = FindMapByName(mapname); auto map = FindMapByName(mapname);
if (map == nullptr) if (map == nullptr)
{ {
// got a user map // got a user map
if (VOLUMEONE) if (VOLUMEONE)
{ {
Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n"); Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n");
return CCMD_OK; return CCMD_OK;
} }
DefaultExtension(mapname, ".map"); DefaultExtension(mapname, ".map");
if (mapname[0] != '/') mapname.Insert(0, "/"); if (mapname[0] != '/') mapname.Insert(0, "/");
map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr); map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr);
} }
if (numplayers > 1) if (numplayers > 1)
{ {
return CCMD_OK; return CCMD_OK;
} }
dowarp(map); dowarp(map);
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_activatecheat(CCmdFuncPtr parm) static int ccmd_activatecheat(CCmdFuncPtr parm)
{ {
if (parm->numparms != 1) if (parm->numparms != 1)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
PlaybackCheat(parm->parms[0]); PlaybackCheat(parm->parms[0]);
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_god(CCmdFuncPtr) static int ccmd_god(CCmdFuncPtr)
{ {
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
cheatGod(nullptr); cheatGod(nullptr);
else else
Printf("god: Not in a single-player game.\n"); Printf("god: Not in a single-player game.\n");
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_noclip(CCmdFuncPtr) static int ccmd_noclip(CCmdFuncPtr)
{ {
if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME)
{ {
cheatClip(nullptr); cheatClip(nullptr);
} }
else else
{ {
Printf("noclip: Not in a single-player game.\n"); Printf("noclip: Not in a single-player game.\n");
} }
return CCMD_OK; return CCMD_OK;
} }
static int ccmd_restartmap(CCmdFuncPtr) static int ccmd_restartmap(CCmdFuncPtr)
{ {
if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1) if (ps[myconnectindex].gm & MODE_GAME && ud.multimode == 1)
ps[myconnectindex].gm = MODE_RESTART; ps[myconnectindex].gm = MODE_RESTART;
return CCMD_OK; return CCMD_OK;
} }
int getlabelvalue(const char* text); int getlabelvalue(const char* text);
static int ccmd_spawn(CCmdFuncPtr parm) static int ccmd_spawn(CCmdFuncPtr parm)
{ {
int x = 0, y = 0, z = 0; int x = 0, y = 0, z = 0;
unsigned int cstat = 0, picnum = 0; unsigned int cstat = 0, picnum = 0;
unsigned int pal = 0; unsigned int pal = 0;
int ang = 0; int ang = 0;
int set = 0, idx; int set = 0, idx;
if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) { if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) {
Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
return CCMD_OK; return CCMD_OK;
} }
switch (parm->numparms) { switch (parm->numparms) {
case 7: // x,y,z case 7: // x,y,z
x = atol(parm->parms[4]); x = atol(parm->parms[4]);
y = atol(parm->parms[5]); y = atol(parm->parms[5]);
z = atol(parm->parms[6]); z = atol(parm->parms[6]);
set |= 8; set |= 8;
case 4: // ang case 4: // ang
ang = atol(parm->parms[3]) & 2047; set |= 4; ang = atol(parm->parms[3]) & 2047; set |= 4;
case 3: // cstat case 3: // cstat
cstat = (unsigned short)atol(parm->parms[2]); set |= 2; cstat = (unsigned short)atol(parm->parms[2]); set |= 2;
case 2: // pal case 2: // pal
pal = (unsigned char)atol(parm->parms[1]); set |= 1; pal = (unsigned char)atol(parm->parms[1]); set |= 1;
case 1: // tile number case 1: // tile number
if (isdigit(parm->parms[0][0])) { if (isdigit(parm->parms[0][0])) {
picnum = (unsigned short)atol(parm->parms[0]); picnum = (unsigned short)atol(parm->parms[0]);
} }
else { else {
picnum = getlabelvalue(parm->parms[0]); picnum = getlabelvalue(parm->parms[0]);
if (picnum < 0) { if (picnum < 0) {
Printf("spawn: Invalid tile label given\n"); Printf("spawn: Invalid tile label given\n");
return CCMD_OK; return CCMD_OK;
} }
} }
if (picnum >= MAXTILES) { if (picnum >= MAXTILES) {
Printf("spawn: Invalid tile number\n"); Printf("spawn: Invalid tile number\n");
return CCMD_OK; return CCMD_OK;
} }
break; break;
default: default:
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
idx = fi.spawn(ps[myconnectindex].i, (short)picnum); idx = fi.spawn(ps[myconnectindex].i, (short)picnum);
if (set & 1) sprite[idx].pal = (char)pal; if (set & 1) sprite[idx].pal = (char)pal;
if (set & 2) sprite[idx].cstat = (short)cstat; if (set & 2) sprite[idx].cstat = (short)cstat;
if (set & 4) sprite[idx].ang = ang; if (set & 4) sprite[idx].ang = ang;
if (set & 8) { if (set & 8) {
if (setsprite(idx, x, y, z) < 0) { if (setsprite(idx, x, y, z) < 0) {
Printf("spawn: Sprite can't be spawned into null space\n"); Printf("spawn: Sprite can't be spawned into null space\n");
deletesprite(idx); 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. // Strangely enough JFDuke does not have a 'give' CCMD, so this is based on the version in EDuke32.
static int ccmd_give(CCmdFuncPtr parm) static int ccmd_give(CCmdFuncPtr parm)
{ {
if (numplayers != 1 || (ps[myconnectindex].gm & MODE_GAME) == 0 || if (numplayers != 1 || (ps[myconnectindex].gm & MODE_GAME) == 0 ||
ps[myconnectindex].dead_flag != 0) ps[myconnectindex].dead_flag != 0)
{ {
Printf("give: Cannot give while dead or not in a single-player game.\n"); Printf("give: Cannot give while dead or not in a single-player game.\n");
return CCMD_OK; 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; cheatseq_t* cs = (cheatseq_t*)(intptr_t)1;
if (!stricmp(parm->parms[0], "all")) if (!stricmp(parm->parms[0], "all"))
{ {
cheatStuff(cs); cheatStuff(cs);
} }
else if (!stricmp(parm->parms[0], "health")) else if (!stricmp(parm->parms[0], "health"))
{ {
sprite[ps[myconnectindex].i].extra = max_player_health<<1; sprite[ps[myconnectindex].i].extra = max_player_health<<1;
} }
else if (!stricmp(parm->parms[0], "weapons")) else if (!stricmp(parm->parms[0], "weapons"))
{ {
cheatWeapons(cs); cheatWeapons(cs);
} }
else if (!stricmp(parm->parms[0], "ammo")) else if (!stricmp(parm->parms[0], "ammo"))
{ {
int maxw = VOLUMEONE ? SHRINKER_WEAPON : MAX_WEAPONS; int maxw = VOLUMEONE ? SHRINKER_WEAPON : MAX_WEAPONS;
for (int i = maxw; i >= PISTOL_WEAPON; i--) for (int i = maxw; i >= PISTOL_WEAPON; i--)
addammo(i, &ps[myconnectindex], max_ammo_amount[i]); addammo(i, &ps[myconnectindex], max_ammo_amount[i]);
} }
else if (!stricmp(parm->parms[0], "armor")) else if (!stricmp(parm->parms[0], "armor"))
{ {
ps[myconnectindex].shield_amount = 100; ps[myconnectindex].shield_amount = 100;
} }
else if (!stricmp(parm->parms[0], "keys")) else if (!stricmp(parm->parms[0], "keys"))
{ {
cheatKeys(cs); cheatKeys(cs);
} }
else if (!stricmp(parm->parms[0], "inventory")) else if (!stricmp(parm->parms[0], "inventory"))
{ {
cheatInventory(cs); cheatInventory(cs);
} }
else return CCMD_SHOWHELP; else return CCMD_SHOWHELP;
return CCMD_OK; return CCMD_OK;
} }
@ -276,18 +276,18 @@ static int ccmd_give(CCmdFuncPtr parm)
int registerosdcommands(void) int registerosdcommands(void)
{ {
C_RegisterFunction("map","map <mapname>: warp to the given map, identified by its name", ccmd_map); C_RegisterFunction("map","map <mapname>: warp to the given map, identified by its name", ccmd_map);
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", ccmd_levelwarp); C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", ccmd_levelwarp);
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", ccmd_give); C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", ccmd_give);
C_RegisterFunction("god","god: toggles god mode", ccmd_god); C_RegisterFunction("god","god: toggles god mode", ccmd_god);
C_RegisterFunction("activatecheat","activatecheat <string>: activates a cheat code", ccmd_activatecheat); C_RegisterFunction("activatecheat","activatecheat <string>: activates a cheat code", ccmd_activatecheat);
C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip); C_RegisterFunction("noclip","noclip: toggles clipping mode", ccmd_noclip);
C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap); C_RegisterFunction("restartmap", "restartmap: restarts the current map", ccmd_restartmap);
C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn);
return 0; return 0;
} }
END_DUKE_NS END_DUKE_NS

View file

@ -43,9 +43,9 @@ enum GameFunction_t
enum enum
{ {
TICRATE = 120, TICRATE = 120,
REALGAMETICSPERSEC = 30, // The number of game state updates per second: 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.) 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. // tile names which are identical for all games.
@ -63,172 +63,172 @@ enum
GPSPEED = 10, GPSPEED = 10,
FOF = 13, FOF = 13,
TILE_VIEWSCR = (MAXTILES-5) TILE_VIEWSCR = (MAXTILES-5)
}; };
// the available palettes. These are indices into the global table of translations. // the available palettes. These are indices into the global table of translations.
enum basepal_t { enum basepal_t {
BASEPAL = 0, BASEPAL = 0,
WATERPAL, WATERPAL,
SLIMEPAL, SLIMEPAL,
TITLEPAL, TITLEPAL,
DREALMSPAL, DREALMSPAL,
ENDINGPAL, // 5 ENDINGPAL, // 5
ANIMPAL, // not used anymore. The anim code now generates true color textures. ANIMPAL, // not used anymore. The anim code now generates true color textures.
DRUGPAL, DRUGPAL,
BASEPALCOUNT BASEPALCOUNT
}; };
// sector effector lotags, from EDuke32. The original code used numeric literals for these, substitution is not complete. // sector effector lotags, from EDuke32. The original code used numeric literals for these, substitution is not complete.
enum enum
{ {
SE_0_ROTATING_SECTOR = 0, SE_0_ROTATING_SECTOR = 0,
SE_1_PIVOT = 1, SE_1_PIVOT = 1,
SE_2_EARTHQUAKE = 2, SE_2_EARTHQUAKE = 2,
SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3, SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
SE_4_RANDOM_LIGHTS = 4, SE_4_RANDOM_LIGHTS = 4,
SE_5_BOSS = 5, SE_5_BOSS = 5,
SE_6_SUBWAY = 6, SE_6_SUBWAY = 6,
SE_7_TELEPORT = 7, SE_7_TELEPORT = 7,
SE_8_UP_OPEN_DOOR_LIGHTS = 8, SE_8_UP_OPEN_DOOR_LIGHTS = 8,
SE_9_DOWN_OPEN_DOOR_LIGHTS = 9, SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
SE_10_DOOR_AUTO_CLOSE = 10, SE_10_DOOR_AUTO_CLOSE = 10,
SE_11_SWINGING_DOOR = 11, SE_11_SWINGING_DOOR = 11,
SE_12_LIGHT_SWITCH = 12, SE_12_LIGHT_SWITCH = 12,
SE_13_EXPLOSIVE = 13, SE_13_EXPLOSIVE = 13,
SE_14_SUBWAY_CAR = 14, SE_14_SUBWAY_CAR = 14,
SE_15_SLIDING_DOOR = 15, SE_15_SLIDING_DOOR = 15,
SE_16_REACTOR = 16, SE_16_REACTOR = 16,
SE_17_WARP_ELEVATOR = 17, SE_17_WARP_ELEVATOR = 17,
SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18, SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
SE_19_EXPLOSION_LOWERS_CEILING = 19, SE_19_EXPLOSION_LOWERS_CEILING = 19,
SE_20_STRETCH_BRIDGE = 20, SE_20_STRETCH_BRIDGE = 20,
SE_21_DROP_FLOOR = 21, SE_21_DROP_FLOOR = 21,
SE_22_TEETH_DOOR = 22, SE_22_TEETH_DOOR = 22,
SE_23_ONE_WAY_TELEPORT = 23, SE_23_ONE_WAY_TELEPORT = 23,
SE_24_CONVEYOR = 24, SE_24_CONVEYOR = 24,
SE_25_PISTON = 25, SE_25_PISTON = 25,
SE_26 = 26, SE_26 = 26,
SE_27_DEMO_CAM = 27, SE_27_DEMO_CAM = 27,
SE_28_LIGHTNING = 28, SE_28_LIGHTNING = 28,
SE_29_WAVES = 29, SE_29_WAVES = 29,
SE_30_TWO_WAY_TRAIN = 30, SE_30_TWO_WAY_TRAIN = 30,
SE_31_FLOOR_RISE_FALL = 31, SE_31_FLOOR_RISE_FALL = 31,
SE_32_CEILING_RISE_FALL = 32, SE_32_CEILING_RISE_FALL = 32,
SE_33_QUAKE_DEBRIS = 33, SE_33_QUAKE_DEBRIS = 33,
SE_34 = 34, SE_34 = 34,
SE_35 = 35, SE_35 = 35,
SE_36_PROJ_SHOOTER = 36, SE_36_PROJ_SHOOTER = 36,
SE_47_LIGHT_SWITCH = 47, SE_47_LIGHT_SWITCH = 47,
SE_48_LIGHT_SWITCH = 48, SE_48_LIGHT_SWITCH = 48,
SE_49_POINT_LIGHT = 49, SE_49_POINT_LIGHT = 49,
SE_50_SPOT_LIGHT = 50, SE_50_SPOT_LIGHT = 50,
SE_130 = 130, SE_130 = 130,
SE_131 = 131, SE_131 = 131,
}; };
// sector lotags, also from EDuke32, for the same reason as above. // sector lotags, also from EDuke32, for the same reason as above.
enum enum
{ {
ST_0_NO_EFFECT = 0, ST_0_NO_EFFECT = 0,
ST_1_ABOVE_WATER = 1, ST_1_ABOVE_WATER = 1,
ST_2_UNDERWATER = 2, ST_2_UNDERWATER = 2,
ST_3 = 3, ST_3 = 3,
// ^^^ maybe not complete substitution in code // ^^^ maybe not complete substitution in code
ST_9_SLIDING_ST_DOOR = 9, ST_9_SLIDING_ST_DOOR = 9,
ST_15_WARP_ELEVATOR = 15, ST_15_WARP_ELEVATOR = 15,
ST_16_PLATFORM_DOWN = 16, ST_16_PLATFORM_DOWN = 16,
ST_17_PLATFORM_UP = 17, ST_17_PLATFORM_UP = 17,
ST_18_ELEVATOR_DOWN = 18, ST_18_ELEVATOR_DOWN = 18,
ST_19_ELEVATOR_UP = 19, ST_19_ELEVATOR_UP = 19,
ST_20_CEILING_DOOR = 20, ST_20_CEILING_DOOR = 20,
ST_21_FLOOR_DOOR = 21, ST_21_FLOOR_DOOR = 21,
ST_22_SPLITTING_DOOR = 22, ST_22_SPLITTING_DOOR = 22,
ST_23_SWINGING_DOOR = 23, ST_23_SWINGING_DOOR = 23,
ST_25_SLIDING_DOOR = 25, ST_25_SLIDING_DOOR = 25,
ST_26_SPLITTING_ST_DOOR = 26, ST_26_SPLITTING_ST_DOOR = 26,
ST_27_STRETCH_BRIDGE = 27, ST_27_STRETCH_BRIDGE = 27,
ST_28_DROP_FLOOR = 28, ST_28_DROP_FLOOR = 28,
ST_29_TEETH_DOOR = 29, ST_29_TEETH_DOOR = 29,
ST_30_ROTATE_RISE_BRIDGE = 30, ST_30_ROTATE_RISE_BRIDGE = 30,
ST_31_TWO_WAY_TRAIN = 31, ST_31_TWO_WAY_TRAIN = 31,
// left: ST 32767, 65534, 65535 // left: ST 32767, 65534, 65535
}; };
// These actually existed in the original source but were never used. Weird. // These actually existed in the original source but were never used. Weird.
enum dukeinv_t enum dukeinv_t
{ {
GET_STEROIDS, // 0 GET_STEROIDS, // 0
GET_SHIELD, GET_SHIELD,
GET_SCUBA, GET_SCUBA,
GET_HOLODUKE, GET_HOLODUKE,
GET_JETPACK, GET_JETPACK,
GET_DUMMY1, // 5 GET_DUMMY1, // 5
GET_ACCESS, GET_ACCESS,
GET_HEATS, GET_HEATS,
GET_DUMMY2, GET_DUMMY2,
GET_FIRSTAID, GET_FIRSTAID,
GET_BOOTS, // 10 GET_BOOTS, // 10
GET_MAX GET_MAX
}; };
// Again from EDuke - only numeric literals were used in the original source. // 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! // these are not in the same order as the above, and it can't be changed for compat reasons. lame!
enum dukeinvicon_t enum dukeinvicon_t
{ {
ICON_NONE, // 0 ICON_NONE, // 0
ICON_FIRSTAID, ICON_FIRSTAID,
ICON_STEROIDS, ICON_STEROIDS,
ICON_HOLODUKE, ICON_HOLODUKE,
ICON_JETPACK, ICON_JETPACK,
ICON_HEATS, // 5 ICON_HEATS, // 5
ICON_SCUBA, ICON_SCUBA,
ICON_BOOTS, ICON_BOOTS,
ICON_MAX ICON_MAX
}; };
enum ESyncBits_ : uint32_t enum ESyncBits_ : uint32_t
{ {
SKB_JUMP = 1 << 0, SKB_JUMP = 1 << 0,
SKB_CROUCH = 1 << 1, SKB_CROUCH = 1 << 1,
SKB_FIRE = 1 << 2, SKB_FIRE = 1 << 2,
SKB_AIM_UP = 1 << 3, SKB_AIM_UP = 1 << 3,
SKB_AIM_DOWN = 1 << 4, SKB_AIM_DOWN = 1 << 4,
SKB_RUN = 1 << 5, SKB_RUN = 1 << 5,
SKB_LOOK_LEFT = 1 << 6, SKB_LOOK_LEFT = 1 << 6,
SKB_LOOK_RIGHT = 1 << 7, SKB_LOOK_RIGHT = 1 << 7,
SKB_FIRST_WEAPON_BIT = 1 << 8, SKB_FIRST_WEAPON_BIT = 1 << 8,
SKB_STEROIDS = 1 << 12, SKB_STEROIDS = 1 << 12,
SKB_LOOK_UP = 1 << 13, SKB_LOOK_UP = 1 << 13,
SKB_LOOK_DOWN = 1 << 14, SKB_LOOK_DOWN = 1 << 14,
SKB_NIGHTVISION = 1 << 15, SKB_NIGHTVISION = 1 << 15,
SKB_MEDKIT = 1 << 16, SKB_MEDKIT = 1 << 16,
SKB_MULTIFLAG = 1 << 17, SKB_MULTIFLAG = 1 << 17,
SKB_CENTER_VIEW = 1 << 18, SKB_CENTER_VIEW = 1 << 18,
SKB_HOLSTER = 1 << 19, SKB_HOLSTER = 1 << 19,
SKB_INV_LEFT = 1 << 20, SKB_INV_LEFT = 1 << 20,
SKB_PAUSE = 1 << 21, SKB_PAUSE = 1 << 21,
SKB_QUICK_KICK = 1 << 22, SKB_QUICK_KICK = 1 << 22,
SKB_AIMMODE = 1 << 23, SKB_AIMMODE = 1 << 23,
SKB_HOLODUKE = 1 << 24, SKB_HOLODUKE = 1 << 24,
SKB_JETPACK = 1 << 25, SKB_JETPACK = 1 << 25,
SKB_GAMEQUIT = 1 << 26, SKB_GAMEQUIT = 1 << 26,
SKB_INV_RIGHT = 1 << 27, SKB_INV_RIGHT = 1 << 27,
SKB_TURNAROUND = 1 << 28, SKB_TURNAROUND = 1 << 28,
SKB_OPEN = 1 << 29, SKB_OPEN = 1 << 29,
SKB_INVENTORY = 1 << 30, SKB_INVENTORY = 1 << 30,
SKB_ESCAPE = 1u << 31, SKB_ESCAPE = 1u << 31,
SKB_WEAPONMASK_BITS = (15u * SKB_FIRST_WEAPON_BIT), SKB_WEAPONMASK_BITS = (15u * SKB_FIRST_WEAPON_BIT),
SKB_INTERFACE_BITS = (SKB_WEAPONMASK_BITS | SKB_STEROIDS | SKB_NIGHTVISION | SKB_MEDKIT | SKB_QUICK_KICK | \ 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_HOLSTER | SKB_INV_LEFT | SKB_PAUSE | SKB_HOLODUKE | SKB_JETPACK | SKB_INV_RIGHT | \
SKB_TURNAROUND | SKB_OPEN | SKB_INVENTORY | SKB_ESCAPE), SKB_TURNAROUND | SKB_OPEN | SKB_INVENTORY | SKB_ESCAPE),
SKB_NONE = 0, SKB_NONE = 0,
SKB_ALL = ~0u SKB_ALL = ~0u
}; };
@ -336,23 +336,23 @@ enum
enum amoveflags_t enum amoveflags_t
{ {
face_player = 1, face_player = 1,
geth = 2, geth = 2,
getv = 4, getv = 4,
random_angle = 8, random_angle = 8,
face_player_slow = 16, face_player_slow = 16,
spin = 32, spin = 32,
face_player_smart = 64, face_player_smart = 64,
fleeenemy = 128, fleeenemy = 128,
jumptoplayer_only = 256, jumptoplayer_only = 256,
justjump1 = 256, justjump1 = 256,
jumptoplayer = 257, jumptoplayer = 257,
seekplayer = 512, seekplayer = 512,
furthestdir = 1024, furthestdir = 1024,
dodgebullet = 4096, dodgebullet = 4096,
justjump2 = 8192, justjump2 = 8192,
windang = 16384, windang = 16384,
antifaceplayerslow = 32768 antifaceplayerslow = 32768
}; };
enum enum
@ -363,28 +363,28 @@ enum
enum sflags_t enum sflags_t
{ {
SFLAG_SHADOW = 0x00000001, SFLAG_SHADOW = 0x00000001,
SFLAG_NVG = 0x00000002, SFLAG_NVG = 0x00000002,
SFLAG_INVENTORY = 0x00000004, SFLAG_INVENTORY = 0x00000004,
SFLAG_ADULT = 0x00000008, SFLAG_ADULT = 0x00000008,
SFLAG_SHRINKAUTOAIM = 0x00000010, SFLAG_SHRINKAUTOAIM = 0x00000010,
SFLAG_BADGUY = 0x00000020, SFLAG_BADGUY = 0x00000020,
SFLAG_NOPAL = 0x00000040, SFLAG_NOPAL = 0x00000040,
SFLAG_FORCEAUTOAIM = 0x00000080, SFLAG_FORCEAUTOAIM = 0x00000080,
SFLAG_USEACTIVATOR = 0x00000200, SFLAG_USEACTIVATOR = 0x00000200,
SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked
SFLAG_BADGUYSTAYPUT = 0x00008000, SFLAG_BADGUYSTAYPUT = 0x00008000,
SFLAG_GREENSLIMEFOOD = 0x00800000, SFLAG_GREENSLIMEFOOD = 0x00800000,
SFLAG_NODAMAGEPUSH = 0x00100000, SFLAG_NODAMAGEPUSH = 0x00100000,
SFLAG_NOWATERDIP = 0x00200000, SFLAG_NOWATERDIP = 0x00200000,
SFLAG_INTERNAL_BADGUY = 0x08000000, // a separate flag is needed for the internal ones because SFLAG_BADGUY has additional semantics. SFLAG_INTERNAL_BADGUY = 0x08000000, // a separate flag is needed for the internal ones because SFLAG_BADGUY has additional semantics.
SFLAG_KILLCOUNT = 0x10000000, SFLAG_KILLCOUNT = 0x10000000,
SFLAG_NOCANSEECHECK = 0x20000000, SFLAG_NOCANSEECHECK = 0x20000000,
}; };
enum enum
{ {
TFLAG_WALLSWITCH = 1 TFLAG_WALLSWITCH = 1
}; };
enum enum
@ -437,58 +437,58 @@ enum
enum miscConstants enum miscConstants
{ {
MAXSLEEPDIST = 16384, MAXSLEEPDIST = 16384,
SLEEPTIME = 1536, SLEEPTIME = 1536,
ZOFFSET6 = (4 << 8), ZOFFSET6 = (4 << 8),
FOURSLEIGHT = (1 << 8), FOURSLEIGHT = (1 << 8),
MOVEFIFOSIZ =256, MOVEFIFOSIZ =256,
HORIZ_MIN =-99, HORIZ_MIN =-99,
HORIZ_MAX =299, HORIZ_MAX =299,
AUTO_AIM_ANGLE =48, AUTO_AIM_ANGLE =48,
PHEIGHT_DUKE =(38<<8), PHEIGHT_DUKE =(38<<8),
PHEIGHT_RR =(40<<8), PHEIGHT_RR =(40<<8),
MAXMINECARTS = 16, MAXMINECARTS = 16,
MAXJAILDOORS = 32, MAXJAILDOORS = 32,
MAXLIGHTNINSECTORS = 64, MAXLIGHTNINSECTORS = 64,
MAXTORCHSECTORS = 64, MAXTORCHSECTORS = 64,
MAXGEOSECTORS = 64, MAXGEOSECTORS = 64,
DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0,
}; };
enum { enum {
MUS_INTRO = 0, MUS_INTRO = 0,
MUS_BRIEFING = 1, MUS_BRIEFING = 1,
MUS_LOADING = 2, MUS_LOADING = 2,
}; };
enum enum
{ {
// Control flags for WW2GI weapons. // Control flags for WW2GI weapons.
TRIPBOMB_TRIPWIRE = 1, TRIPBOMB_TRIPWIRE = 1,
TRIPBOMB_TIMER = 2 TRIPBOMB_TIMER = 2
}; };
// World tour // World tour
enum EFlamethrowerState enum EFlamethrowerState
{ {
kHitTypeMask = 0xC000, kHitTypeMask = 0xC000,
//kHitIndexMask = 0x3FFF, //kHitIndexMask = 0x3FFF,
kHitSector = 0x4000, kHitSector = 0x4000,
kHitWall = 0x8000, kHitWall = 0x8000,
kHitSprite = 0xC000, kHitSprite = 0xC000,
}; };
enum gamemode_t { enum gamemode_t {
MODE_MENU = 0x00000001, MODE_MENU = 0x00000001,
MODE_DEMO = 0x00000002, MODE_DEMO = 0x00000002,
MODE_GAME = 0x00000004, MODE_GAME = 0x00000004,
MODE_EOL = 0x00000008, MODE_EOL = 0x00000008,
MODE_TYPE = 0x00000010, MODE_TYPE = 0x00000010,
MODE_RESTART = 0x00000020, MODE_RESTART = 0x00000020,
}; };

View file

@ -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); 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 else
{ {
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE); 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) if (PLUTOPAK)
{ {
@ -156,7 +156,7 @@ class DukeMainMenu : public DukeListMenu
PalEntry pe(255, light, light, light); 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); 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);
} }
} }
} }
}; };

View file

@ -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, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of 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. See the GNU General Public License for more details.
@ -61,16 +61,16 @@ bool ceilingspace_d(int sectnum);
bool ceilingspace_r(int sectnum); bool ceilingspace_r(int sectnum);
bool floorspace_d(int sectnum); bool floorspace_d(int sectnum);
bool floorspace_r(int sectnum); bool floorspace_r(int sectnum);
void addweapon_d(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 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_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); 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_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); int movesprite_r(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype);
void lotsofmoney_d(spritetype *s, short n); void lotsofmoney_d(spritetype* s, short n);
void lotsofmail_d(spritetype *s, short n); void lotsofmail_d(spritetype* s, short n);
void lotsofpaper_d(spritetype *s, short n); void lotsofpaper_d(spritetype* s, short n);
void lotsoffeathers_r(spritetype *s, short n); void lotsoffeathers_r(spritetype* s, short n);
void guts_d(spritetype* s, short gtype, short n, short p); void guts_d(spritetype* s, short gtype, short n, short p);
void guts_r(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); void gutsdir_d(spritetype* s, short gtype, short n, short p);
@ -132,7 +132,7 @@ void SetDispatcher()
Logo_d, Logo_d,
InitFonts_d, InitFonts_d,
PrintPaused_d, PrintPaused_d,
think_d, think_d,
initactorflags_d, initactorflags_d,
isadoorwall_d, isadoorwall_d,
@ -145,20 +145,20 @@ void SetDispatcher()
checkplayerhurt_d, checkplayerhurt_d,
checkhitceiling_d, checkhitceiling_d,
checkhitsprite_d, checkhitsprite_d,
checksectors_d, checksectors_d,
ceilingspace_d, ceilingspace_d,
floorspace_d, floorspace_d,
addweapon_d, addweapon_d,
hitradius_d, hitradius_d,
movesprite_d, movesprite_d,
lotsofmoney_d, lotsofmoney_d,
lotsofmail_d, lotsofmail_d,
lotsofpaper_d, lotsofpaper_d,
guts_d, guts_d,
gutsdir_d, gutsdir_d,
ifhitsectors_d, ifhitsectors_d,
ifhitbyweapon_d, ifhitbyweapon_d,
fall_d, fall_d,
spawnweapondebris_d, spawnweapondebris_d,
respawnhitag_d, respawnhitag_d,
@ -178,13 +178,13 @@ void SetDispatcher()
animatesprites_d, animatesprites_d,
}; };
} }
else else
{ {
fi = { fi = {
Logo_r, Logo_r,
InitFonts_r, InitFonts_r,
PrintPaused_r, PrintPaused_r,
think_r, think_r,
initactorflags_r, initactorflags_r,
isadoorwall_r, isadoorwall_r,
@ -197,20 +197,20 @@ void SetDispatcher()
checkplayerhurt_r, checkplayerhurt_r,
checkhitceiling_r, checkhitceiling_r,
checkhitsprite_r, checkhitsprite_r,
checksectors_r, checksectors_r,
ceilingspace_r, ceilingspace_r,
floorspace_r, floorspace_r,
addweapon_r, addweapon_r,
hitradius_r, hitradius_r,
movesprite_r, movesprite_r,
lotsoffeathers_r, lotsoffeathers_r,
lotsoffeathers_r, lotsoffeathers_r,
lotsoffeathers_r, lotsoffeathers_r,
guts_r, guts_r,
gutsdir_r, gutsdir_r,
ifhitsectors_r, ifhitsectors_r,
ifhitbyweapon_r, ifhitbyweapon_r,
fall_r, fall_r,
spawnweapondebris_r, spawnweapondebris_r,
respawnhitag_r, respawnhitag_r,

View file

@ -64,13 +64,13 @@ struct GameInterface : ::GameInterface
struct Dispatcher struct Dispatcher
{ {
// global stuff // global stuff
void (*ShowLogo)(const CompletionFunc& completion); void (*ShowLogo)(const CompletionFunc& completion);
void (*InitFonts)(); void (*InitFonts)();
void (*PrintPaused)(); void (*PrintPaused)();
// sectors_?.cpp // sectors_?.cpp
void (*think)(); void (*think)();
void (*initactorflags)(); void (*initactorflags)();
bool (*isadoorwall)(int dapic); bool (*isadoorwall)(int dapic);
void (*animatewalls)(); void (*animatewalls)();
@ -79,7 +79,7 @@ struct Dispatcher
bool (*checkhitswitch)(int snum, int w, int switchtype); bool (*checkhitswitch)(int snum, int w, int switchtype);
void (*activatebysector)(int sect, int j); void (*activatebysector)(int sect, int j);
void (*checkhitwall)(int spr, int dawallnum, int x, int y, int z, int atwith); 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); bool (*checkhitceiling)(int sn);
void (*checkhitsprite)(int i, int sn); void (*checkhitsprite)(int i, int sn);
void (*checksectors)(int low); void (*checksectors)(int low);
@ -97,24 +97,24 @@ struct Dispatcher
int (*ifhitsectors)(int sectnum); int (*ifhitsectors)(int sectnum);
int (*ifhitbyweapon)(int sectnum); int (*ifhitbyweapon)(int sectnum);
void (*fall)(int g_i, int g_p); void (*fall)(int g_i, int g_p);
bool (*spawnweapondebris)(int picnum, int dnum); bool (*spawnweapondebris)(int picnum, int dnum);
void (*respawnhitag)(spritetype* g_sp); void (*respawnhitag)(spritetype* g_sp);
void (*checktimetosleep)(int g_i); void (*checktimetosleep)(int g_i);
void (*move)(int g_i, int g_p, int g_x); void (*move)(int g_i, int g_p, int g_x);
int (*spawn)(int j, int pn); int (*spawn)(int j, int pn);
void (*check_fta_sounds)(int i); void (*check_fta_sounds)(int i);
// player // player
void (*incur_damage)(struct player_struct* p); void (*incur_damage)(struct player_struct* p);
void (*shoot)(int, int); void (*shoot)(int, int);
void (*selectweapon)(int snum, int j); void (*selectweapon)(int snum, int j);
int (*doincrements)(struct player_struct* p); int (*doincrements)(struct player_struct* p);
void (*checkweapons)(struct player_struct* p); void (*checkweapons)(struct player_struct* p);
void (*processinput)(int snum); void (*processinput)(int snum);
void (*displayweapon)(int snum); void (*displayweapon)(int snum);
void (*displaymasks)(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);
}; };

View file

@ -41,42 +41,42 @@ BEGIN_DUKE_NS
void initactorflags_d() void initactorflags_d()
{ {
setflag(SFLAG_INTERNAL_BADGUY, { setflag(SFLAG_INTERNAL_BADGUY, {
SHARK, SHARK,
RECON, RECON,
DRONE, DRONE,
LIZTROOPONTOILET, LIZTROOPONTOILET,
LIZTROOPJUSTSIT, LIZTROOPJUSTSIT,
LIZTROOPSTAYPUT, LIZTROOPSTAYPUT,
LIZTROOPSHOOT, LIZTROOPSHOOT,
LIZTROOPJETPACK, LIZTROOPJETPACK,
LIZTROOPDUCKING, LIZTROOPDUCKING,
LIZTROOPRUNNING, LIZTROOPRUNNING,
LIZTROOP, LIZTROOP,
OCTABRAIN, OCTABRAIN,
COMMANDER, COMMANDER,
COMMANDERSTAYPUT, COMMANDERSTAYPUT,
PIGCOP, PIGCOP,
EGG, EGG,
PIGCOPSTAYPUT, PIGCOPSTAYPUT,
PIGCOPDIVE, PIGCOPDIVE,
LIZMAN, LIZMAN,
LIZMANSPITTING, LIZMANSPITTING,
LIZMANFEEDING, LIZMANFEEDING,
LIZMANJUMP, LIZMANJUMP,
ORGANTIC, ORGANTIC,
BOSS1, BOSS1,
BOSS2, BOSS2,
BOSS3, BOSS3,
BOSS4, BOSS4,
GREENSLIME, GREENSLIME,
GREENSLIME+1, GREENSLIME+1,
GREENSLIME+2, GREENSLIME+2,
GREENSLIME+3, GREENSLIME+3,
GREENSLIME+4, GREENSLIME+4,
GREENSLIME+5, GREENSLIME+5,
GREENSLIME+6, GREENSLIME+6,
GREENSLIME+7, GREENSLIME+7,
RAT, RAT,
ROTATEGUN }); 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. // 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, { settileflag(TFLAG_WALLSWITCH, {
HANDPRINTSWITCH, HANDPRINTSWITCH,
HANDPRINTSWITCH+1, HANDPRINTSWITCH+1,
ALIENSWITCH, ALIENSWITCH,
ALIENSWITCH+1, ALIENSWITCH+1,
MULTISWITCH, MULTISWITCH,
MULTISWITCH+1, MULTISWITCH+1,
MULTISWITCH+2, MULTISWITCH+2,
MULTISWITCH+3, MULTISWITCH+3,
ACCESSSWITCH, ACCESSSWITCH,
ACCESSSWITCH2, ACCESSSWITCH2,
PULLSWITCH, PULLSWITCH,
PULLSWITCH+1, PULLSWITCH+1,
HANDSWITCH, HANDSWITCH,
HANDSWITCH+1, HANDSWITCH+1,
SLOTDOOR, SLOTDOOR,
SLOTDOOR+1, SLOTDOOR+1,
LIGHTSWITCH, LIGHTSWITCH,
LIGHTSWITCH+1, LIGHTSWITCH+1,
SPACELIGHTSWITCH, SPACELIGHTSWITCH,
SPACELIGHTSWITCH+1, SPACELIGHTSWITCH+1,
SPACEDOORSWITCH, SPACEDOORSWITCH,
SPACEDOORSWITCH+1, SPACEDOORSWITCH+1,
FRANKENSTINESWITCH, FRANKENSTINESWITCH,
FRANKENSTINESWITCH+1, FRANKENSTINESWITCH+1,
LIGHTSWITCH2, LIGHTSWITCH2,
LIGHTSWITCH2+1, LIGHTSWITCH2+1,
POWERSWITCH1, POWERSWITCH1,
POWERSWITCH1+1, POWERSWITCH1+1,
LOCKSWITCH1, LOCKSWITCH1,
LOCKSWITCH1+1, LOCKSWITCH1+1,
POWERSWITCH2, POWERSWITCH2,
POWERSWITCH2+1, POWERSWITCH2+1,
DIPSWITCH, DIPSWITCH,
DIPSWITCH+1, DIPSWITCH+1,
DIPSWITCH2, DIPSWITCH2,
DIPSWITCH2+1, DIPSWITCH2+1,
TECHSWITCH, TECHSWITCH,
TECHSWITCH+1, TECHSWITCH+1,
DIPSWITCH3, DIPSWITCH3,
DIPSWITCH3+1}); DIPSWITCH3+1});
setflag(SFLAG_INVENTORY, { setflag(SFLAG_INVENTORY, {
FIRSTAID, FIRSTAID,
STEROIDS, STEROIDS,
HEATSENSOR, HEATSENSOR,
BOOTS, BOOTS,
JETPACK, JETPACK,
HOLODUKE, HOLODUKE,
AIRTANK }); AIRTANK });
setflag(SFLAG_ADULT, { setflag(SFLAG_ADULT, {
FEM1, FEM1,
FEM2, FEM2,
FEM3, FEM3,
FEM4, FEM4,
FEM5, FEM5,
FEM6, FEM6,
FEM7, FEM7,
FEM8, FEM8,
FEM9, FEM9,
FEM10, FEM10,
MAN, MAN,
MAN2, MAN2,
WOMAN, WOMAN,
NAKED1, NAKED1,
PODFEM1, PODFEM1,
FEMMAG1, FEMMAG1,
FEMMAG2, FEMMAG2,
FEMPIC1, FEMPIC1,
FEMPIC2, FEMPIC2,
FEMPIC3, FEMPIC3,
FEMPIC4, FEMPIC4,
FEMPIC5, FEMPIC5,
FEMPIC6, FEMPIC6,
FEMPIC7, FEMPIC7,
BLOODYPOLE, BLOODYPOLE,
FEM6PAD, FEM6PAD,
STATUE, STATUE,
STATUEFLASH, STATUEFLASH,
OOZ, OOZ,
OOZ2, OOZ2,
WALLBLOOD1, WALLBLOOD1,
WALLBLOOD2, WALLBLOOD2,
WALLBLOOD3, WALLBLOOD3,
WALLBLOOD4, WALLBLOOD4,
WALLBLOOD5, WALLBLOOD5,
WALLBLOOD7, WALLBLOOD7,
WALLBLOOD8, WALLBLOOD8,
SUSHIPLATE1, SUSHIPLATE1,
SUSHIPLATE2, SUSHIPLATE2,
SUSHIPLATE3, SUSHIPLATE3,
SUSHIPLATE4, SUSHIPLATE4,
FETUS, FETUS,
FETUSJIB, FETUSJIB,
FETUSBROKE, FETUSBROKE,
HOTMEAT, HOTMEAT,
FOODOBJECT16, FOODOBJECT16,
DOLPHIN1, DOLPHIN1,
DOLPHIN2, DOLPHIN2,
TOUGHGAL, TOUGHGAL,
TAMPON, TAMPON,
XXXSTACY, XXXSTACY,
4946, 4946,
4947, 4947,
693, 693,
2254, 2254,
4560, 4560,
4561, 4561,
4562, 4562,
4498, 4498,
4957 }); 4957 });
setflag(SFLAG_SHRINKAUTOAIM, { setflag(SFLAG_SHRINKAUTOAIM, {
GREENSLIME, GREENSLIME,
GREENSLIME + 1, GREENSLIME + 1,
GREENSLIME + 2, GREENSLIME + 2,
GREENSLIME + 3, GREENSLIME + 3,
GREENSLIME + 4, GREENSLIME + 4,
GREENSLIME + 5, GREENSLIME + 5,
GREENSLIME + 6, GREENSLIME + 6,
GREENSLIME + 7, GREENSLIME + 7,
}); });
actorinfo[ORGANTIC].aimoffset = 32 << 8; actorinfo[ORGANTIC].aimoffset = 32 << 8;
actorinfo[ROTATEGUN].aimoffset = 32 << 8; actorinfo[ROTATEGUN].aimoffset = 32 << 8;
weaponsandammosprites[0] = RPGSPRITE; weaponsandammosprites[0] = RPGSPRITE;
weaponsandammosprites[1] = CHAINGUNSPRITE; weaponsandammosprites[1] = CHAINGUNSPRITE;
weaponsandammosprites[2] = DEVISTATORAMMO; weaponsandammosprites[2] = DEVISTATORAMMO;
weaponsandammosprites[3] = RPGAMMO; weaponsandammosprites[3] = RPGAMMO;
weaponsandammosprites[4] = RPGAMMO; weaponsandammosprites[4] = RPGAMMO;
weaponsandammosprites[5] = JETPACK; weaponsandammosprites[5] = JETPACK;
weaponsandammosprites[6] = SHIELD; weaponsandammosprites[6] = SHIELD;
weaponsandammosprites[7] = FIRSTAID; weaponsandammosprites[7] = FIRSTAID;
weaponsandammosprites[8] = STEROIDS; weaponsandammosprites[8] = STEROIDS;
weaponsandammosprites[9] = RPGAMMO; weaponsandammosprites[9] = RPGAMMO;
weaponsandammosprites[10] = RPGAMMO; weaponsandammosprites[10] = RPGAMMO;
weaponsandammosprites[11] = RPGSPRITE; weaponsandammosprites[11] = RPGSPRITE;
weaponsandammosprites[12] = RPGAMMO; weaponsandammosprites[12] = RPGAMMO;
weaponsandammosprites[13] = FREEZESPRITE; weaponsandammosprites[13] = FREEZESPRITE;
weaponsandammosprites[14] = FREEZEAMMO; weaponsandammosprites[14] = FREEZEAMMO;
TILE_BOX = BOX; TILE_BOX = BOX;
TILE_TREE1 = TREE1; TILE_TREE1 = TREE1;
TILE_TREE2 = TREE2; TILE_TREE2 = TREE2;
TILE_TIRE = TIRE; TILE_TIRE = TIRE;
TILE_CONE = CONE; TILE_CONE = CONE;
TILE_W_FORCEFIELD = W_FORCEFIELD; TILE_W_FORCEFIELD = W_FORCEFIELD;
TILE_CAMERA1 = CAMERA1; TILE_CAMERA1 = CAMERA1;
TILE_SCRAP6 = SCRAP6; TILE_SCRAP6 = SCRAP6;
TILE_APLAYER = APLAYER; TILE_APLAYER = APLAYER;
TILE_DRONE = DRONE; TILE_DRONE = DRONE;
TILE_MENUSCREEN = MENUSCREEN; TILE_MENUSCREEN = MENUSCREEN;
TILE_SCREENBORDER = BIGHOLE; TILE_SCREENBORDER = BIGHOLE;
TILE_VIEWBORDER = VIEWBORDER; TILE_VIEWBORDER = VIEWBORDER;
TILE_LASERLINE = LASERLINE; TILE_LASERLINE = LASERLINE;
TILE_APLAYERTOP = APLAYERTOP; TILE_APLAYERTOP = APLAYERTOP;
TILE_CAMCORNER = CAMCORNER; TILE_CAMCORNER = CAMCORNER;
TILE_CAMLIGHT = CAMLIGHT; TILE_CAMLIGHT = CAMLIGHT;
TILE_STATIC = STATIC; TILE_STATIC = STATIC;
TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR;
TILE_SPINNINGNUKEICON = SPINNINGNUKEICON; TILE_SPINNINGNUKEICON = SPINNINGNUKEICON;
TILE_THREEDEE = THREEDEE; TILE_THREEDEE = THREEDEE;
TILE_INGAMEDUKETHREEDEE = INGAMEDUKETHREEDEE; TILE_INGAMEDUKETHREEDEE = INGAMEDUKETHREEDEE;
TILE_PLUTOPAKSPRITE = PLUTOPAKSPRITE; TILE_PLUTOPAKSPRITE = PLUTOPAKSPRITE;
TILE_MENUBAR = MENUBAR; TILE_MENUBAR = MENUBAR;
TILE_ATOMICHEALTH = ATOMICHEALTH; TILE_ATOMICHEALTH = ATOMICHEALTH;
TILE_FLOORSLIME = FLOORSLIME; TILE_FLOORSLIME = FLOORSLIME;
TILE_JIBS6 = JIBS6; TILE_JIBS6 = JIBS6;
TILE_WATERBUBBLE = WATERBUBBLE; TILE_WATERBUBBLE = WATERBUBBLE;
TILE_SMALLSMOKE = SMALLSMOKE; TILE_SMALLSMOKE = SMALLSMOKE;
TILE_BLOODPOOL = BLOODPOOL; TILE_BLOODPOOL = BLOODPOOL;
TILE_FOOTPRINTS = FOOTPRINTS; TILE_FOOTPRINTS = FOOTPRINTS;
TILE_FOOTPRINTS2 = FOOTPRINTS2; TILE_FOOTPRINTS2 = FOOTPRINTS2;
TILE_FOOTPRINTS3 = FOOTPRINTS3; TILE_FOOTPRINTS3 = FOOTPRINTS3;
TILE_FOOTPRINTS4 = FOOTPRINTS4; TILE_FOOTPRINTS4 = FOOTPRINTS4;
TILE_CLOUDYSKIES = CLOUDYSKIES; TILE_CLOUDYSKIES = CLOUDYSKIES;
TILE_ARROW = ARROW; TILE_ARROW = ARROW;
TILE_ACCESSSWITCH = ACCESSSWITCH; TILE_ACCESSSWITCH = ACCESSSWITCH;
TILE_ACCESSSWITCH2 = ACCESSSWITCH2; TILE_ACCESSSWITCH2 = ACCESSSWITCH2;
TILE_GLASSPIECES = GLASSPIECES; TILE_GLASSPIECES = GLASSPIECES;
TILE_BETAVERSION = BETAVERSION; TILE_BETAVERSION = BETAVERSION;
TILE_MIRROR = MIRROR; TILE_MIRROR = MIRROR;
TILE_CLOUDYOCEAN = CLOUDYOCEAN; TILE_CLOUDYOCEAN = CLOUDYOCEAN;
TILE_MOONSKY1 = MOONSKY1; TILE_MOONSKY1 = MOONSKY1;
TILE_LA = LA; TILE_LA = LA;
TILE_LOADSCREEN = LOADSCREEN; TILE_LOADSCREEN = LOADSCREEN;
TILE_CROSSHAIR = CROSSHAIR; TILE_CROSSHAIR = CROSSHAIR;
TILE_BIGORBIT1 = BIGORBIT1; TILE_BIGORBIT1 = BIGORBIT1;
TILE_HURTRAIL = HURTRAIL; TILE_HURTRAIL = HURTRAIL;
TILE_FLOORPLASMA = FLOORPLASMA; TILE_FLOORPLASMA = FLOORPLASMA;
} }

View file

@ -96,7 +96,7 @@ void initactorflags_r()
setflag(SFLAG_KILLCOUNT, { ROCK, ROCK2 }); //??? setflag(SFLAG_KILLCOUNT, { ROCK, ROCK2 }); //???
setflag(SFLAG_NODAMAGEPUSH, { HULK, MAMA, BILLYPLAY, COOTPLAY, MAMACLOUD }); setflag(SFLAG_NODAMAGEPUSH, { HULK, MAMA, BILLYPLAY, COOTPLAY, MAMACLOUD });
setflag(SFLAG_NOCANSEECHECK, { COOT, COOTSTAYPUT, BIKERB, BIKERBV2, CHEER, CHEERB, 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 else
{ {
@ -104,54 +104,54 @@ void initactorflags_r()
} }
settileflag(TFLAG_WALLSWITCH, { settileflag(TFLAG_WALLSWITCH, {
HANDPRINTSWITCH, HANDPRINTSWITCH,
HANDPRINTSWITCH+1, HANDPRINTSWITCH+1,
ALIENSWITCH, ALIENSWITCH,
ALIENSWITCH+1, ALIENSWITCH+1,
MULTISWITCH, MULTISWITCH,
MULTISWITCH+1, MULTISWITCH+1,
MULTISWITCH+2, MULTISWITCH+2,
MULTISWITCH+3, MULTISWITCH+3,
ACCESSSWITCH, ACCESSSWITCH,
ACCESSSWITCH2, ACCESSSWITCH2,
PULLSWITCH, PULLSWITCH,
PULLSWITCH+1, PULLSWITCH+1,
HANDSWITCH, HANDSWITCH,
HANDSWITCH+1, HANDSWITCH+1,
SLOTDOOR, SLOTDOOR,
SLOTDOOR+1, SLOTDOOR+1,
LIGHTSWITCH, LIGHTSWITCH,
LIGHTSWITCH+1, LIGHTSWITCH+1,
SPACELIGHTSWITCH, SPACELIGHTSWITCH,
SPACELIGHTSWITCH+1, SPACELIGHTSWITCH+1,
SPACEDOORSWITCH, SPACEDOORSWITCH,
SPACEDOORSWITCH+1, SPACEDOORSWITCH+1,
FRANKENSTINESWITCH, FRANKENSTINESWITCH,
FRANKENSTINESWITCH+1, FRANKENSTINESWITCH+1,
LIGHTSWITCH2, LIGHTSWITCH2,
LIGHTSWITCH2+1, LIGHTSWITCH2+1,
POWERSWITCH1, POWERSWITCH1,
POWERSWITCH1+1, POWERSWITCH1+1,
LOCKSWITCH1, LOCKSWITCH1,
LOCKSWITCH1+1, LOCKSWITCH1+1,
POWERSWITCH2, POWERSWITCH2,
POWERSWITCH2+1, POWERSWITCH2+1,
DIPSWITCH, DIPSWITCH,
DIPSWITCH+1, DIPSWITCH+1,
DIPSWITCH2, DIPSWITCH2,
DIPSWITCH2+1, DIPSWITCH2+1,
TECHSWITCH, TECHSWITCH,
TECHSWITCH+1, TECHSWITCH+1,
DIPSWITCH3, DIPSWITCH3,
DIPSWITCH3+1, DIPSWITCH3+1,
NUKEBUTTON, NUKEBUTTON,
NUKEBUTTON+1}); NUKEBUTTON+1});
if (isRRRA()) settileflag(TFLAG_WALLSWITCH, { if (isRRRA()) settileflag(TFLAG_WALLSWITCH, {
MULTISWITCH2, MULTISWITCH2,
MULTISWITCH2+1, MULTISWITCH2+1,
MULTISWITCH2+2, MULTISWITCH2+2,
MULTISWITCH2+3, MULTISWITCH2+3,
RRTILE8464, RRTILE8464,
RRTILE8464+1}); RRTILE8464+1});
setflag(SFLAG_INVENTORY, { setflag(SFLAG_INVENTORY, {

View file

@ -92,7 +92,7 @@ static void genspriteremaps(void)
auto fr = fileSystem.OpenFileReader("lookup.dat"); auto fr = fileSystem.OpenFileReader("lookup.dat");
if (!fr.isOpen()) if (!fr.isOpen())
return; return;
j = lookups.loadTable(fr); j = lookups.loadTable(fr);
@ -106,7 +106,7 @@ static void genspriteremaps(void)
uint8_t paldata[768]; uint8_t paldata[768];
for (j=1; j<=5; j++) for (j = 1; j <= 5; j++)
{ {
if (fr.Read(paldata, 768) != 768) if (fr.Read(paldata, 768) != 768)
return; return;
@ -121,8 +121,8 @@ static void genspriteremaps(void)
{ {
// swap red and blue channels. // swap red and blue channels.
paldata[i * 3] = GPalette.BaseColors[i].b; paldata[i * 3] = GPalette.BaseColors[i].b;
paldata[i * 3+1] = GPalette.BaseColors[i].g; paldata[i * 3 + 1] = GPalette.BaseColors[i].g;
paldata[i * 3+2] = GPalette.BaseColors[i].r; 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.) 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 void SetupGameButtons()
{ {
static const char* actions[] = { static const char* actions[] = {
"Move_Forward", "Move_Forward",
"Move_Backward", "Move_Backward",
"Turn_Left", "Turn_Left",
"Turn_Right", "Turn_Right",
"Strafe", "Strafe",
"Fire", "Fire",
"Open", "Open",
"Run", "Run",
"Jump", "Jump",
"Crouch", "Crouch",
"Look_Up", "Look_Up",
"Look_Down", "Look_Down",
"Look_Left", "Look_Left",
"Look_Right", "Look_Right",
"Strafe_Left", "Strafe_Left",
"Strafe_Right", "Strafe_Right",
"Aim_Up", "Aim_Up",
"Aim_Down", "Aim_Down",
"Map", "Map",
"Shrink_Screen", "Shrink_Screen",
"Enlarge_Screen", "Enlarge_Screen",
"Show_Opponents_Weapon", "Show_Opponents_Weapon",
"Map_Follow_Mode", "Map_Follow_Mode",
"See_Coop_View", "See_Coop_View",
"Mouse_Aiming", "Mouse_Aiming",
"Toggle_Crosshair", "Toggle_Crosshair",
"Quick_Kick", "Quick_Kick",
"Dpad_Select", "Dpad_Select",
"Dpad_Aiming", "Dpad_Aiming",
"Third_Person_View", "Third_Person_View",
"Toggle_Crouch", "Toggle_Crouch",
}; };
buttonMap.SetButtons(actions, NUM_ACTIONS); buttonMap.SetButtons(actions, NUM_ACTIONS);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -279,15 +279,15 @@ static void SetupGameButtons()
static void ticker(void) static void ticker(void)
{ {
S_Update(); S_Update();
// we need CONTROL_GetInput in order to pick up joystick button presses // we need CONTROL_GetInput in order to pick up joystick button presses
if (!(ps[myconnectindex].gm & MODE_GAME) || (paused && !System_WantGuiCapture())) if (!(ps[myconnectindex].gm & MODE_GAME) || (paused && !System_WantGuiCapture()))
{ {
ControlInfo noshareinfo; ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo); CONTROL_GetInput(&noshareinfo);
C_RunDelayedCommands(); C_RunDelayedCommands();
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -298,15 +298,15 @@ static void ticker(void)
static void loaddefs() static void loaddefs()
{ {
const char *defsfile = G_DefFile(); const char* defsfile = G_DefFile();
cycle_t deftimer; cycle_t deftimer;
deftimer.Reset(); deftimer.Reset();
deftimer.Clock(); deftimer.Clock();
if (!loaddefinitionsfile(defsfile)) if (!loaddefinitionsfile(defsfile))
{ {
deftimer.Unclock(); deftimer.Unclock();
Printf("Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS()); Printf("Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS());
} }
userConfig.AddDefs.reset(); userConfig.AddDefs.reset();
} }
@ -318,16 +318,16 @@ static void loaddefs()
static void initTiles() static void initTiles()
{ {
if (TileFiles.artLoadFiles("tiles%03i.art") < 0) if (TileFiles.artLoadFiles("tiles%03i.art") < 0)
I_FatalError("Failed loading art."); I_FatalError("Failed loading art.");
tileDelete(TILE_MIRROR); tileDelete(TILE_MIRROR);
skiptile = TILE_W_FORCEFIELD + 1; skiptile = TILE_W_FORCEFIELD + 1;
if (isRR()) if (isRR())
tileDelete(0); tileDelete(0);
tileDelete(FOF); tileDelete(FOF);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -338,85 +338,85 @@ static void initTiles()
static void Startup(void) static void Startup(void)
{ {
ud.god = 0; ud.god = 0;
ud.m_respawn_items = 0; ud.m_respawn_items = 0;
ud.m_respawn_monsters = 0; ud.m_respawn_monsters = 0;
ud.m_respawn_inventory = 0; ud.m_respawn_inventory = 0;
ud.cashman = 0; ud.cashman = 0;
ud.m_player_skill = ud.player_skill = 2; ud.m_player_skill = ud.player_skill = 2;
ud.wchoice[0][0] = 3; ud.wchoice[0][0] = 3;
ud.wchoice[0][1] = 4; ud.wchoice[0][1] = 4;
ud.wchoice[0][2] = 5; ud.wchoice[0][2] = 5;
ud.wchoice[0][3] = 7; ud.wchoice[0][3] = 7;
ud.wchoice[0][4] = 8; ud.wchoice[0][4] = 8;
ud.wchoice[0][5] = 6; ud.wchoice[0][5] = 6;
ud.wchoice[0][6] = 0; ud.wchoice[0][6] = 0;
ud.wchoice[0][7] = 2; ud.wchoice[0][7] = 2;
ud.wchoice[0][8] = 9; ud.wchoice[0][8] = 9;
ud.wchoice[0][9] = 1; ud.wchoice[0][9] = 1;
ud.multimode = 1; ud.multimode = 1;
ud.m_monsters_off = userConfig.nomonsters; ud.m_monsters_off = userConfig.nomonsters;
ps[0].aim_mode = 1; ps[0].aim_mode = 1;
ud.camerasprite = -1; ud.camerasprite = -1;
if (fileSystem.FileExists("DUKESW.BIN")) if (fileSystem.FileExists("DUKESW.BIN"))
g_gameType |= GAMEFLAG_SHAREWARE; g_gameType |= GAMEFLAG_SHAREWARE;
numplayers = 1; numplayers = 1;
playerswhenstarted = ud.multimode; playerswhenstarted = ud.multimode;
connectpoint2[0] = -1; connectpoint2[0] = -1;
SetDispatcher();
S_InitSound();
timerInit(TICRATE); SetDispatcher();
timerSetCallback(ticker); S_InitSound();
loadcons(); timerInit(TICRATE);
fi.initactorflags(); timerSetCallback(ticker);
OnEvent(EVENT_INIT); loadcons();
fi.initactorflags();
enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; OnEvent(EVENT_INIT);
if (engineInit()) enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;
G_FatalEngineError();
setupbackdrop(); if (engineInit())
//Net_SendClientInfo(); G_FatalEngineError();
setupbackdrop();
//Net_SendClientInfo();
initTiles(); initTiles();
fi.InitFonts(); fi.InitFonts();
genspriteremaps(); genspriteremaps();
TileFiles.PostLoadSetup(); TileFiles.PostLoadSetup();
SetupGameButtons(); SetupGameButtons();
InitCheats(); InitCheats();
checkcommandline(); checkcommandline();
registerosdcommands(); registerosdcommands();
registerinputcommands(); registerinputcommands();
screenpeek = myconnectindex;
ps[myconnectindex].palette = BASEPAL;
for (int j=numplayers; j<ud.multimode; j++) screenpeek = myconnectindex;
{ ps[myconnectindex].palette = BASEPAL;
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;
}
loaddefs(); for (int j = numplayers; j < ud.multimode; j++)
{
if (ud.multimode > 1) mysnprintf(ud.user_name[j], sizeof(ud.user_name[j]), "%s %d", GStrings("PLAYER"), j + 1);
{ ps[j].weaponswitch = 3;
ud.m_monsters_off = 1; ps[j].auto_aim = 0;
ud.m_player_skill = 0; }
}
ud.last_level = -1; loaddefs();
hud_size.Callback();
hud_scale.Callback(); 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(); void app_loop();
int GameInterface::app_main() int GameInterface::app_main()
{ {
Startup(); Startup();
enginePostInit(); enginePostInit();
videoInit(); videoInit();
videoSetPalette(BASEPAL); videoSetPalette(BASEPAL);
app_loop(); app_loop();
return 0; return 0;
} }
END_DUKE_NS END_DUKE_NS

View file

@ -222,12 +222,12 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4])
void setgamepalette(int palid) void setgamepalette(int palid)
{ {
if (palid >= MAXBASEPALS || palid < 0) palid = 0; if (palid >= MAXBASEPALS || palid < 0) palid = 0;
auto& fstint = lookups.tables[MAXPALOOKUPS - 1]; auto& fstint = lookups.tables[MAXPALOOKUPS - 1];
if (palid == WATERPAL) fstint.tintColor = PalEntry(224, 192, 255); if (palid == WATERPAL) fstint.tintColor = PalEntry(224, 192, 255);
else if (palid == SLIMEPAL) fstint.tintColor = PalEntry(208, 255, 192); else if (palid == SLIMEPAL) fstint.tintColor = PalEntry(208, 255, 192);
else fstint.tintColor = 0xffffff; else fstint.tintColor = 0xffffff;
videoSetPalette(palid); videoSetPalette(palid);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -716,8 +716,8 @@ void cameratext(int i)
void dobonus(int bonusonly, const CompletionFunc& completion) void dobonus(int bonusonly, const CompletionFunc& completion)
{ {
if (isRRRA()) { if (completion) completion(false); } if (isRRRA()) { if (completion) completion(false); }
else if (isRR()) dobonus_r(bonusonly, completion); else if (isRR()) dobonus_r(bonusonly, completion);
else dobonus_d(bonusonly, completion); else dobonus_d(bonusonly, completion);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -41,23 +41,23 @@ BEGIN_DUKE_NS
// Player Actions - used by ifp instruction. // Player Actions - used by ifp instruction.
enum playeraction_t { enum playeraction_t {
pstanding = 0x00000001, pstanding = 0x00000001,
pwalking = 0x00000002, pwalking = 0x00000002,
prunning = 0x00000004, prunning = 0x00000004,
pducking = 0x00000008, pducking = 0x00000008,
pfalling = 0x00000010, pfalling = 0x00000010,
pjumping = 0x00000020, pjumping = 0x00000020,
phigher = 0x00000040, phigher = 0x00000040,
pwalkingback = 0x00000080, pwalkingback = 0x00000080,
prunningback = 0x00000100, prunningback = 0x00000100,
pkicking = 0x00000200, pkicking = 0x00000200,
pshrunk = 0x00000400, pshrunk = 0x00000400,
pjetpack = 0x00000800, pjetpack = 0x00000800,
ponsteroids = 0x00001000, ponsteroids = 0x00001000,
ponground = 0x00002000, ponground = 0x00002000,
palive = 0x00004000, palive = 0x00004000,
pdead = 0x00008000, pdead = 0x00008000,
pfacing = 0x00010000 pfacing = 0x00010000
}; };

View file

@ -9,186 +9,186 @@ BEGIN_DUKE_NS
inline int rnd(int X) inline int rnd(int X)
{ {
return ((krand() >> 8) >= (255 - (X))); return ((krand() >> 8) >= (255 - (X)));
} }
inline bool AFLAMABLE(int 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) 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) 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) 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) inline int actorfella(int spnum)
{ {
return actorflag(spnum, SFLAG_KILLCOUNT); return actorflag(spnum, SFLAG_KILLCOUNT);
} }
inline void setflag(int flag, const std::initializer_list<short>& types) inline void setflag(int flag, const std::initializer_list<short>& types)
{ {
for (auto val : types) for (auto val : types)
{ {
actorinfo[val].flags |= flag; actorinfo[val].flags |= flag;
} }
} }
inline bool inventory(spritetype* S) 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<short>& types) inline void settileflag(int flag, const std::initializer_list<short>& types)
{ {
for (auto val : types) for (auto val : types)
{ {
tileinfo[val].flags |= flag; tileinfo[val].flags |= flag;
} }
} }
inline bool wallswitchcheck(int s) inline bool wallswitchcheck(int s)
{ {
return !!(tileinfo[s].flags & TFLAG_WALLSWITCH); return !!(tileinfo[s].flags & TFLAG_WALLSWITCH);
} }
inline int checkcursectnums(int se) inline int checkcursectnums(int se)
{ {
int i; int i;
for(i=connecthead;i>=0;i=connectpoint2[i]) for(i=connecthead;i>=0;i=connectpoint2[i])
if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i; if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i;
return -1; return -1;
} }
// These are from duke's sector.c // These are from duke's sector.c
inline int ldist(const spritetype* s1, const spritetype* s2) inline int ldist(const spritetype* s1, const spritetype* s2)
{ {
int vx, vy; int vx, vy;
vx = s1->x - s2->x; vx = s1->x - s2->x;
vy = s1->y - s2->y; vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1); return(FindDistance2D(vx, vy) + 1);
} }
inline int ldist(const spritetype* s1, const tspritetype* s2) inline int ldist(const spritetype* s1, const tspritetype* s2)
{ {
int vx, vy; int vx, vy;
vx = s1->x - s2->x; vx = s1->x - s2->x;
vy = s1->y - s2->y; vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1); return(FindDistance2D(vx, vy) + 1);
} }
inline int dist(const spritetype* s1, const spritetype* s2) inline int dist(const spritetype* s1, const spritetype* s2)
{ {
int vx, vy, vz; int vx, vy, vz;
vx = s1->x - s2->x; vx = s1->x - s2->x;
vy = s1->y - s2->y; vy = s1->y - s2->y;
vz = s1->z - s2->z; vz = s1->z - s2->z;
return(FindDistance3D(vx, vy, vz >> 4)); return(FindDistance3D(vx, vy, vz >> 4));
} }
inline bool isIn(int value, int first) inline bool isIn(int value, int first)
{ {
return value == first; return value == first;
} }
template<typename... Args> template<typename... Args>
bool isIn(int value, int first, Args... args) 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<int>& list) inline bool isIn(int value, const std::initializer_list<int>& list)
{ {
for (auto v : list) if (v == value) return true; for (auto v : list) if (v == value) return true;
return false; return false;
} }
// these are mainly here to avoid directly accessing the input data so that it can be more easily refactored later. // 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) inline bool PlayerInput(int pl, ESyncBits bit)
{ {
return (!!((sync[pl].bits) & bit)); return (!!((sync[pl].bits) & bit));
} }
inline void PlayerSetInput(int pl, ESyncBits bit) inline void PlayerSetInput(int pl, ESyncBits bit)
{ {
sync[pl].bits |= bit; sync[pl].bits |= bit;
} }
inline void PlayerClearInput(int pl, ESyncBits bit) inline void PlayerClearInput(int pl, ESyncBits bit)
{ {
sync[pl].bits &= ~bit; sync[pl].bits &= ~bit;
} }
inline ESyncBits PlayerInputBits(int pl, ESyncBits bits) inline ESyncBits PlayerInputBits(int pl, ESyncBits bits)
{ {
return (sync[pl].bits & bits); return (sync[pl].bits & bits);
} }
inline int PlayerInputSideVel(int pl) inline int PlayerInputSideVel(int pl)
{ {
return sync[pl].svel; return sync[pl].svel;
} }
inline int PlayerInputForwardVel(int pl) inline int PlayerInputForwardVel(int pl)
{ {
return sync[pl].fvel; return sync[pl].fvel;
} }
inline fixed_t PlayerInputAngVel(int pl) inline fixed_t PlayerInputAngVel(int pl)
{ {
return sync[pl].q16avel; return sync[pl].q16avel;
} }
inline void clearfriction() inline void clearfriction()
{ {
for (int i = 0; i != -1; i = connectpoint2[i]) for (int i = 0; i != -1; i = connectpoint2[i])
{ {
ps[i].fric.x = ps[i].fric.y = 0; ps[i].fric.x = ps[i].fric.y = 0;
} }
} }
inline void SetPlayerPal(player_struct* p, PalEntry pe) inline void SetPlayerPal(player_struct* p, PalEntry pe)
{ {
p->pals = pe; p->pals = pe;
} }
inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
{ {
if (!((ud.multimode < 2 && ((ps[myconnectindex].gm & MODE_MENU) == 0)) || if (!((ud.multimode < 2 && ((ps[myconnectindex].gm & MODE_MENU) == 0)) ||
ud.multimode > 1 || ud.recstat == 2) || paused) ud.multimode > 1 || ud.recstat == 2) || paused)
{ {
return 65536; return 65536;
} }
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC); return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
} }
// These should be the only places converting between level numbers and volume/map pairs // These should be the only places converting between level numbers and volume/map pairs
constexpr inline int levelnum(int vol, int map) constexpr inline int levelnum(int vol, int map)
{ {
return vol * 1000 + map; return vol * 1000 + map;
} }
constexpr inline int volfromlevelnum(int num) constexpr inline int volfromlevelnum(int num)
{ {
return num > 0 ? num / 1000 : 0; return num > 0 ? num / 1000 : 0;
} }
constexpr inline int mapfromlevelnum(int num) 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) inline void hud_draw(double x, double y, int tilenum, int shade, int orientation)
{ {
int p = sector[ps[screenpeek].cursectnum].floorpal; int p = sector[ps[screenpeek].cursectnum].floorpal;
hud_drawsprite(x, y, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); hud_drawsprite(x, y, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation);
} }
END_DUKE_NS END_DUKE_NS

View file

@ -105,45 +105,45 @@ void restoreinterpolations() //Stick at end of drawscreen
void setsectinterpolate(int i) void setsectinterpolate(int i)
{ {
int j, k, startwall,endwall; int j, k, startwall,endwall;
auto sect = &sector[sprite[i].sectnum]; auto sect = &sector[sprite[i].sectnum];
startwall = sect->wallptr; startwall = sect->wallptr;
endwall = startwall+sect->wallnum; endwall = startwall+sect->wallnum;
for(j=startwall;j<endwall;j++) for(j=startwall;j<endwall;j++)
{ {
setinterpolation(&wall[j].x); setinterpolation(&wall[j].x);
setinterpolation(&wall[j].y); setinterpolation(&wall[j].y);
k = wall[j].nextwall; k = wall[j].nextwall;
if(k >= 0) if(k >= 0)
{ {
setinterpolation(&wall[k].x); setinterpolation(&wall[k].x);
setinterpolation(&wall[k].y); setinterpolation(&wall[k].y);
k = wall[k].point2; k = wall[k].point2;
setinterpolation(&wall[k].x); setinterpolation(&wall[k].x);
setinterpolation(&wall[k].y); setinterpolation(&wall[k].y);
} }
} }
} }
void clearsectinterpolate(short i) void clearsectinterpolate(short i)
{ {
short j,startwall,endwall; short j,startwall,endwall;
auto sect = &sector[sprite[i].sectnum]; auto sect = &sector[sprite[i].sectnum];
startwall = sect->wallptr; startwall = sect->wallptr;
endwall = startwall + sect->wallnum; endwall = startwall + sect->wallnum;
for(j=startwall;j<endwall;j++) for(j=startwall;j<endwall;j++)
{ {
stopinterpolation(&wall[j].x); stopinterpolation(&wall[j].x);
stopinterpolation(&wall[j].y); stopinterpolation(&wall[j].y);
if(wall[j].nextwall >= 0) if(wall[j].nextwall >= 0)
{ {
stopinterpolation(&wall[wall[j].nextwall].x); stopinterpolation(&wall[wall[j].nextwall].x);
stopinterpolation(&wall[wall[j].nextwall].y); stopinterpolation(&wall[wall[j].nextwall].y);
} }
} }
} }
END_DUKE_NS END_DUKE_NS

View file

@ -59,43 +59,43 @@ extern int TILE_FLOORPLASMA;
enum dukeweapon_t enum dukeweapon_t
{ {
KNEE_WEAPON, // 0 KNEE_WEAPON, // 0
PISTOL_WEAPON, PISTOL_WEAPON,
SHOTGUN_WEAPON, SHOTGUN_WEAPON,
CHAINGUN_WEAPON, CHAINGUN_WEAPON,
RPG_WEAPON, RPG_WEAPON,
HANDBOMB_WEAPON, // 5 HANDBOMB_WEAPON, // 5
SHRINKER_WEAPON, SHRINKER_WEAPON,
DEVISTATOR_WEAPON, DEVISTATOR_WEAPON,
TRIPBOMB_WEAPON, TRIPBOMB_WEAPON,
FREEZE_WEAPON, FREEZE_WEAPON,
HANDREMOTE_WEAPON, // 10 HANDREMOTE_WEAPON, // 10
GROW_WEAPON, GROW_WEAPON,
FLAMETHROWER_WEAPON, // World Tour FLAMETHROWER_WEAPON, // World Tour
MIN_WEAPON = 0, MIN_WEAPON = 0,
MAX_WEAPON = 9 MAX_WEAPON = 9
}; };
enum redneck_weapon_t 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. // 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 // Names for 0-2 are the same
RIFLEGUN_WEAPON = 3, RIFLEGUN_WEAPON = 3,
DYNAMITE_WEAPON = 4, DYNAMITE_WEAPON = 4,
CROSSBOW_WEAPON = 5, CROSSBOW_WEAPON = 5,
THROWSAW_WEAPON = 6, THROWSAW_WEAPON = 6,
ALIENBLASTER_WEAPON = 7, ALIENBLASTER_WEAPON = 7,
POWDERKEG_WEAPON = 8, POWDERKEG_WEAPON = 8,
TIT_WEAPON = 9, TIT_WEAPON = 9,
THROWINGDYNAMITE_WEAPON = 10, THROWINGDYNAMITE_WEAPON = 10,
BUZZSAW_WEAPON = 11, BUZZSAW_WEAPON = 11,
BOWLING_WEAPON = 12, BOWLING_WEAPON = 12,
MOTORCYCLE_WEAPON = 13, MOTORCYCLE_WEAPON = 13,
BOAT_WEAPON = 14, BOAT_WEAPON = 14,
SLINGBLADE_WEAPON = 15, SLINGBLADE_WEAPON = 15,
CHICKEN_WEAPON = 16, CHICKEN_WEAPON = 16,
MAX_WEAPONS MAX_WEAPONS
}; };
END_DUKE_NS END_DUKE_NS

View file

@ -31,30 +31,30 @@ BEGIN_DUKE_NS
int madenoise(int snum) int madenoise(int snum)
{ {
player_struct *p; player_struct *p;
p = &ps[snum]; p = &ps[snum];
p->donoise = 1; p->donoise = 1;
p->noise_x = p->posx; p->noise_x = p->posx;
p->noise_y = p->posy; p->noise_y = p->posy;
return 1; return 1;
} }
int wakeup(int i, int snum) int wakeup(int i, int snum)
{ {
player_struct *p; player_struct *p;
int radius; int radius;
p = &ps[snum]; p = &ps[snum];
if (!p->donoise) if (!p->donoise)
return 0; return 0;
if (sprite[i].pal == 30 || sprite[i].pal == 32 || sprite[i].pal == 33 || (isRRRA() && sprite[i].pal == 8)) if (sprite[i].pal == 30 || sprite[i].pal == 32 || sprite[i].pal == 33 || (isRRRA() && sprite[i].pal == 8))
return 0; 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 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) && p->noise_y - radius < sprite[i].y && p->noise_y + radius > sprite[i].y)
return 1; return 1;
return 0; return 0;
} }
END_DUKE_NS END_DUKE_NS

View file

@ -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) void OnMotorcycle(struct player_struct *p, int motosprite)
{ {
if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2)) if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2))
{ {
if (motosprite) if (motosprite)
{ {
p->posx = sprite[motosprite].x; p->posx = sprite[motosprite].x;
p->posy = sprite[motosprite].y; p->posy = sprite[motosprite].y;
p->setang(sprite[motosprite].ang); p->setang(sprite[motosprite].ang);
p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner; p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner;
deletesprite(motosprite); deletesprite(motosprite);
} }
p->over_shoulder_on = 0; p->over_shoulder_on = 0;
p->OnMotorcycle = 1; p->OnMotorcycle = 1;
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = MOTORCYCLE_WEAPON; p->curr_weapon = MOTORCYCLE_WEAPON;
p->gotweapon.Set(MOTORCYCLE_WEAPON); p->gotweapon.Set(MOTORCYCLE_WEAPON);
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->sethoriz(100); p->sethoriz(100);
} }
if (!A_CheckSoundPlaying(p->i,186)) if (!A_CheckSoundPlaying(p->i,186))
A_PlaySound(186, p->i); A_PlaySound(186, p->i);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -4184,42 +4184,42 @@ void OnMotorcycle(struct player_struct *p, int motosprite)
void OffMotorcycle(struct player_struct *p) void OffMotorcycle(struct player_struct *p)
{ {
short j; short j;
if (p->OnMotorcycle) if (p->OnMotorcycle)
{ {
if (A_CheckSoundPlaying(p->i,188)) if (A_CheckSoundPlaying(p->i,188))
S_StopEnvSound(188,p->i); S_StopEnvSound(188,p->i);
if (A_CheckSoundPlaying(p->i,187)) if (A_CheckSoundPlaying(p->i,187))
S_StopEnvSound(187,p->i); S_StopEnvSound(187,p->i);
if (A_CheckSoundPlaying(p->i,186)) if (A_CheckSoundPlaying(p->i,186))
S_StopEnvSound(186,p->i); S_StopEnvSound(186,p->i);
if (A_CheckSoundPlaying(p->i,214)) if (A_CheckSoundPlaying(p->i,214))
S_StopEnvSound(214,p->i); S_StopEnvSound(214,p->i);
if (!A_CheckSoundPlaying(p->i,42)) if (!A_CheckSoundPlaying(p->i,42))
A_PlaySound(42, p->i); A_PlaySound(42, p->i);
p->OnMotorcycle = 0; p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon.Clear(MOTORCYCLE_WEAPON);
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->sethoriz(100); p->sethoriz(100);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;
p->moto_drink = 0; p->moto_drink = 0;
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->VBumpNow = 0; p->VBumpNow = 0;
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= sintable[(p->getang()+512)&2047]<<7; p->posxv -= sintable[(p->getang()+512)&2047]<<7;
p->posyv -= sintable[p->getang()&2047]<<7; p->posyv -= sintable[p->getang()&2047]<<7;
p->moto_underwater = 0; p->moto_underwater = 0;
j = fi.spawn(p->i, EMPTYBIKE); j = fi.spawn(p->i, EMPTYBIKE);
sprite[j].ang = p->getang(); sprite[j].ang = p->getang();
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7;
sprite[j].yvel += sintable[p->getang()&2047]<<7; sprite[j].yvel += sintable[p->getang()&2047]<<7;
sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; 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) void OnBoat(struct player_struct *p, int boatsprite)
{ {
if (!p->OnBoat) if (!p->OnBoat)
{ {
if (boatsprite) if (boatsprite)
{ {
p->posx = sprite[boatsprite].x; p->posx = sprite[boatsprite].x;
p->posy = sprite[boatsprite].y; p->posy = sprite[boatsprite].y;
p->setang(sprite[boatsprite].ang); p->setang(sprite[boatsprite].ang);
p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner; p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner;
deletesprite(boatsprite); deletesprite(boatsprite);
} }
p->over_shoulder_on = 0; p->over_shoulder_on = 0;
p->OnBoat = 1; p->OnBoat = 1;
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = BOAT_WEAPON; p->curr_weapon = BOAT_WEAPON;
p->gotweapon.Set(BOAT_WEAPON); p->gotweapon.Set(BOAT_WEAPON);
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->sethoriz(100); p->sethoriz(100);
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -4259,32 +4259,32 @@ void OnBoat(struct player_struct *p, int boatsprite)
void OffBoat(struct player_struct *p) void OffBoat(struct player_struct *p)
{ {
short j; short j;
if (p->OnBoat) if (p->OnBoat)
{ {
p->OnBoat = 0; p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon.Clear(BOAT_WEAPON);
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->sethoriz(100); p->sethoriz(100);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;
p->moto_drink = 0; p->moto_drink = 0;
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->VBumpNow = 0; p->VBumpNow = 0;
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= sintable[(p->getang()+512)&2047]<<7; p->posxv -= sintable[(p->getang()+512)&2047]<<7;
p->posyv -= sintable[p->getang()&2047]<<7; p->posyv -= sintable[p->getang()&2047]<<7;
p->moto_underwater = 0; p->moto_underwater = 0;
j = fi.spawn(p->i, EMPTYBOAT); j = fi.spawn(p->i, EMPTYBOAT);
sprite[j].ang = p->getang(); sprite[j].ang = p->getang();
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7;
sprite[j].yvel += sintable[p->getang()&2047]<<7; sprite[j].yvel += sintable[p->getang()&2047]<<7;
sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
} }
} }

View file

@ -50,7 +50,7 @@ short myangbak[MOVEFIFOSIZ];
void resetmys() void resetmys()
{ {
myx = omyx = ps[myconnectindex].posx; myx = omyx = ps[myconnectindex].posx;
myy = omyy = ps[myconnectindex].posy; myy = omyy = ps[myconnectindex].posy;
myz = omyz = ps[myconnectindex].posz; myz = omyz = ps[myconnectindex].posz;
myxvel = myyvel = myzvel = 0; myxvel = myyvel = myzvel = 0;
@ -60,472 +60,472 @@ void resetmys()
mycursectnum = ps[myconnectindex].cursectnum; mycursectnum = ps[myconnectindex].cursectnum;
myjumpingcounter = ps[myconnectindex].jumping_counter; myjumpingcounter = ps[myconnectindex].jumping_counter;
myjumpingtoggle = ps[myconnectindex].jumping_toggle; myjumpingtoggle = ps[myconnectindex].jumping_toggle;
myonground = ps[myconnectindex].on_ground; myonground = ps[myconnectindex].on_ground;
myhardlanding = ps[myconnectindex].hard_landing; myhardlanding = ps[myconnectindex].hard_landing;
myreturntocenter = ps[myconnectindex].return_to_center; myreturntocenter = ps[myconnectindex].return_to_center;
} }
#if 0 // todo: fix this when networking works again #if 0 // todo: fix this when networking works again
void fakedomovethingscorrect(void) void fakedomovethingscorrect(void)
{ {
int i; int i;
struct player_struct *p; struct player_struct *p;
if (numplayers < 2) return; if (numplayers < 2) return;
i = ((movefifoplc-1)&(MOVEFIFOSIZ-1)); i = ((movefifoplc-1)&(MOVEFIFOSIZ-1));
p = &ps[myconnectindex]; p = &ps[myconnectindex];
if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i]
&& p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; && p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return;
myx = p->posx; omyx = p->oposx; myxvel = p->posxv; myx = p->posx; omyx = p->oposx; myxvel = p->posxv;
myy = p->posy; omyy = p->oposy; myyvel = p->posyv; myy = p->posy; omyy = p->oposy; myyvel = p->posyv;
myz = p->posz; omyz = p->oposz; myzvel = p->poszv; myz = p->posz; omyz = p->oposz; myzvel = p->poszv;
myang = p->ang; omyang = p->oang; myang = p->ang; omyang = p->oang;
mycursectnum = p->cursectnum; mycursectnum = p->cursectnum;
myhoriz = p->horiz; omyhoriz = p->ohoriz; myhoriz = p->horiz; omyhoriz = p->ohoriz;
myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff; myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff;
myjumpingcounter = p->jumping_counter; myjumpingcounter = p->jumping_counter;
myjumpingtoggle = p->jumping_toggle; myjumpingtoggle = p->jumping_toggle;
myonground = p->on_ground; myonground = p->on_ground;
myhardlanding = p->hard_landing; myhardlanding = p->hard_landing;
myreturntocenter = p->return_to_center; myreturntocenter = p->return_to_center;
fakemovefifoplc = movefifoplc; fakemovefifoplc = movefifoplc;
while (fakemovefifoplc < movefifoend[myconnectindex]) while (fakemovefifoplc < movefifoend[myconnectindex])
fakedomovethings(); fakedomovethings();
} }
void fakedomovethings(void) void fakedomovethings(void)
{ {
input *syn; input *syn;
struct player_struct *p; struct player_struct *p;
int i, j, k, doubvel, fz, cz, hz, lz, x, y; int i, j, k, doubvel, fz, cz, hz, lz, x, y;
ESyncBits sb_snum; ESyncBits sb_snum;
short psect, psectlotag, tempsect, backcstat; short psect, psectlotag, tempsect, backcstat;
uint8_t shrunk, spritebridge; 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; backcstat = sprite[p->i].cstat;
sprite[p->i].cstat &= ~257; sprite[p->i].cstat &= ~257;
sb_snum = syn->bits; sb_snum = syn->bits;
psect = mycursectnum; psect = mycursectnum;
psectlotag = sector[psect].lotag; psectlotag = sector[psect].lotag;
spritebridge = 0; 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) ) if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) )
{ {
myx = omyx; myx = omyx;
myy = omyy; myy = omyy;
} }
else else
{ {
omyx = myx; omyx = myx;
omyy = myy; omyy = myy;
} }
omyhoriz = myhoriz; omyhoriz = myhoriz;
omyhorizoff = myhorizoff; omyhorizoff = myhorizoff;
omyz = myz; omyz = myz;
omyang = myang; 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) ) if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
psectlotag = 0; psectlotag = 0;
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) )
{ {
x = myx+(sintable[(myang+512)&2047]>>5); x = myx+(sintable[(myang+512)&2047]>>5);
y = myy+(sintable[myang&2047]>>5); y = myy+(sintable[myang&2047]>>5);
tempsect = psect; tempsect = psect;
updatesector(x,y,&tempsect); updatesector(x,y,&tempsect);
if (tempsect >= 0) if (tempsect >= 0)
{ {
k = getflorzofslope(psect,x,y); k = getflorzofslope(psect,x,y);
if (psect == tempsect) if (psect == tempsect)
myhorizoff += mulscale16(j-k,160); myhorizoff += mulscale16(j-k,160);
else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8)) else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8))
myhorizoff += mulscale16(j-k,160); myhorizoff += mulscale16(j-k,160);
} }
} }
if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1); if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1);
else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1); else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1);
if(hz >= 0 && (hz&49152) == 49152) if(hz >= 0 && (hz&49152) == 49152)
{ {
hz &= (MAXSPRITES-1); hz &= (MAXSPRITES-1);
if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0) if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0)
{ {
hz = 0; hz = 0;
cz = getceilzofslope(psect,myx,myy); cz = getceilzofslope(psect,myx,myy);
} }
} }
if(lz >= 0 && (lz&49152) == 49152) if(lz >= 0 && (lz&49152) == 49152)
{ {
j = lz&(MAXSPRITES-1); j = lz&(MAXSPRITES-1);
if ((sprite[j].cstat&33) == 33) if ((sprite[j].cstat&33) == 33)
{ {
psectlotag = 0; psectlotag = 0;
spritebridge = 1; spritebridge = 1;
} }
if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) ) 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); j = getangle( sprite[j].x-myx,sprite[j].y-myy);
myxvel -= sintable[(j+512)&2047]<<4; myxvel -= sintable[(j+512)&2047]<<4;
myyvel -= sintable[j&2047]<<4; myyvel -= sintable[j&2047]<<4;
} }
} }
if( sprite[p->i].extra <= 0 ) if( sprite[p->i].extra <= 0 )
{ {
if( psectlotag == 2 ) if( psectlotag == 2 )
{ {
if(p->on_warping_sector == 0) if(p->on_warping_sector == 0)
{ {
if( klabs(myz-fz) > (PHEIGHT>>1)) if( klabs(myz-fz) > (PHEIGHT>>1))
myz += 348; myz += 348;
} }
clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0); clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
} }
updatesector(myx,myy,&mycursectnum); updatesector(myx,myy,&mycursectnum);
pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0); pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
myhoriz = 100; myhoriz = 100;
myhorizoff = 0; 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) if( psectlotag == 2)
{ {
myjumpingcounter = 0; myjumpingcounter = 0;
if ( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) ) if ( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) )
{ {
if(myzvel > 0) myzvel = 0; if(myzvel > 0) myzvel = 0;
myzvel -= 348; myzvel -= 348;
if(myzvel < -(256*6)) myzvel = -(256*6); if(myzvel < -(256*6)) myzvel = -(256*6);
} }
else if ( (sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat) ) else if ( (sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat) )
{ {
if(myzvel < 0) myzvel = 0; if(myzvel < 0) myzvel = 0;
myzvel += 348; myzvel += 348;
if(myzvel > (256*6)) myzvel = (256*6); if(myzvel > (256*6)) myzvel = (256*6);
} }
else else
{ {
if(myzvel < 0) if(myzvel < 0)
{ {
myzvel += 256; myzvel += 256;
if(myzvel > 0) if(myzvel > 0)
myzvel = 0; myzvel = 0;
} }
if(myzvel > 0) if(myzvel > 0)
{ {
myzvel -= 256; myzvel -= 256;
if(myzvel < 0) if(myzvel < 0)
myzvel = 0; myzvel = 0;
} }
} }
if(myzvel > 2048) myzvel >>= 1; if(myzvel > 2048) myzvel >>= 1;
myz += myzvel; myz += myzvel;
if(myz > (fz-(15<<8)) ) if(myz > (fz-(15<<8)) )
myz += ((fz-(15<<8))-myz)>>1; myz += ((fz-(15<<8))-myz)>>1;
if(myz < (cz+(4<<8)) ) if(myz < (cz+(4<<8)) )
{ {
myz = cz+(4<<8); myz = cz+(4<<8);
myzvel = 0; myzvel = 0;
} }
} }
else if(p->jetpack_on) else if(p->jetpack_on)
{ {
myonground = 0; myonground = 0;
myjumpingcounter = 0; myjumpingcounter = 0;
myhardlanding = 0; myhardlanding = 0;
if(p->jetpack_on < 11) if(p->jetpack_on < 11)
myz -= (p->jetpack_on<<7); //Goin up myz -= (p->jetpack_on<<7); //Goin up
if(shrunk) j = 512; if(shrunk) j = 512;
else j = 2048; else j = 2048;
if ((sb_snum&1) && !(p->OnMotorcycle || p->OnBoat)) if ((sb_snum&1) && !(p->OnMotorcycle || p->OnBoat))
myz -= j; myz -= j;
if ((sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat)) if ((sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat))
myz += j; myz += j;
if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32; if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32;
else k = 16; else k = 16;
if(myz > (fz-(k<<8)) ) if(myz > (fz-(k<<8)) )
myz += ((fz-(k<<8))-myz)>>1; myz += ((fz-(k<<8))-myz)>>1;
if(myz < (cz+(18<<8)) ) if(myz < (cz+(18<<8)) )
myz = cz+(18<<8); myz = cz+(18<<8);
} }
else if( psectlotag != 2 ) else if( psectlotag != 2 )
{ {
if (psectlotag == 1 && p->spritebridge == 0) if (psectlotag == 1 && p->spritebridge == 0)
{ {
if(shrunk == 0) i = 34; if(shrunk == 0) i = 34;
else i = 12; else i = 12;
} }
if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling 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) ) ) if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) )
myz = fz-(i<<8); myz = fz-(i<<8);
else else
{ {
myonground = 0; myonground = 0;
myzvel += (gc+80); myzvel += (gc+80);
if(myzvel >= (4096+2048)) myzvel = (4096+2048); if(myzvel >= (4096+2048)) myzvel = (4096+2048);
} }
} }
else else
{ {
if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1)) if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1))
myhardlanding = myzvel>>10; myhardlanding = myzvel>>10;
myonground = 1; myonground = 1;
if(i==40) if(i==40)
{ {
//Smooth on the ground //Smooth on the ground
k = ((fz-(i<<8))-myz)>>1; k = ((fz-(i<<8))-myz)>>1;
if( klabs(k) < 256 ) k = 0; if( klabs(k) < 256 ) k = 0;
myz += k; // ((fz-(i<<8))-myz)>>1; myz += k; // ((fz-(i<<8))-myz)>>1;
myzvel -= 768; // 412; myzvel -= 768; // 412;
if(myzvel < 0) myzvel = 0; if(myzvel < 0) myzvel = 0;
} }
else if(myjumpingcounter == 0) else if(myjumpingcounter == 0)
{ {
myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water
if(p->on_warping_sector == 0 && myz > fz-(16<<8)) if(p->on_warping_sector == 0 && myz > fz-(16<<8))
{ {
myz = fz-(16<<8); myz = fz-(16<<8);
myzvel >>= 1; myzvel >>= 1;
} }
} }
if( (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat) ) if( (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat) )
myz += (2048+768); myz += (2048+768);
if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1)
myjumpingtoggle = 0; myjumpingtoggle = 0;
else if( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 0 ) else if( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 0 )
{ {
if( myjumpingcounter == 0 ) if( myjumpingcounter == 0 )
if( (fz-cz) > (56<<8) ) if( (fz-cz) > (56<<8) )
{ {
myjumpingcounter = 1; myjumpingcounter = 1;
myjumpingtoggle = 1; myjumpingtoggle = 1;
} }
} }
if(!isRR() && myjumpingcounter && (sb_snum&1) == 0 ) if(!isRR() && myjumpingcounter && (sb_snum&1) == 0 )
myjumpingcounter = 0; myjumpingcounter = 0;
} }
if(myjumpingcounter) if(myjumpingcounter)
{ {
if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1) if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1)
myjumpingtoggle = 0; myjumpingtoggle = 0;
if( myjumpingcounter < (1024+256) ) if( myjumpingcounter < (1024+256) )
{ {
if(psectlotag == 1 && myjumpingcounter > 768) if(psectlotag == 1 && myjumpingcounter > 768)
{ {
myjumpingcounter = 0; myjumpingcounter = 0;
myzvel = -512; myzvel = -512;
} }
else else
{ {
myzvel -= (sintable[(2048-128+myjumpingcounter)&2047])/12; myzvel -= (sintable[(2048-128+myjumpingcounter)&2047])/12;
myjumpingcounter += 180; myjumpingcounter += 180;
myonground = 0; myonground = 0;
} }
} }
else else
{ {
myjumpingcounter = 0; myjumpingcounter = 0;
myzvel = 0; myzvel = 0;
} }
} }
myz += myzvel; myz += myzvel;
if(myz < (cz+(4<<8)) ) if(myz < (cz+(4<<8)) )
{ {
myjumpingcounter = 0; myjumpingcounter = 0;
if(myzvel < 0) myxvel = myyvel = 0; if(myzvel < 0) myxvel = myyvel = 0;
myzvel = 128; myzvel = 128;
myz = cz+(4<<8); myz = cz+(4<<8);
} }
} }
if (movementBlocked(snum) || myhardlanding) if (movementBlocked(snum) || myhardlanding)
{ {
doubvel = 0; doubvel = 0;
myxvel = 0; myxvel = 0;
myyvel = 0; myyvel = 0;
} }
else if ( syn->avel ) //p->ang += syncangvel * constant else if ( syn->avel ) //p->ang += syncangvel * constant
{ //ENGINE calculates angvel for you { //ENGINE calculates angvel for you
int tempang; int tempang;
tempang = syn->avel<<1; tempang = syn->avel<<1;
if(psectlotag == 2) if(psectlotag == 2)
myang += (tempang-(tempang>>3))*sgn(doubvel); myang += (tempang-(tempang>>3))*sgn(doubvel);
else myang += (tempang)*sgn(doubvel); else myang += (tempang)*sgn(doubvel);
myang &= 2047; myang &= 2047;
} }
if ( myxvel || myyvel || syn->fvel || syn->svel ) if ( myxvel || myyvel || syn->fvel || syn->svel )
{ {
if(p->steroids_amount > 0 && p->steroids_amount < 400) if(p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1; doubvel <<= 1;
myxvel += ((syn->fvel*doubvel)<<6); myxvel += ((syn->fvel*doubvel)<<6);
myyvel += ((syn->svel*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)) ) if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) )
{ {
myxvel = mulscale16(myxvel,dukefriction-0x2000); myxvel = mulscale16(myxvel,dukefriction-0x2000);
myyvel = mulscale16(myyvel,dukefriction-0x2000); myyvel = mulscale16(myyvel,dukefriction-0x2000);
} }
else else
{ {
if(psectlotag == 2) if(psectlotag == 2)
{ {
myxvel = mulscale16(myxvel,dukefriction-0x1400); myxvel = mulscale16(myxvel,dukefriction-0x1400);
myyvel = mulscale16(myyvel,dukefriction-0x1400); myyvel = mulscale16(myyvel,dukefriction-0x1400);
} }
else else
{ {
myxvel = mulscale16(myxvel,dukefriction); myxvel = mulscale16(myxvel,dukefriction);
myyvel = mulscale16(myyvel,dukefriction); myyvel = mulscale16(myyvel,dukefriction);
} }
} }
if( abs(myxvel) < 2048 && abs(myyvel) < 2048 ) if( abs(myxvel) < 2048 && abs(myyvel) < 2048 )
myxvel = myyvel = 0; myxvel = myyvel = 0;
if( shrunk ) if( shrunk )
{ {
myxvel = myxvel =
mulscale16(myxvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); mulscale16(myxvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2));
myyvel = myyvel =
mulscale16(myyvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2)); mulscale16(myyvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2));
} }
} }
FAKEHORIZONLY: 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); clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0);
pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0); pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0);
if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk) if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk)
myz += 30<<8; myz += 30<<8;
if ((sb_snum&(1<<18)) || myhardlanding) if ((sb_snum&(1<<18)) || myhardlanding)
myreturntocenter = 9; myreturntocenter = 9;
if (sb_snum&(1<<13)) if (sb_snum&(1<<13))
{ {
myreturntocenter = 9; myreturntocenter = 9;
if (sb_snum&(1<<5)) myhoriz += 6; if (sb_snum&(1<<5)) myhoriz += 6;
myhoriz += 6; myhoriz += 6;
} }
else if (sb_snum&(1<<14)) else if (sb_snum&(1<<14))
{ {
myreturntocenter = 9; myreturntocenter = 9;
if (sb_snum&(1<<5)) myhoriz -= 6; if (sb_snum&(1<<5)) myhoriz -= 6;
myhoriz -= 6; myhoriz -= 6;
} }
else if ((sb_snum&(1<<3)) && !(p->OnMotorcycle || p->OnBoat)) else if ((sb_snum&(1<<3)) && !(p->OnMotorcycle || p->OnBoat))
{ {
if (sb_snum&(1<<5)) myhoriz += 6; if (sb_snum&(1<<5)) myhoriz += 6;
myhoriz += 6; myhoriz += 6;
} }
else if ((sb_snum&(1<<4)) && !(p->OnMotorcycle || p->OnBoat)) else if ((sb_snum&(1<<4)) && !(p->OnMotorcycle || p->OnBoat))
{ {
if (sb_snum&(1<<5)) myhoriz -= 6; if (sb_snum&(1<<5)) myhoriz -= 6;
myhoriz -= 6; myhoriz -= 6;
} }
if (myreturntocenter > 0) if (myreturntocenter > 0)
if ((sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0) if ((sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0)
{ {
myreturntocenter--; myreturntocenter--;
myhoriz += 33-(myhoriz/3); myhoriz += 33-(myhoriz/3);
} }
if(p->aim_mode) if(p->aim_mode)
myhoriz += syn->horz>>1; myhoriz += syn->horz>>1;
else else
{ {
if( myhoriz > 95 && myhoriz < 105) myhoriz = 100; if( myhoriz > 95 && myhoriz < 105) myhoriz = 100;
if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0; if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0;
} }
if (myhardlanding > 0) if (myhardlanding > 0)
{ {
myhardlanding--; myhardlanding--;
myhoriz -= (myhardlanding<<4); myhoriz -= (myhardlanding<<4);
} }
myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX); myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX);
if(p->knee_incs > 0) if(p->knee_incs > 0)
{ {
myhoriz -= 48; myhoriz -= 48;
myreturntocenter = 9; myreturntocenter = 9;
} }
ENDFAKEPROCESSINPUT: ENDFAKEPROCESSINPUT:
myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx; myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx;
myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy; myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy;
myzbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myz; myzbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myz;
myangbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myang; myangbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myang;
myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz; myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz;
fakemovefifoplc++; fakemovefifoplc++;
sprite[p->i].cstat = backcstat; sprite[p->i].cstat = backcstat;
} }
#endif #endif

View file

@ -41,7 +41,7 @@ BEGIN_DUKE_NS
inline void tloadtile(int tilenum, int palnum = 0) inline void tloadtile(int tilenum, int palnum = 0)
{ {
assert(tilenum < MAXTILES); assert(tilenum < MAXTILES);
markTileForPrecache(tilenum, palnum); markTileForPrecache(tilenum, palnum);
} }
@ -53,118 +53,118 @@ inline void tloadtile(int tilenum, int palnum = 0)
static void cachespritenum(int i) static void cachespritenum(int i)
{ {
int maxc; int maxc;
int j; int j;
int pal = sprite[i].pal; 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) switch(sprite[i].picnum)
{ {
case HYDRENT: case HYDRENT:
tloadtile(BROKEFIREHYDRENT); tloadtile(BROKEFIREHYDRENT);
for(j = TOILETWATER; j < (TOILETWATER+4); j++) for(j = TOILETWATER; j < (TOILETWATER+4); j++)
tloadtile(j, pal); tloadtile(j, pal);
break; break;
case TOILET: case TOILET:
tloadtile(TOILETBROKE); tloadtile(TOILETBROKE);
for(j = TOILETWATER; j < (TOILETWATER+4); j++) for(j = TOILETWATER; j < (TOILETWATER+4); j++)
tloadtile(j, pal); tloadtile(j, pal);
break; break;
case STALL: case STALL:
tloadtile(STALLBROKE); tloadtile(STALLBROKE);
for(j = TOILETWATER; j < (TOILETWATER+4); j++) for(j = TOILETWATER; j < (TOILETWATER+4); j++)
tloadtile(j, pal); tloadtile(j, pal);
break; break;
case RUBBERCAN: case RUBBERCAN:
maxc = 2; maxc = 2;
break; break;
case TOILETWATER: case TOILETWATER:
maxc = 4; maxc = 4;
break; break;
case FEMPIC1: case FEMPIC1:
maxc = 44; maxc = 44;
break; break;
case LIZTROOP: case LIZTROOP:
case LIZTROOPRUNNING: case LIZTROOPRUNNING:
case LIZTROOPSHOOT: case LIZTROOPSHOOT:
case LIZTROOPJETPACK: case LIZTROOPJETPACK:
case LIZTROOPONTOILET: case LIZTROOPONTOILET:
case LIZTROOPDUCKING: case LIZTROOPDUCKING:
for(j = LIZTROOP; j < (LIZTROOP+72); j++) for(j = LIZTROOP; j < (LIZTROOP+72); j++)
tloadtile(j, pal); tloadtile(j, pal);
for(j=HEADJIB1;j<LEGJIB1+3;j++) for(j=HEADJIB1;j<LEGJIB1+3;j++)
tloadtile(j, pal); tloadtile(j, pal);
maxc = 0; maxc = 0;
break; break;
case WOODENHORSE: case WOODENHORSE:
maxc = 5; maxc = 5;
for(j = HORSEONSIDE; j < (HORSEONSIDE+4); j++) for(j = HORSEONSIDE; j < (HORSEONSIDE+4); j++)
tloadtile(j, pal); tloadtile(j, pal);
break; break;
case NEWBEAST: case NEWBEAST:
case NEWBEASTSTAYPUT: case NEWBEASTSTAYPUT:
maxc = 90; maxc = 90;
break; break;
case BOSS1: case BOSS1:
case BOSS2: case BOSS2:
case BOSS3: case BOSS3:
maxc = 30; maxc = 30;
break; break;
case OCTABRAIN: case OCTABRAIN:
case OCTABRAINSTAYPUT: case OCTABRAINSTAYPUT:
case COMMANDER: case COMMANDER:
case COMMANDERSTAYPUT: case COMMANDERSTAYPUT:
maxc = 38; maxc = 38;
break; break;
case RECON: case RECON:
maxc = 13; maxc = 13;
break; break;
case PIGCOP: case PIGCOP:
case PIGCOPDIVE: case PIGCOPDIVE:
maxc = 61; maxc = 61;
break; break;
case SHARK: case SHARK:
maxc = 30; maxc = 30;
break; break;
case LIZMAN: case LIZMAN:
case LIZMANSPITTING: case LIZMANSPITTING:
case LIZMANFEEDING: case LIZMANFEEDING:
case LIZMANJUMP: case LIZMANJUMP:
for(j=LIZMANHEAD1;j<LIZMANLEG1+3;j++) for(j=LIZMANHEAD1;j<LIZMANLEG1+3;j++)
tloadtile(j, pal); tloadtile(j, pal);
maxc = 80; maxc = 80;
break; break;
case APLAYER: case APLAYER:
maxc = 0; maxc = 0;
if(ud.multimode > 1) if(ud.multimode > 1)
{ {
maxc = 5; maxc = 5;
for(j = 1420;j < 1420+106; j++) for(j = 1420;j < 1420+106; j++)
tloadtile(j, pal); tloadtile(j, pal);
} }
break; break;
case ATOMICHEALTH: case ATOMICHEALTH:
maxc = 14; maxc = 14;
break; break;
case DRONE: case DRONE:
maxc = 10; maxc = 10;
break; break;
case EXPLODINGBARREL: case EXPLODINGBARREL:
case SEENINE: case SEENINE:
case OOZFILTER: case OOZFILTER:
maxc = 3; maxc = 3;
break; break;
case NUKEBARREL: case NUKEBARREL:
case CAMERA1: case CAMERA1:
maxc = 5; maxc = 5;
break; break;
} }
for(j = sprite[i].picnum; j < (sprite[i].picnum+maxc); j++) for(j = sprite[i].picnum; j < (sprite[i].picnum+maxc); j++)
tloadtile(j, pal); tloadtile(j, pal);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -175,51 +175,51 @@ static void cachespritenum(int i)
static void cachegoodsprites(void) static void cachegoodsprites(void)
{ {
int i; int i;
tloadtile(BOTTOMSTATUSBAR); tloadtile(BOTTOMSTATUSBAR);
if (ud.multimode > 1) if (ud.multimode > 1)
{ {
tloadtile(FRAGBAR); tloadtile(FRAGBAR);
for (i = MINIFONT; i < MINIFONT + 63; i++) for (i = MINIFONT; i < MINIFONT + 63; i++)
tloadtile(i); tloadtile(i);
} }
tloadtile(VIEWSCREEN); tloadtile(VIEWSCREEN);
for(i=FOOTPRINTS;i<FOOTPRINTS+3;i++) for(i=FOOTPRINTS;i<FOOTPRINTS+3;i++)
tloadtile(i); tloadtile(i);
for( i = BURNING; i < BURNING+14; i++) for( i = BURNING; i < BURNING+14; i++)
tloadtile(i); tloadtile(i);
for( i = BURNING2; i < BURNING2+14; i++) for( i = BURNING2; i < BURNING2+14; i++)
tloadtile(i); tloadtile(i);
for( i = CRACKKNUCKLES; i < CRACKKNUCKLES+4; i++) for( i = CRACKKNUCKLES; i < CRACKKNUCKLES+4; i++)
tloadtile(i); tloadtile(i);
for( i = FIRSTGUN; i < FIRSTGUN+3 ; i++ ) for( i = FIRSTGUN; i < FIRSTGUN+3 ; i++ )
tloadtile(i); tloadtile(i);
for( i = EXPLOSION2; i < EXPLOSION2+21 ; i++ ) for( i = EXPLOSION2; i < EXPLOSION2+21 ; i++ )
tloadtile(i); tloadtile(i);
tloadtile(BULLETHOLE); tloadtile(BULLETHOLE);
for( i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8 ; i++ ) for( i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8 ; i++ )
tloadtile(i); tloadtile(i);
tloadtile(FOOTPRINTS); tloadtile(FOOTPRINTS);
for( i = JIBS1; i < (JIBS5+5); i++) for( i = JIBS1; i < (JIBS5+5); i++)
tloadtile(i); tloadtile(i);
for( i = SCRAP1; i < (SCRAP1+19); i++) for( i = SCRAP1; i < (SCRAP1+19); i++)
tloadtile(i); tloadtile(i);
for( i = SMALLSMOKE; i < (SMALLSMOKE+4); i++) for( i = SMALLSMOKE; i < (SMALLSMOKE+4); i++)
tloadtile(i); tloadtile(i);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -230,37 +230,37 @@ static void cachegoodsprites(void)
void cacheit_d(void) void cacheit_d(void)
{ {
int i, j; int i, j;
cachegoodsprites(); cachegoodsprites();
for (i = 0; i < numwalls; i++) for (i = 0; i < numwalls; i++)
{ {
tloadtile(wall[i].picnum, wall[i].pal); tloadtile(wall[i].picnum, wall[i].pal);
if (wall[i].overpicnum >= 0) if (wall[i].overpicnum >= 0)
tloadtile(wall[i].overpicnum, wall[i].pal); tloadtile(wall[i].overpicnum, wall[i].pal);
} }
for (i = 0; i < numsectors; i++) for (i = 0; i < numsectors; i++)
{ {
tloadtile(sector[i].floorpicnum, sector[i].floorpal); tloadtile(sector[i].floorpicnum, sector[i].floorpal);
tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal); tloadtile(sector[i].ceilingpicnum, sector[i].ceilingpal);
if (sector[i].ceilingpicnum == LA) if (sector[i].ceilingpicnum == LA)
{ {
tloadtile(LA + 1); tloadtile(LA + 1);
tloadtile(LA + 2); tloadtile(LA + 2);
} }
} }
j = headspritesect[i]; j = headspritesect[i];
while (j >= 0) while (j >= 0)
{ {
if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat & 32768) == 0) if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat & 32768) == 0)
cachespritenum(j); cachespritenum(j);
j = nextspritesect[j]; j = nextspritesect[j];
} }
precacheMarkedTiles(); precacheMarkedTiles();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -271,240 +271,240 @@ void cacheit_d(void)
void prelevel_d(int g) void prelevel_d(int g)
{ {
short i, nexti, j, startwall, endwall, lotaglist; short i, nexti, j, startwall, endwall, lotaglist;
short lotags[65]; short lotags[65];
prelevel_common(g); prelevel_common(g);
i = headspritestat[0]; i = headspritestat[0];
while (i >= 0) while (i >= 0)
{ {
nexti = nextspritestat[i]; nexti = nextspritestat[i];
if (sprite[i].lotag == -1 && (sprite[i].cstat & 16)) if (sprite[i].lotag == -1 && (sprite[i].cstat & 16))
{ {
ps[0].exitx = sprite[i].x; ps[0].exitx = sprite[i].x;
ps[0].exity = sprite[i].y; ps[0].exity = sprite[i].y;
} }
else switch (sprite[i].picnum) else switch (sprite[i].picnum)
{ {
case GPSPEED: case GPSPEED:
sector[sprite[i].sectnum].extra = sprite[i].lotag; sector[sprite[i].sectnum].extra = sprite[i].lotag;
deletesprite(i); deletesprite(i);
break; break;
case CYCLER: case CYCLER:
if (numcyclers >= MAXCYCLERS) if (numcyclers >= MAXCYCLERS)
I_Error("Too many cycling sectors."); I_Error("Too many cycling sectors.");
cyclers[numcyclers][0] = sprite[i].sectnum; cyclers[numcyclers][0] = sprite[i].sectnum;
cyclers[numcyclers][1] = sprite[i].lotag; cyclers[numcyclers][1] = sprite[i].lotag;
cyclers[numcyclers][2] = sprite[i].shade; cyclers[numcyclers][2] = sprite[i].shade;
cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade; cyclers[numcyclers][3] = sector[sprite[i].sectnum].floorshade;
cyclers[numcyclers][4] = sprite[i].hitag; cyclers[numcyclers][4] = sprite[i].hitag;
cyclers[numcyclers][5] = (sprite[i].ang == 1536); cyclers[numcyclers][5] = (sprite[i].ang == 1536);
numcyclers++; numcyclers++;
deletesprite(i); deletesprite(i);
break; break;
} }
i = nexti; i = nexti;
} }
for (i = 0; i < MAXSPRITES; i++) for (i = 0; i < MAXSPRITES; i++)
{ {
if (sprite[i].statnum < MAXSTATUS) if (sprite[i].statnum < MAXSTATUS)
{ {
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14)
continue; continue;
fi.spawn(-1, i); fi.spawn(-1, i);
} }
} }
for (i = 0; i < MAXSPRITES; i++) for (i = 0; i < MAXSPRITES; i++)
if (sprite[i].statnum < MAXSTATUS) if (sprite[i].statnum < MAXSTATUS)
{ {
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14) if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14)
fi.spawn(-1, i); fi.spawn(-1, i);
} }
lotaglist = 0; lotaglist = 0;
i = headspritestat[0]; i = headspritestat[0];
while (i >= 0) while (i >= 0)
{ {
switch (sprite[i].picnum) switch (sprite[i].picnum)
{ {
case DIPSWITCH + 1: case DIPSWITCH + 1:
case DIPSWITCH2 + 1: case DIPSWITCH2 + 1:
case PULLSWITCH + 1: case PULLSWITCH + 1:
case HANDSWITCH + 1: case HANDSWITCH + 1:
case SLOTDOOR + 1: case SLOTDOOR + 1:
case LIGHTSWITCH + 1: case LIGHTSWITCH + 1:
case SPACELIGHTSWITCH + 1: case SPACELIGHTSWITCH + 1:
case SPACEDOORSWITCH + 1: case SPACEDOORSWITCH + 1:
case FRANKENSTINESWITCH + 1: case FRANKENSTINESWITCH + 1:
case LIGHTSWITCH2 + 1: case LIGHTSWITCH2 + 1:
case POWERSWITCH1 + 1: case POWERSWITCH1 + 1:
case LOCKSWITCH1 + 1: case LOCKSWITCH1 + 1:
case POWERSWITCH2 + 1: case POWERSWITCH2 + 1:
for (j = 0; j < lotaglist; j++) for (j = 0; j < lotaglist; j++)
if (sprite[i].lotag == lotags[j]) if (sprite[i].lotag == lotags[j])
break; break;
if (j == lotaglist) if (j == lotaglist)
{ {
lotags[lotaglist] = sprite[i].lotag; lotags[lotaglist] = sprite[i].lotag;
lotaglist++; lotaglist++;
if (lotaglist > 64) if (lotaglist > 64)
I_Error("Too many switches (64 max)."); I_Error("Too many switches (64 max).");
j = headspritestat[3]; j = headspritestat[3];
while (j >= 0) while (j >= 0)
{ {
if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag) if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag)
hittype[j].temp_data[0] = 1; hittype[j].temp_data[0] = 1;
j = nextspritestat[j]; j = nextspritestat[j];
} }
} }
break; break;
} }
i = nextspritestat[i]; i = nextspritestat[i];
} }
mirrorcnt = 0; mirrorcnt = 0;
for (i = 0; i < numwalls; i++) for (i = 0; i < numwalls; i++)
{ {
walltype* wal; walltype* wal;
wal = &wall[i]; wal = &wall[i];
if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0) if (wal->overpicnum == MIRROR && (wal->cstat & 32) != 0)
{ {
j = wal->nextsector; j = wal->nextsector;
if (mirrorcnt > 63) if (mirrorcnt > 63)
I_Error("Too many mirrors (64 max.)"); I_Error("Too many mirrors (64 max.)");
if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) if ((j >= 0) && sector[j].ceilingpicnum != MIRROR)
{ {
sector[j].ceilingpicnum = MIRROR; sector[j].ceilingpicnum = MIRROR;
sector[j].floorpicnum = MIRROR; sector[j].floorpicnum = MIRROR;
mirrorwall[mirrorcnt] = i; mirrorwall[mirrorcnt] = i;
mirrorsector[mirrorcnt] = j; mirrorsector[mirrorcnt] = j;
mirrorcnt++; mirrorcnt++;
continue; continue;
} }
} }
if (numanimwalls >= MAXANIMWALLS) if (numanimwalls >= MAXANIMWALLS)
I_Error("Too many 'anim' walls (max 512.)"); I_Error("Too many 'anim' walls (max 512.)");
animwall[numanimwalls].tag = 0; animwall[numanimwalls].tag = 0;
animwall[numanimwalls].wallnum = 0; animwall[numanimwalls].wallnum = 0;
switch (wal->overpicnum) switch (wal->overpicnum)
{ {
case FANSHADOW: case FANSHADOW:
case FANSPRITE: case FANSPRITE:
wall->cstat |= 65; wall->cstat |= 65;
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
numanimwalls++; numanimwalls++;
break; break;
case W_FORCEFIELD: case W_FORCEFIELD:
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
tloadtile(W_FORCEFIELD + j); tloadtile(W_FORCEFIELD + j);
case W_FORCEFIELD + 1: case W_FORCEFIELD + 1:
case W_FORCEFIELD + 2: case W_FORCEFIELD + 2:
if (wal->shade > 31) if (wal->shade > 31)
wal->cstat = 0; wal->cstat = 0;
else wal->cstat |= 85 + 256; else wal->cstat |= 85 + 256;
if (wal->lotag && wal->nextwall >= 0) if (wal->lotag && wal->nextwall >= 0)
wall[wal->nextwall].lotag = wal->lotag; wall[wal->nextwall].lotag = wal->lotag;
case BIGFORCE: case BIGFORCE:
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
numanimwalls++; numanimwalls++;
continue; continue;
} }
wal->extra = -1; wal->extra = -1;
switch (wal->picnum) switch (wal->picnum)
{ {
case W_TECHWALL1: case W_TECHWALL1:
case W_TECHWALL2: case W_TECHWALL2:
case W_TECHWALL3: case W_TECHWALL3:
case W_TECHWALL4: case W_TECHWALL4:
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
// animwall[numanimwalls].tag = -1; // animwall[numanimwalls].tag = -1;
numanimwalls++; numanimwalls++;
break; break;
case SCREENBREAK6: case SCREENBREAK6:
case SCREENBREAK7: case SCREENBREAK7:
case SCREENBREAK8: case SCREENBREAK8:
for (j = SCREENBREAK6; j < SCREENBREAK9; j++) for (j = SCREENBREAK6; j < SCREENBREAK9; j++)
tloadtile(j); tloadtile(j);
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
animwall[numanimwalls].tag = -1; animwall[numanimwalls].tag = -1;
numanimwalls++; numanimwalls++;
break; break;
case FEMPIC1: case FEMPIC1:
case FEMPIC2: case FEMPIC2:
case FEMPIC3: case FEMPIC3:
wal->extra = wal->picnum; wal->extra = wal->picnum;
animwall[numanimwalls].tag = -1; animwall[numanimwalls].tag = -1;
if (ud.lockout) if (ud.lockout)
{ {
if (wal->picnum == FEMPIC1) if (wal->picnum == FEMPIC1)
wal->picnum = BLANKSCREEN; wal->picnum = BLANKSCREEN;
else wal->picnum = SCREENBREAK6; else wal->picnum = SCREENBREAK6;
} }
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
animwall[numanimwalls].tag = wal->picnum; animwall[numanimwalls].tag = wal->picnum;
numanimwalls++; numanimwalls++;
break; break;
case SCREENBREAK1: case SCREENBREAK1:
case SCREENBREAK2: case SCREENBREAK2:
case SCREENBREAK3: case SCREENBREAK3:
case SCREENBREAK4: case SCREENBREAK4:
case SCREENBREAK5: case SCREENBREAK5:
case SCREENBREAK9: case SCREENBREAK9:
case SCREENBREAK10: case SCREENBREAK10:
case SCREENBREAK11: case SCREENBREAK11:
case SCREENBREAK12: case SCREENBREAK12:
case SCREENBREAK13: case SCREENBREAK13:
case SCREENBREAK14: case SCREENBREAK14:
case SCREENBREAK15: case SCREENBREAK15:
case SCREENBREAK16: case SCREENBREAK16:
case SCREENBREAK17: case SCREENBREAK17:
case SCREENBREAK18: case SCREENBREAK18:
case SCREENBREAK19: case SCREENBREAK19:
animwall[numanimwalls].wallnum = i; animwall[numanimwalls].wallnum = i;
animwall[numanimwalls].tag = wal->picnum; animwall[numanimwalls].tag = wal->picnum;
numanimwalls++; numanimwalls++;
break; break;
} }
} }
//Invalidate textures in sector behind mirror //Invalidate textures in sector behind mirror
for (i = 0; i < mirrorcnt; i++) for (i = 0; i < mirrorcnt; i++)
{ {
startwall = sector[mirrorsector[i]].wallptr; startwall = sector[mirrorsector[i]].wallptr;
endwall = startwall + sector[mirrorsector[i]].wallnum; endwall = startwall + sector[mirrorsector[i]].wallnum;
for (j = startwall; j < endwall; j++) for (j = startwall; j < endwall; j++)
{ {
wall[j].picnum = MIRROR; wall[j].picnum = MIRROR;
wall[j].overpicnum = MIRROR; wall[j].overpicnum = MIRROR;
} }
} }
} }
END_DUKE_NS END_DUKE_NS

File diff suppressed because it is too large Load diff

View file

@ -35,484 +35,484 @@ BEGIN_DUKE_NS
static void recreateinterpolations() static void recreateinterpolations()
{ {
numinterpolations = 0; numinterpolations = 0;
int k = headspritestat[STAT_EFFECTOR]; int k = headspritestat[STAT_EFFECTOR];
while (k >= 0) while (k >= 0)
{ {
switch (sprite[k].lotag) switch (sprite[k].lotag)
{ {
case SE_31_FLOOR_RISE_FALL: case SE_31_FLOOR_RISE_FALL:
setinterpolation(&sector[sprite[k].sectnum].floorz); setinterpolation(&sector[sprite[k].sectnum].floorz);
break; break;
case SE_32_CEILING_RISE_FALL: case SE_32_CEILING_RISE_FALL:
setinterpolation(&sector[sprite[k].sectnum].ceilingz); setinterpolation(&sector[sprite[k].sectnum].ceilingz);
break; break;
case SE_17_WARP_ELEVATOR: case SE_17_WARP_ELEVATOR:
case SE_25_PISTON: case SE_25_PISTON:
setinterpolation(&sector[sprite[k].sectnum].floorz); setinterpolation(&sector[sprite[k].sectnum].floorz);
setinterpolation(&sector[sprite[k].sectnum].ceilingz); setinterpolation(&sector[sprite[k].sectnum].ceilingz);
break; break;
case SE_0_ROTATING_SECTOR: case SE_0_ROTATING_SECTOR:
case SE_5_BOSS: case SE_5_BOSS:
case SE_6_SUBWAY: case SE_6_SUBWAY:
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
case SE_14_SUBWAY_CAR: case SE_14_SUBWAY_CAR:
case SE_15_SLIDING_DOOR: case SE_15_SLIDING_DOOR:
case SE_16_REACTOR: case SE_16_REACTOR:
case SE_26: case SE_26:
case SE_30_TWO_WAY_TRAIN: case SE_30_TWO_WAY_TRAIN:
setsectinterpolate(k); setsectinterpolate(k);
break; break;
} }
k = nextspritestat[k]; k = nextspritestat[k];
} }
for (int i = numinterpolations - 1; i >= 0; i--) bakipos[i] = *curipos[i]; for (int i = numinterpolations - 1; i >= 0; i--) bakipos[i] = *curipos[i];
for (int i = animatecnt - 1; i >= 0; i--) for (int i = animatecnt - 1; i >= 0; i--)
setinterpolation(animateptr(i)); setinterpolation(animateptr(i));
} }
FSerializer& Serialize(FSerializer& arc, const char* keyname, animwalltype& w, animwalltype* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, animwalltype& w, animwalltype* def)
{ {
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("wallnum", w.wallnum) arc("wallnum", w.wallnum)
("tag", w.tag) ("tag", w.tag)
.EndObject(); .EndObject();
} }
return arc; return arc;
} }
FSerializer& Serialize(FSerializer& arc, const char* keyname, player_orig& w, player_orig* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, player_orig& w, player_orig* def)
{ {
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("ox", w.ox) arc("ox", w.ox)
("oy", w.oy) ("oy", w.oy)
("oz", w.oz) ("oz", w.oz)
("oa", w.oa) ("oa", w.oa)
("os", w.os) ("os", w.os)
.EndObject(); .EndObject();
} }
return arc; return arc;
} }
FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, player_struct* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, player_struct* def)
{ {
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("posx", w.posx) arc("posx", w.posx)
("posy", w.posy) ("posy", w.posy)
("posz", w.posz) ("posz", w.posz)
("q16ang", w.q16ang) ("q16ang", w.q16ang)
("q16horiz", w.q16horiz) ("q16horiz", w.q16horiz)
("q16horizoff", w.q16horizoff) ("q16horizoff", w.q16horizoff)
("q16rotscrnang", w.q16rotscrnang) ("q16rotscrnang", w.q16rotscrnang)
("q16look_ang", w.q16look_ang) ("q16look_ang", w.q16look_ang)
("one_eighty_count", w.one_eighty_count) ("one_eighty_count", w.one_eighty_count)
("gotweapon", w.gotweapon) ("gotweapon", w.gotweapon)
("palette", w.palette) ("palette", w.palette)
("pals", w.pals) ("pals", w.pals)
("fricx", w.fric.x) ("fricx", w.fric.x)
("fricy", w.fric.y) ("fricy", w.fric.y)
("zoom", w.zoom) ("zoom", w.zoom)
("exitx", w.exitx) ("exitx", w.exitx)
("exity", w.exity) ("exity", w.exity)
("numloogs", w.numloogs) ("numloogs", w.numloogs)
("loogcnt", w.loogcnt) ("loogcnt", w.loogcnt)
.Array("loogiex", w.loogiex, w.numloogs) .Array("loogiex", w.loogiex, w.numloogs)
.Array("loogiey", w.loogiey, w.numloogs) .Array("loogiey", w.loogiey, w.numloogs)
("bobposx", w.bobposx) ("bobposx", w.bobposx)
("bobposy", w.bobposy) ("bobposy", w.bobposy)
("pyoff", w.pyoff) ("pyoff", w.pyoff)
("posxv", w.posxv) ("posxv", w.posxv)
("posyv", w.posyv) ("posyv", w.posyv)
("poszv", w.poszv) ("poszv", w.poszv)
("last_pissed_time", w.last_pissed_time) ("last_pissed_time", w.last_pissed_time)
("truefz", w.truefz) ("truefz", w.truefz)
("truecz", w.truecz) ("truecz", w.truecz)
("player_par", w.player_par) ("player_par", w.player_par)
("visibility", w.visibility) ("visibility", w.visibility)
("bobcounter", w.bobcounter) ("bobcounter", w.bobcounter)
("weapon_sway", w.weapon_sway) ("weapon_sway", w.weapon_sway)
("pals_time", w.pals_time) ("pals_time", w.pals_time)
("randomflamex", w.randomflamex) ("randomflamex", w.randomflamex)
("crack_time", w.crack_time) ("crack_time", w.crack_time)
("aim.mode", w.aim_mode) ("aim.mode", w.aim_mode)
("auto_aim", w.auto_aim) ("auto_aim", w.auto_aim)
("weaponswitch", w.weaponswitch) ("weaponswitch", w.weaponswitch)
("angvel", w.angvel) ("angvel", w.angvel)
("cursectnum", w.cursectnum) ("cursectnum", w.cursectnum)
("last_extra", w.last_extra) ("last_extra", w.last_extra)
("subweapon", w.subweapon) ("subweapon", w.subweapon)
.Array("ammo_count", w.ammo_amount, MAX_WEAPONS) .Array("ammo_count", w.ammo_amount, MAX_WEAPONS)
("wackedbyactor", w.wackedbyactor) ("wackedbyactor", w.wackedbyactor)
("frag", w.frag) ("frag", w.frag)
("fraggedself", w.fraggedself) ("fraggedself", w.fraggedself)
("curr_weapon", w.curr_weapon) ("curr_weapon", w.curr_weapon)
("last_weapon", w.last_weapon) ("last_weapon", w.last_weapon)
("tipincs", w.tipincs) ("tipincs", w.tipincs)
("wantweaponfire", w.wantweaponfire) ("wantweaponfire", w.wantweaponfire)
("holoduke_amount", w.holoduke_amount) ("holoduke_amount", w.holoduke_amount)
("newowner", w.newowner) ("newowner", w.newowner)
("hurt_delay", w.hurt_delay) ("hurt_delay", w.hurt_delay)
("hbomb_hold_delay", w.hbomb_hold_delay) ("hbomb_hold_delay", w.hbomb_hold_delay)
("jumping_counter", w.jumping_counter) ("jumping_counter", w.jumping_counter)
("airleft", w.airleft) ("airleft", w.airleft)
("knee_incs", w.knee_incs) ("knee_incs", w.knee_incs)
("access_incs", w.access_incs) ("access_incs", w.access_incs)
("ftq", w.ftq) ("ftq", w.ftq)
("access_wallnum", w.access_wallnum) ("access_wallnum", w.access_wallnum)
("access_spritenum", w.access_spritenum) ("access_spritenum", w.access_spritenum)
("kickback_pic", w.kickback_pic) ("kickback_pic", w.kickback_pic)
("got_access", w.got_access) ("got_access", w.got_access)
("weapon_ang", w.weapon_ang) ("weapon_ang", w.weapon_ang)
("firstaid_amount", w.firstaid_amount) ("firstaid_amount", w.firstaid_amount)
("somethingonplayer", w.somethingonplayer) ("somethingonplayer", w.somethingonplayer)
("on_crane", w.on_crane) ("on_crane", w.on_crane)
("i", w.i) ("i", w.i)
("one_parallax_sectnum", w.one_parallax_sectnum) ("one_parallax_sectnum", w.one_parallax_sectnum)
("over_shoulder_on", w.over_shoulder_on) ("over_shoulder_on", w.over_shoulder_on)
("random_club_frame", w.random_club_frame) ("random_club_frame", w.random_club_frame)
("fist_incs", w.fist_incs) ("fist_incs", w.fist_incs)
("dummyplayersprite", w.dummyplayersprite) ("dummyplayersprite", w.dummyplayersprite)
("extra_extra8", w.extra_extra8) ("extra_extra8", w.extra_extra8)
("quick_kick", w.quick_kick) ("quick_kick", w.quick_kick)
("heat_amount", w.heat_amount) ("heat_amount", w.heat_amount)
("actorsqu", w.actorsqu) ("actorsqu", w.actorsqu)
("timebeforeexit", w.timebeforeexit) ("timebeforeexit", w.timebeforeexit)
("customexitsound", w.customexitsound) ("customexitsound", w.customexitsound)
("weapreccnt", w.weapreccnt) ("weapreccnt", w.weapreccnt)
.Array("weaprecs", w.weaprecs, w.weapreccnt) .Array("weaprecs", w.weaprecs, w.weapreccnt)
("interface_toggle_flag", w.interface_toggle_flag) ("interface_toggle_flag", w.interface_toggle_flag)
("dead_flag", w.dead_flag) ("dead_flag", w.dead_flag)
("show_empty_weapon", w.show_empty_weapon) ("show_empty_weapon", w.show_empty_weapon)
("scuba_amount", w.scuba_amount) ("scuba_amount", w.scuba_amount)
("jetpack_amount", w.jetpack_amount) ("jetpack_amount", w.jetpack_amount)
("steroids_amount", w.steroids_amount) ("steroids_amount", w.steroids_amount)
("shield_amount", w.shield_amount) ("shield_amount", w.shield_amount)
("holoduke_on", w.holoduke_on) ("holoduke_on", w.holoduke_on)
("pycount", w.pycount) ("pycount", w.pycount)
("weapon_pos", w.weapon_pos) ("weapon_pos", w.weapon_pos)
("frag_ps", w.frag_ps) ("frag_ps", w.frag_ps)
("transporter_hold", w.transporter_hold) ("transporter_hold", w.transporter_hold)
("last_full_weapon", w.last_full_weapon) ("last_full_weapon", w.last_full_weapon)
("footprintshade", w.footprintshade) ("footprintshade", w.footprintshade)
("boot_amount", w.boot_amount) ("boot_amount", w.boot_amount)
("scream_voice", w.scream_voice) ("scream_voice", w.scream_voice)
("gm", w.gm) ("gm", w.gm)
("on_warping_sector", w.on_warping_sector) ("on_warping_sector", w.on_warping_sector)
("footprintcount", w.footprintcount) ("footprintcount", w.footprintcount)
("hbomb_on", w.hbomb_on) ("hbomb_on", w.hbomb_on)
("jumping_toggle", w.jumping_toggle) ("jumping_toggle", w.jumping_toggle)
("rapid_fire_hold", w.rapid_fire_hold) ("rapid_fire_hold", w.rapid_fire_hold)
("on_ground", w.on_ground) ("on_ground", w.on_ground)
.Array("name", w.name, 32) .Array("name", w.name, 32)
("inven_icon", w.inven_icon) ("inven_icon", w.inven_icon)
("buttonpalette", w.buttonpalette) ("buttonpalette", w.buttonpalette)
("jetpack_on", w.jetpack_on) ("jetpack_on", w.jetpack_on)
("spritebridge", w.spritebridge) ("spritebridge", w.spritebridge)
("lastrandomspot", w.lastrandomspot) ("lastrandomspot", w.lastrandomspot)
("scuba_on", w.scuba_on) ("scuba_on", w.scuba_on)
("footprintpal", w.footprintpal) ("footprintpal", w.footprintpal)
("heat_on", w.heat_on) ("heat_on", w.heat_on)
("holster_weapon", w.holster_weapon) ("holster_weapon", w.holster_weapon)
("falling_counter", w.falling_counter) ("falling_counter", w.falling_counter)
("refresh_inventory", w.refresh_inventory) ("refresh_inventory", w.refresh_inventory)
("toggle_key_flag", w.toggle_key_flag) ("toggle_key_flag", w.toggle_key_flag)
("knuckle_incs", w.knuckle_incs) ("knuckle_incs", w.knuckle_incs)
("walking_snd_toggle", w.walking_snd_toggle) ("walking_snd_toggle", w.walking_snd_toggle)
("palookup", w.palookup) ("palookup", w.palookup)
("hard_landing", w.hard_landing) ("hard_landing", w.hard_landing)
("return_to_center", w.return_to_center) ("return_to_center", w.return_to_center)
("max_secret_rooms", w.max_secret_rooms) ("max_secret_rooms", w.max_secret_rooms)
("secret_rooms", w.secret_rooms) ("secret_rooms", w.secret_rooms)
("max_actors_killed", w.max_actors_killed) ("max_actors_killed", w.max_actors_killed)
("actors_killed", w.actors_killed) ("actors_killed", w.actors_killed)
// RR from here on // RR from here on
("stairs", w.stairs) ("stairs", w.stairs)
("detonate_count", w.detonate_count) ("detonate_count", w.detonate_count)
("noise_x", w.noise_x) ("noise_x", w.noise_x)
("noise_y", w.noise_y) ("noise_y", w.noise_y)
("noise_radius", w.noise_radius) ("noise_radius", w.noise_radius)
("drink_timer", w.drink_timer) ("drink_timer", w.drink_timer)
("eat_timer", w.eat_timer) ("eat_timer", w.eat_timer)
("slotwin", w.SlotWin) ("slotwin", w.SlotWin)
("recoil", w.recoil) ("recoil", w.recoil)
("detonate_time", w.detonate_time) ("detonate_time", w.detonate_time)
("yehaa_timer", w.yehaa_timer) ("yehaa_timer", w.yehaa_timer)
("drink_amt", w.drink_amt) ("drink_amt", w.drink_amt)
("eat", w.eat) ("eat", w.eat)
("drunkang", w.drunkang) ("drunkang", w.drunkang)
("eatang", w.eatang) ("eatang", w.eatang)
.Array("shotgun_state", w.shotgun_state, 2) .Array("shotgun_state", w.shotgun_state, 2)
("donoise", w.donoise) ("donoise", w.donoise)
.Array("keys", w.keys, 5) .Array("keys", w.keys, 5)
// RRRA from here on // RRRA from here on
("drug_aspect", w.drug_aspect) ("drug_aspect", w.drug_aspect)
("drug_timer", w.drug_timer) ("drug_timer", w.drug_timer)
("seasick", w.SeaSick) ("seasick", w.SeaSick)
("mamaend", w.MamaEnd) ("mamaend", w.MamaEnd)
("motospeed", w.MotoSpeed) ("motospeed", w.MotoSpeed)
("moto_drink", w.moto_drink) ("moto_drink", w.moto_drink)
("tiltstatus", w.TiltStatus) ("tiltstatus", w.TiltStatus)
("vbumpnow", w.VBumpNow) ("vbumpnow", w.VBumpNow)
("vbumptarget", w.VBumpTarget) ("vbumptarget", w.VBumpTarget)
("turbcount", w.TurbCount) ("turbcount", w.TurbCount)
.Array("drug_stat", w.drug_stat, 3) .Array("drug_stat", w.drug_stat, 3)
("drugmode", w.DrugMode) ("drugmode", w.DrugMode)
("lotag800kill", w.lotag800kill) ("lotag800kill", w.lotag800kill)
("sea_sick_stat", w.sea_sick_stat) ("sea_sick_stat", w.sea_sick_stat)
("hurt_delay2", w.hurt_delay2) ("hurt_delay2", w.hurt_delay2)
("nocheat", w.nocheat) ("nocheat", w.nocheat)
("onmotorcycle", w.OnMotorcycle) ("onmotorcycle", w.OnMotorcycle)
("onboat", w.OnBoat) ("onboat", w.OnBoat)
("moto_underwater", w.moto_underwater) ("moto_underwater", w.moto_underwater)
("notonwater", w.NotOnWater) ("notonwater", w.NotOnWater)
("motoonground", w.MotoOnGround) ("motoonground", w.MotoOnGround)
("moto_do_bump", w.moto_do_bump) ("moto_do_bump", w.moto_do_bump)
("moto_bump_fast", w.moto_bump_fast) ("moto_bump_fast", w.moto_bump_fast)
("moto_on_oil", w.moto_on_oil) ("moto_on_oil", w.moto_on_oil)
("moto_on_mud", w.moto_on_mud) ("moto_on_mud", w.moto_on_mud)
// new stuff // new stuff
("crouch_toggle", w.crouch_toggle) ("crouch_toggle", w.crouch_toggle)
.EndObject(); .EndObject();
w.invdisptime = 0; w.invdisptime = 0;
w.oq16ang = w.q16ang; w.oq16ang = w.q16ang;
w.oq16horiz = w.q16horiz; w.oq16horiz = w.q16horiz;
w.oq16horizoff = w.q16horizoff; w.oq16horizoff = w.q16horizoff;
w.oq16rotscrnang = w.q16rotscrnang; w.oq16rotscrnang = w.q16rotscrnang;
w.oposx = w.posx; w.oposx = w.posx;
w.oposy = w.posy; w.oposy = w.posy;
w.oposz = w.posz; w.oposz = w.posz;
w.opyoff = w.pyoff; w.opyoff = w.pyoff;
w.horizAngleAdjust = 0; w.horizAngleAdjust = 0;
w.horizSkew = 0; w.horizSkew = 0;
w.lookLeft = false; w.lookLeft = false;
w.lookRight = false; w.lookRight = false;
} }
return arc; return arc;
} }
FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weaponhit* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weaponhit* def)
{ {
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("cgg", w.cgg) arc("cgg", w.cgg)
("picnum", w.picnum) ("picnum", w.picnum)
("ang", w.ang) ("ang", w.ang)
("extra", w.extra) ("extra", w.extra)
("owner", w.owner) ("owner", w.owner)
("movflag", w.movflag) ("movflag", w.movflag)
("tempang", w.tempang) ("tempang", w.tempang)
("actorstayput", w.actorstayput) ("actorstayput", w.actorstayput)
("dispicnum", w.dispicnum) ("dispicnum", w.dispicnum)
("timetosleep", w.timetosleep) ("timetosleep", w.timetosleep)
("floorz", w.floorz) ("floorz", w.floorz)
("ceilingz", w.ceilingz) ("ceilingz", w.ceilingz)
("lastvx", w.lastvx) ("lastvx", w.lastvx)
("lastvy", w.lastvy) ("lastvy", w.lastvy)
("bposx", w.bposx) ("bposx", w.bposx)
("bposy", w.bposy) ("bposy", w.bposy)
("bposz", w.bposz) ("bposz", w.bposz)
("aflags", w.aflags) ("aflags", w.aflags)
.Array("temp_data", w.temp_data, 6) .Array("temp_data", w.temp_data, 6)
.EndObject(); .EndObject();
} }
return arc; return arc;
} }
void SerializeGlobals(FSerializer& arc) void SerializeGlobals(FSerializer& arc)
{ {
if (arc.isReading()) if (arc.isReading())
{ {
memset(sectorextra, 0, sizeof(sectorextra)); memset(sectorextra, 0, sizeof(sectorextra));
memset(spriteextra, 0, sizeof(spriteextra)); memset(spriteextra, 0, sizeof(spriteextra));
memset(shadedsector, 0, sizeof(shadedsector)); memset(shadedsector, 0, sizeof(shadedsector));
memset(geosectorwarp, -1, sizeof(geosectorwarp)); memset(geosectorwarp, -1, sizeof(geosectorwarp));
memset(geosectorwarp2, -1, sizeof(geosectorwarp2)); memset(geosectorwarp2, -1, sizeof(geosectorwarp2));
memset(ambienthitag, -1, sizeof(ambienthitag)); memset(ambienthitag, -1, sizeof(ambienthitag));
memset(ambientlotag, -1, sizeof(ambientlotag)); memset(ambientlotag, -1, sizeof(ambientlotag));
} }
if (arc.BeginObject("globals")) if (arc.BeginObject("globals"))
{ {
arc("multimode", ud.multimode); arc("multimode", ud.multimode);
if (ud.multimode > 1) arc.Array("frags", &frags[0][0], MAXPLAYERS * MAXPLAYERS); if (ud.multimode > 1) arc.Array("frags", &frags[0][0], MAXPLAYERS * MAXPLAYERS);
arc("skill", ud.player_skill) arc("skill", ud.player_skill)
("from_bonus", ud.from_bonus) ("from_bonus", ud.from_bonus)
("secretlevel", ud.secretlevel) ("secretlevel", ud.secretlevel)
("respawn_monsters", ud.respawn_monsters) ("respawn_monsters", ud.respawn_monsters)
("respawn_items", ud.respawn_items) ("respawn_items", ud.respawn_items)
("respawn_inventory", ud.respawn_inventory) ("respawn_inventory", ud.respawn_inventory)
("god", ud.god) ("god", ud.god)
//("auto_run", ud.auto_run) //("auto_run", ud.auto_run)
("monsters_off", ud.monsters_off) ("monsters_off", ud.monsters_off)
("last_level", ud.last_level) ("last_level", ud.last_level)
("eog", ud.eog) ("eog", ud.eog)
("coop", ud.coop) ("coop", ud.coop)
("marker", ud.marker) ("marker", ud.marker)
("ffire", ud.ffire) ("ffire", ud.ffire)
.Array("spriteextra", spriteextra, MAXSPRITES) .Array("spriteextra", spriteextra, MAXSPRITES)
.Array("weaponhit", hittype, MAXSPRITES) .Array("weaponhit", hittype, MAXSPRITES)
.Array("sectorextra", sectorextra, numsectors) .Array("sectorextra", sectorextra, numsectors)
("rtsplaying", rtsplaying) ("rtsplaying", rtsplaying)
("tempwallptr", tempwallptr) ("tempwallptr", tempwallptr)
("sound445done", sound445done) ("sound445done", sound445done)
("leveltexttime", levelTextTime) ("leveltexttime", levelTextTime)
.Array("players", ps, ud.multimode) .Array("players", ps, ud.multimode)
("spriteqamount", spriteqamount) ("spriteqamount", spriteqamount)
.Array("shadedsector", shadedsector, numsectors) .Array("shadedsector", shadedsector, numsectors)
("lastvisinc", lastvisinc) ("lastvisinc", lastvisinc)
("numanimwalls", numanimwalls) ("numanimwalls", numanimwalls)
.Array("animwall", animwall, numanimwalls) .Array("animwall", animwall, numanimwalls)
("camsprite", camsprite) ("camsprite", camsprite)
("earthquaketime", earthquaketime) ("earthquaketime", earthquaketime)
("freezerhurtowner", freezerhurtowner) ("freezerhurtowner", freezerhurtowner)
("global_random", global_random) ("global_random", global_random)
("impact_damage", impact_damage) ("impact_damage", impact_damage)
("numplayersprites", numplayersprites) ("numplayersprites", numplayersprites)
("spriteqloc", spriteqloc) ("spriteqloc", spriteqloc)
("animatecnt", animatecnt) ("animatecnt", animatecnt)
.Array("animatesect", animatesect, animatecnt) .Array("animatesect", animatesect, animatecnt)
.Array("animatetype", animatetype, animatecnt) .Array("animatetype", animatetype, animatecnt)
.Array("animatetarget", animatetarget, animatecnt) .Array("animatetarget", animatetarget, animatecnt)
.Array("animategoal", animategoal, animatecnt) .Array("animategoal", animategoal, animatecnt)
.Array("animatevel", animatevel, animatecnt) .Array("animatevel", animatevel, animatecnt)
("numclouds", numclouds) ("numclouds", numclouds)
("cloudx", cloudx) ("cloudx", cloudx)
("cloudy", cloudy) ("cloudy", cloudy)
("cloudtotalclock", cloudtotalclock) ("cloudtotalclock", cloudtotalclock)
.Array("clouds", clouds, numclouds) .Array("clouds", clouds, numclouds)
.Array("spriteq", spriteq, 1024) .Array("spriteq", spriteq, 1024)
("numcyclers", numcyclers) ("numcyclers", numcyclers)
.Array("cyclers", &cyclers[0][0], 6 * numcyclers) .Array("cyclers", &cyclers[0][0], 6 * numcyclers)
("mirrorcnt", mirrorcnt) ("mirrorcnt", mirrorcnt)
.Array("mirrorsector", mirrorsector, mirrorcnt) .Array("mirrorsector", mirrorsector, mirrorcnt)
.Array("mirrorwall", mirrorwall, mirrorcnt) .Array("mirrorwall", mirrorwall, mirrorcnt)
("lockclock", lockclock) ("lockclock", lockclock)
("wupass", wupass) ("wupass", wupass)
("chickenplant", chickenplant) ("chickenplant", chickenplant)
("thunderon", thunderon) ("thunderon", thunderon)
("ufospawn", ufospawn) ("ufospawn", ufospawn)
("ufocnt", ufocnt) ("ufocnt", ufocnt)
("hulkspawn", hulkspawn) ("hulkspawn", hulkspawn)
("lastlevel", lastlevel) ("lastlevel", lastlevel)
("geocnt", geocnt) ("geocnt", geocnt)
.Array("geosectorwarp", geosectorwarp, geocnt) .Array("geosectorwarp", geosectorwarp, geocnt)
.Array("geosectorwarp2", geosectorwarp2, geocnt) .Array("geosectorwarp2", geosectorwarp2, geocnt)
.Array("geosector", geosector, geocnt) .Array("geosector", geosector, geocnt)
.Array("geox", geox, geocnt) .Array("geox", geox, geocnt)
.Array("geoy", geoy, geocnt) .Array("geoy", geoy, geocnt)
.Array("geox2", geox2, geocnt) .Array("geox2", geox2, geocnt)
.Array("geoy2", geoy2, geocnt) .Array("geoy2", geoy2, geocnt)
("ambientfx", ambientfx) ("ambientfx", ambientfx)
.Array("ambientlotag", ambientlotag, ambientfx) .Array("ambientlotag", ambientlotag, ambientfx)
.Array("ambienthitag", ambienthitag, ambientfx) .Array("ambienthitag", ambienthitag, ambientfx)
.Array("msx", msx, MAXANIMPOINTS) .Array("msx", msx, MAXANIMPOINTS)
.Array("msy", msy, MAXANIMPOINTS) .Array("msy", msy, MAXANIMPOINTS)
("windtime", WindTime) ("windtime", WindTime)
("winddir", WindDir) ("winddir", WindDir)
("fakebubba_spawn", fakebubba_spawn) ("fakebubba_spawn", fakebubba_spawn)
("mamaspawn_count", mamaspawn_count) ("mamaspawn_count", mamaspawn_count)
("banjosound", banjosound) ("banjosound", banjosound)
("belltime", BellTime) ("belltime", BellTime)
("bellsprite", BellSprite) ("bellsprite", BellSprite)
("enemysizecheat", enemysizecheat) ("enemysizecheat", enemysizecheat)
("ufospawnsminion", ufospawnsminion) ("ufospawnsminion", ufospawnsminion)
("pistonsound", pistonsound) ("pistonsound", pistonsound)
("chickenphase", chickenphase) ("chickenphase", chickenphase)
("RRRA_ExitedLevel", RRRA_ExitedLevel) ("RRRA_ExitedLevel", RRRA_ExitedLevel)
("fogactive", fogactive) ("fogactive", fogactive)
("thunder_brightness", thunder_brightness) ("thunder_brightness", thunder_brightness)
// Todo: move to backend // Todo: move to backend
("totalclock", totalclock) ("totalclock", totalclock)
("ototalclock", ototalclock) ("ototalclock", ototalclock)
("totalclocklock", totalclocklock) ("totalclocklock", totalclocklock)
("lockclock", lockclock) ("lockclock", lockclock)
.Array("po", po, ud.multimode) .Array("po", po, ud.multimode)
.EndObject(); .EndObject();
if (arc.isReading()) if (arc.isReading())
{ {
screenpeek = myconnectindex; screenpeek = myconnectindex;
ps[myconnectindex].gm = MODE_GAME; ps[myconnectindex].gm = MODE_GAME;
ud.recstat = 0; ud.recstat = 0;
ud.m_player_skill = ud.player_skill; ud.m_player_skill = ud.player_skill;
ud.m_respawn_monsters = ud.respawn_monsters; ud.m_respawn_monsters = ud.respawn_monsters;
ud.m_respawn_items = ud.respawn_items; ud.m_respawn_items = ud.respawn_items;
ud.m_respawn_inventory = ud.respawn_inventory; ud.m_respawn_inventory = ud.respawn_inventory;
ud.m_monsters_off = ud.monsters_off; ud.m_monsters_off = ud.monsters_off;
ud.m_coop = ud.coop; ud.m_coop = ud.coop;
ud.m_marker = ud.marker; ud.m_marker = ud.marker;
ud.m_ffire = ud.ffire; ud.m_ffire = ud.ffire;
if (ps[myconnectindex].over_shoulder_on != 0) if (ps[myconnectindex].over_shoulder_on != 0)
{ {
cameradist = 0; cameradist = 0;
cameraclock = 0; cameraclock = 0;
ps[myconnectindex].over_shoulder_on = 1; ps[myconnectindex].over_shoulder_on = 1;
} }
setpal(&ps[myconnectindex]); setpal(&ps[myconnectindex]);
memset(gotpic, 0, sizeof(gotpic)); memset(gotpic, 0, sizeof(gotpic));
if (isRR()) cacheit_r(); else cacheit_d(); if (isRR()) cacheit_r(); else cacheit_d();
Mus_ResumeSaved(); Mus_ResumeSaved();
Mus_SetPaused(false); Mus_SetPaused(false);
FX_SetReverb(0); FX_SetReverb(0);
recreateinterpolations(); recreateinterpolations();
show_shareware = 0; show_shareware = 0;
everyothertime = 0; everyothertime = 0;
clearfifo(); clearfifo();
// should be unnecessary with the sounds getting serialized as well. // should be unnecessary with the sounds getting serialized as well.
#if 0 #if 0
if (ps[myconnectindex].jetpack_on) if (ps[myconnectindex].jetpack_on)
spritesound(DUKE_JETPACK_IDLE, ps[myconnectindex].i); spritesound(DUKE_JETPACK_IDLE, ps[myconnectindex].i);
// Update sound state in SFX sprites. // Update sound state in SFX sprites.
for (int i = headspritestat[STAT_FX]; i >= 0; i = nextspritestat[i]) for (int i = headspritestat[STAT_FX]; i >= 0; i = nextspritestat[i])
if (sprite[i].picnum == MUSICANDSFX) if (sprite[i].picnum == MUSICANDSFX)
{ {
hittype[i].temp_data[1] = SoundEnabled(); hittype[i].temp_data[1] = SoundEnabled();
hittype[i].temp_data[0] = 0; hittype[i].temp_data[0] = 0;
} }
#endif #endif
FX_SetReverb(0); FX_SetReverb(0);
} }
else else
{ {
ototalclock = totalclock; ototalclock = totalclock;
} }
ready2send = 1; ready2send = 1;
} }
} }
bool GameInterface::LoadGame(FSaveGameNode* sv) bool GameInterface::LoadGame(FSaveGameNode* sv)
{ {
return 0; return 0;
} }
bool GameInterface::SaveGame(FSaveGameNode* sv) bool GameInterface::SaveGame(FSaveGameNode* sv)
{ {
return 0; return 0;
} }

View file

@ -10,20 +10,20 @@ BEGIN_DUKE_NS
class DDukeCommonStatusBar : public DBaseStatusBar class DDukeCommonStatusBar : public DBaseStatusBar
{ {
protected: protected:
DHUDFont numberFont; DHUDFont numberFont;
DHUDFont indexFont; DHUDFont indexFont;
DHUDFont miniFont; DHUDFont miniFont;
DHUDFont digiFont; DHUDFont digiFont;
double scale = 1; double scale = 1;
std::array<int, MAX_WEAPONS> ammo_sprites; std::array<int, MAX_WEAPONS> ammo_sprites;
std::array<int, 8> item_icons; std::array<int, 8> item_icons;
DDukeCommonStatusBar(); DDukeCommonStatusBar();
std::pair<const char*, EColorRange> ontext(struct player_struct *p); std::pair<const char*, EColorRange> ontext(struct player_struct *p);
void DrawInventory(const struct player_struct* p, double x, double y, int align); void DrawInventory(const struct player_struct* p, double x, double y, int align);
PalEntry LightForShade(int shade); PalEntry LightForShade(int shade);
public: public:
void PrintLevelStats(int bottomy); void PrintLevelStats(int bottomy);
}; };

View file

@ -55,15 +55,15 @@ BEGIN_DUKE_NS
class DDukeStatusBar : public DDukeCommonStatusBar class DDukeStatusBar : public DDukeCommonStatusBar
{ {
public: public:
DDukeStatusBar() DDukeStatusBar()
{ {
// optionally draw at the top of the screen. // optionally draw at the top of the screen.
SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y); SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y);
scale = 1; 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 }; 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) void FullscreenHUD1(struct player_struct* p, int snum)
{ {
// //
// Health // Health
// //
DrawGraphic(tileGetTexture(COLA), 2, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); DrawGraphic(tileGetTexture(COLA), 2, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75);
FString format; FString format;
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) 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; int s = -8;
if (althud_flashing && p->last_extra > max_player_health) if (althud_flashing && p->last_extra > max_player_health)
s += (sintable[((int)totalclock << 5) & 2047] >> 10); s += (sintable[((int)totalclock << 5) & 2047] >> 10);
int intens = clamp(255 - 4 * s, 0, 255); int intens = clamp(255 - 4 * s, 0, 255);
auto pe = PalEntry(255, intens, intens, intens); auto pe = PalEntry(255, intens, intens, intens);
format.Format("%d", p->last_extra); 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); SBar_DrawString(this, &numberFont, format, 40, -BigFont->GetHeight() - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
} }
// //
// Armor // Armor
// //
DrawGraphic(tileGetTexture(SHIELD), 62, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75); DrawGraphic(tileGetTexture(SHIELD), 62, -2, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, 0.75, 0.75);
format.Format("%d", GetMoraleOrShield(p, snum)); 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); 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]; int wicon = ammo_sprites[p->curr_weapon];
if (wicon > 0) if (wicon > 0)
{ {
auto img = tileGetTexture(wicon); auto img = tileGetTexture(wicon);
auto scale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; auto scale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5;
DrawGraphic(img, -57, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(img, -57, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
} }
int weapon = p->curr_weapon; int weapon = p->curr_weapon;
if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_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))) 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]); 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); 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; unsigned icon = p->inven_icon;
if (icon > 0) if (icon > 0)
{ {
int x = 131; int x = 131;
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1); DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1);
int percentv = getinvamount(p); int percentv = getinvamount(p);
format.Format("%3d%%", percentv); format.Format("%3d%%", percentv);
EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; 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); 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); 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); 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 // 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 & 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 & 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)); 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) void FullscreenHUD2(struct player_struct *p)
{ {
// //
// health // health
// //
DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); 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; int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health); 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); SBar_DrawString(this, &digiFont, format, 19, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// ammo // ammo
// //
DrawGraphic(tileGetTexture(AMMOBOX), 37, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); 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; int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wp]); 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); SBar_DrawString(this, &digiFont, format, 53, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// inventory // inventory
// //
unsigned icon = p->inven_icon; unsigned icon = p->inven_icon;
if (icon > 0) if (icon > 0)
{ {
int x = 73; int x = 73;
DrawGraphic(tileGetTexture(INVENTORYBOX), 69, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(INVENTORYBOX), 69, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p); int percentv = getinvamount(p);
format.Format("%3d%%", percentv); format.Format("%3d%%", percentv);
EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; 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); 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); 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); 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) void DrawHud(int snum, int style)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
BeginHUD(320, 200, 1.f, false); BeginHUD(320, 200, 1.f, false);
if (style == 1) if (style == 1)
{ {
DrawInventory(p, 0, -46, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, 0, -46, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD1(p, snum); FullscreenHUD1(p, snum);
PrintLevelStats(tilesiz[BIGALPHANUM].y +10); PrintLevelStats(tilesiz[BIGALPHANUM].y +10);
} }
else if (style == 2) else if (style == 2)
{ {
DrawInventory(p, (ud.multimode > 1) ? 56 : 65, -28, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, (ud.multimode > 1) ? 56 : 65, -28, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD2(p); FullscreenHUD2(p);
PrintLevelStats(tilesiz[HEALTHBOX].y + 4); PrintLevelStats(tilesiz[HEALTHBOX].y + 4);
} }
else else
{ {
DrawInventory(p, 0, -28, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, 0, -28, DI_SCREEN_CENTER_BOTTOM);
PrintLevelStats(2); 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) void DrawWeaponNum(int index, int x, int y, int num1, int num2, int shade, int numdigits)
{ {
/* /*
if (VOLUMEONE && (ind > HANDBOMB_WEAPON || ind < 0)) if (VOLUMEONE && (ind > HANDBOMB_WEAPON || ind < 0))
{ {
minitextshade(x + 1, y - 4, "ORDER", 20, 11, 2 + 8 + 16 + ROTATESPRITE_MAX); minitextshade(x + 1, y - 4, "ORDER", 20, 11, 2 + 8 + 16 + ROTATESPRITE_MAX);
return; return;
} }
*/ */
FString format; FString format;
if (numdigits == 2) if (numdigits == 2)
{ {
if (num1 > 99) num1 = 99; if (num1 > 99) num1 = 99;
if (num2 > 99) num2 = 99; if (num2 > 99) num2 = 99;
format.Format("%2d/%d", num1, num2); format.Format("%2d/%d", num1, num2);
} }
else else
{ {
if (num1 > 999) num1 = 999; if (num1 > 999) num1 = 999;
if (num2 > 999) num2 = 999; if (num2 > 999) num2 = 999;
format.Format("%3d/%d", num1, num2); format.Format("%3d/%d", num1, num2);
} }
y--; 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)); 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); auto pe = LightForShade(shade);
DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, pe); 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++) for (size_t i = 0; i < format.Len(); i++)
{ {
if (format[i] != ' ') if (format[i] != ' ')
{ {
char c = format[i] == '/' ? 11 : format[i] - '0'; 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); 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) void DrawWeaponAmounts(const struct player_struct* p, int x, int y)
{ {
int cw = p->curr_weapon; int cw = p->curr_weapon;
auto ShadeForWeapon = [=](int weapon, int optweapon = -1) auto ShadeForWeapon = [=](int weapon, int optweapon = -1)
{ {
// Headache-inducing math at play here. // Headache-inducing math at play here.
return (((!p->ammo_amount[weapon]) | (!p->gotweapon[weapon])) * 9) + 12 - 18 * ((cw == weapon) || (optweapon != -1 && cw == optweapon)); 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(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(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(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(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); 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) 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); DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2);
else else
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2); 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(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(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(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) void Statusbar(int snum)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; int h = tilesiz[TILE_BOTTOMSTATUSBAR].y;
int top = 200 - h; int top = 200 - h;
BeginStatusBar(320, 200, h, true); BeginStatusBar(320, 200, h, true);
DrawInventory(p, 160, 154, 0); DrawInventory(p, 160, 154, 0);
DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); 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) if (ud.multimode > 1 && !ud.coop)
{ {
DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1);
format.Format("%d", max(p->frag - p->fraggedself, 0)); 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); SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
} }
else else
{ {
auto key = tileGetTexture(ACCESS_ICON); 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 & 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 & 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)); 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); DrawWeaponAmounts(p, 96, top + 16);
int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num); format.Format("%d", num);
SBar_DrawString(this, &digiFont, format, 32, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); 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)); 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); 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) if (p->curr_weapon != KNEE_WEAPON)
{ {
int wep = (p->curr_weapon == HANDREMOTE_WEAPON)? HANDBOMB_WEAPON : p->curr_weapon; int wep = (p->curr_weapon == HANDREMOTE_WEAPON)? HANDBOMB_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wep]); 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); SBar_DrawString(this, &digiFont, format, 208, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
} }
int icon = p->inven_icon; int icon = p->inven_icon;
if (icon) if (icon)
{ {
int x = 231; int x = 231;
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, 1, 1); DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, 1, 1);
int percentv = getinvamount(p); int percentv = getinvamount(p);
format.Format("%3d%%", percentv); format.Format("%3d%%", percentv);
EColorRange color = percentv > 50 ? CR_GREEN : percentv > 25 ? CR_GOLD : CR_RED; 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); SBar_DrawString(this, &indexFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1);
auto text = ontext(p); 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); 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); PrintLevelStats(-1);
} }
}; };
@ -414,15 +414,15 @@ void drawstatusbar_d(int snum)
else else
{ {
dsb.Statusbar(snum); dsb.Statusbar(snum);
} }
if (hud_showmapname && levelTextTime > 1 && !M_Active()) if (hud_showmapname && levelTextTime > 1 && !M_Active())
{ {
double alpha; double alpha;
if (levelTextTime > 16) alpha = 1.; if (levelTextTime > 16) alpha = 1.;
else alpha = (levelTextTime) / 16.; else alpha = (levelTextTime) / 16.;
PrintLevelName_d(alpha); PrintLevelName_d(alpha);
} }
} }

View file

@ -48,180 +48,180 @@ class DRedneckStatusBar : public DDukeCommonStatusBar
{ {
public: public:
DRedneckStatusBar() DRedneckStatusBar()
{ {
// optionally draw at the top of the screen. // optionally draw at the top of the screen.
SetSize(tilesiz[BOTTOMSTATUSBAR].y); SetSize(tilesiz[BOTTOMSTATUSBAR].y);
scale = 0.5; scale = 0.5;
ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, HBOMBAMMO, HBOMBAMMO, RRTILE43, DEVISTATORAMMO, TRIPBOMBSPRITE, GROWSPRITEICON, HBOMBAMMO, -1, BOWLINGBALLSPRITE, MOTOAMMO, BOATAMMO, -1, RPG2SPRITE }; 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 }; item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON };
} }
int getinvamount(const struct player_struct* p) int getinvamount(const struct player_struct* p)
{ {
switch (p->inven_icon) switch (p->inven_icon)
{ {
case ICON_FIRSTAID: case ICON_FIRSTAID:
return p->firstaid_amount; return p->firstaid_amount;
case ICON_STEROIDS: case ICON_STEROIDS:
return (p->steroids_amount + 3) >> 2; return (p->steroids_amount + 3) >> 2;
case ICON_HOLODUKE: case ICON_HOLODUKE:
return (p->holoduke_amount) / 400; return (p->holoduke_amount) / 400;
case ICON_JETPACK: case ICON_JETPACK:
return (p->jetpack_amount) / 100; return (p->jetpack_amount) / 100;
case ICON_HEATS: case ICON_HEATS:
return p->heat_amount / 12; return p->heat_amount / 12;
case ICON_SCUBA: case ICON_SCUBA:
return (p->scuba_amount + 63) >> 6; return (p->scuba_amount + 63) >> 6;
case ICON_BOOTS: case ICON_BOOTS:
return (p->boot_amount / 10) >> 1; return (p->boot_amount / 10) >> 1;
} }
return -1; return -1;
} }
//========================================================================== //==========================================================================
// //
// Fullscreen HUD variant #1 for RR // Fullscreen HUD variant #1 for RR
// //
//========================================================================== //==========================================================================
void FullscreenHUD1(struct player_struct* p, int snum) void FullscreenHUD1(struct player_struct* p, int snum)
{ {
// //
// Health // 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; FString format;
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) 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; int s = -8;
if (althud_flashing && p->last_extra > max_player_health) if (althud_flashing && p->last_extra > max_player_health)
s += (sintable[((int)totalclock << 5) & 2047] >> 10); s += (sintable[((int)totalclock << 5) & 2047] >> 10);
int intens = clamp(255 - 4 * s, 0, 255); int intens = clamp(255 - 4 * s, 0, 255);
auto pe = PalEntry(255, intens, intens, intens); auto pe = PalEntry(255, intens, intens, intens);
format.Format("%d", p->last_extra); 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); SBar_DrawString(this, &numberFont, format, 44, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
} }
// //
// drink // drink
// //
DrawGraphic(tileGetTexture(COLA), 70, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.); DrawGraphic(tileGetTexture(COLA), 70, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 10000. / 65536., 10000. / 65536.);
format.Format("%d", p->drink_amt); 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); SBar_DrawString(this, &numberFont, format, 98, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// eat // eat
// //
DrawGraphic(tileGetTexture(JETPACK), 122, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 20000. / 65536., 20000. / 65536.); DrawGraphic(tileGetTexture(JETPACK), 122, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, 20000. / 65536., 20000. / 65536.);
format.Format("%d", p->eat); 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); SBar_DrawString(this, &numberFont, format, 175, -BigFont->GetHeight() * scale - 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// selected weapon // selected weapon
// //
int wicon = ammo_sprites[p->curr_weapon]; int wicon = ammo_sprites[p->curr_weapon];
if (wicon > 0) if (wicon > 0)
{ {
auto img = tileGetTexture(wicon); auto img = tileGetTexture(wicon);
auto myscale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5; auto myscale = img && img->GetDisplayHeight() >= 50 ? 0.25 : 0.5;
DrawGraphic(img, -50, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, myscale, myscale); DrawGraphic(img, -50, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, myscale, myscale);
} }
int weapon = p->curr_weapon; int weapon = p->curr_weapon;
if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_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))) 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]); 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); 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; unsigned icon = p->inven_icon;
if (icon > 0) if (icon > 0)
{ {
int x = -122; int x = -122;
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(item_icons[icon]), x, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int percentv = getinvamount(p); int percentv = getinvamount(p);
if (icon <= 2) format.Format("%3d%%", percentv); if (icon <= 2) format.Format("%3d%%", percentv);
else 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); 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); 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 (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[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[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)); 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) void FullscreenHUD2(struct player_struct* p)
{ {
// //
// health // health
// //
DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); 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; int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health); 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); SBar_DrawString(this, &digiFont, format, 17, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// ammo // ammo
// //
DrawGraphic(tileGetTexture(AMMOBOX), 41, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); 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; int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wp]); 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); SBar_DrawString(this, &digiFont, format, 57, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// inventory // inventory
// //
unsigned icon = p->inven_icon; unsigned icon = p->inven_icon;
if (icon > 0) if (icon > 0)
{ {
int x = 81; int x = 81;
DrawGraphic(tileGetTexture(INVENTORYBOX), 77, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(INVENTORYBOX), 77, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(item_icons[icon]), x, -14, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p); int percentv = getinvamount(p);
if (icon <= 2) format.Format("%3d%%", percentv); if (icon <= 2) format.Format("%3d%%", percentv);
else 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); 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) void DrawHud(int snum, int style)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
BeginHUD(320, 200, 1.f, false); BeginHUD(320, 200, 1.f, false);
if (style == 1) if (style == 1)
{ {
double y = -40; double y = -40;
if (ud.multimode > 1) if (ud.multimode > 1)
y -= 4; y -= 4;
@ -229,161 +229,161 @@ public:
y -= 4; y -= 4;
DrawInventory(p, 0, y, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, 0, y, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD1(p, snum); FullscreenHUD1(p, snum);
PrintLevelStats(scale * tilesiz[BIGALPHANUM].y + 10); PrintLevelStats(scale * tilesiz[BIGALPHANUM].y + 10);
} }
else if (style == 2) else if (style == 2)
{ {
DrawInventory(p, 56, -20, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, 56, -20, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD2(p); FullscreenHUD2(p);
PrintLevelStats(scale * tilesiz[HEALTHBOX].y + 4); PrintLevelStats(scale * tilesiz[HEALTHBOX].y + 4);
} }
else else
{ {
DrawInventory(p, 0, -20, DI_SCREEN_CENTER_BOTTOM); DrawInventory(p, 0, -20, DI_SCREEN_CENTER_BOTTOM);
PrintLevelStats(2); PrintLevelStats(2);
} }
} }
//========================================================================== //==========================================================================
// //
// Status bar drawer (RR) // Status bar drawer (RR)
// //
//========================================================================== //==========================================================================
void DrawWeaponBar(const struct player_struct* p, int top) void DrawWeaponBar(const struct player_struct* p, int top)
{ {
double sbscale = 32800. / 65536.; 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; FString format;
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
{ {
if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON) 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); 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]); format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]);
} }
else else
{ {
if (p->gotweapon[i+1]) { if (p->gotweapon[i+1]) {
DrawGraphic(tileGetTexture(AMMO_ICON + i), 18 + i * 32, top - 6, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale); 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]); 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); 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) void Statusbar(int snum)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
double h = tilesiz[BOTTOMSTATUSBAR].y * scale; double h = tilesiz[BOTTOMSTATUSBAR].y * scale;
double top = 200 - h; double top = 200 - h;
BeginStatusBar(320, 200, h, true); BeginStatusBar(320, 200, h, true);
DrawInventory(p, 160, 154, 0); DrawInventory(p, 160, 154, 0);
if (ud.screen_size > 8) if (ud.screen_size > 8)
DrawWeaponBar(p, top); 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) if (ud.multimode > 1 && !ud.coop)
{ {
DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1);
format.Format("%d", max(p->frag - p->fraggedself, 0)); 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); SBar_DrawString(this, &digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
} }
else else
{ {
auto key = tileGetTexture(ACCESS_ICON); 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[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[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 (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; int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num); format.Format("%d", num);
SBar_DrawString(this, &digiFont, format, 64, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); 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) if (p->curr_weapon != KNEE_WEAPON)
{ {
int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon; int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wep]); 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); SBar_DrawString(this, &digiFont, format, 107, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
} }
int icon = p->inven_icon; int icon = p->inven_icon;
if (icon) if (icon)
{ {
int x = 183; int x = 183;
if (icon < ICON_MAX) if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p); int percentv = getinvamount(p);
if (icon <= 2) format.Format("%3d%%", percentv); if (icon <= 2) format.Format("%3d%%", percentv);
else 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); 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) 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); 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; p->drunkang = ((p->drink_amt * 8) + 1647) & 2047;
if (p->drink_amt >= 100) if (p->drink_amt >= 100)
{ {
p->drink_amt = 100; p->drink_amt = 100;
p->drunkang = 400; p->drunkang = 400;
} }
// Todo: These need rotation support which currently does not exist. // 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), 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), 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) if (p->drink_amt >= 0 && p->drink_amt <= 30)
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 239, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); 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) 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); 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) 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); DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 256, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
else else
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 265, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 265, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
if (p->eat >= 0 && p->eat <= 30) if (p->eat >= 0 && p->eat <= 30)
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 276, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 276, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
else if (p->eat >= 31 && p->eat <= 65) else if (p->eat >= 31 && p->eat <= 65)
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 285, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 285, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
else if (p->eat >= 66 && p->eat <= 87) else if (p->eat >= 66 && p->eat <= 87)
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 294, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 294, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
else else
{ {
DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 302, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 302, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
} }
PrintLevelStats(-1); PrintLevelStats(-1);
} }
}; };
void PrintLevelName_r(double alpha); void PrintLevelName_r(double alpha);
@ -400,13 +400,13 @@ void drawstatusbar_r(int snum)
dsb.Statusbar(snum); dsb.Statusbar(snum);
} }
if (hud_showmapname && levelTextTime > 1 && !M_Active()) if (hud_showmapname && levelTextTime > 1 && !M_Active())
{ {
double alpha; double alpha;
if (levelTextTime > 16) alpha = 1.; if (levelTextTime > 16) alpha = 1.;
else alpha = (levelTextTime) / 16.; else alpha = (levelTextTime) / 16.;
PrintLevelName_r(alpha); PrintLevelName_r(alpha);
} }
} }

View file

@ -401,7 +401,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
if (foundone) return -1; if (foundone) return -1;
} }
int32_t sndist; int32_t sndist;
FVector3 sndpos; // this is in sound engine space. FVector3 sndpos; // this is in sound engine space.
vec3_t* campos; 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); S_GetCamera(&campos, nullptr, &camsect);
GetPositionInfo(spriteNum, sndnum, camsect, campos, pos, &sndist, &sndpos); 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)); bool explosion = ((userflags & (SF_GLOBAL | SF_DTAG)) == (SF_GLOBAL | SF_DTAG)) || ((sndnum == PIPEBOMB_EXPLODE || sndnum == LASERTRIP_EXPLODE || sndnum == RPG_EXPLODE));

View file

@ -15,31 +15,31 @@ BEGIN_DUKE_NS
// Sound flags // Sound flags
enum { enum {
SF_LOOP = 1, SF_LOOP = 1,
SF_MSFX = 2, SF_MSFX = 2,
SF_TALK = 4, SF_TALK = 4,
SF_ADULT = 8, SF_ADULT = 8,
SF_GLOBAL = 16, SF_GLOBAL = 16,
SF_ONEINST_INTERNAL = 32, SF_ONEINST_INTERNAL = 32,
SF_DTAG = 128, SF_DTAG = 128,
}; };
enum esound_t enum esound_t
{ {
kPitchStart, kPitchStart,
kPitchEnd, kPitchEnd,
kVolAdjust, kVolAdjust,
kPriority, kPriority,
kFlags, kFlags,
kMaxUserData kMaxUserData
}; };
int A_CheckSoundPlaying(int spriteNum, int soundNum, int channel = 0); int A_CheckSoundPlaying(int spriteNum, int soundNum, int channel = 0);
int A_PlaySound(int soundNum, int spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0); int A_PlaySound(int soundNum, int spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0);
inline int spritesound(int soundnum, int spritenum) inline int spritesound(int soundnum, int spritenum)
{ {
return A_PlaySound(soundnum, spritenum); return A_PlaySound(soundnum, spritenum);
} }
int A_CheckAnySoundPlaying(int spriteNum); int A_CheckAnySoundPlaying(int spriteNum);
int S_CheckSoundPlaying(int soundNum); 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); int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0);
inline int sound(int num) 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); 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); void S_StopEnvSound(int sndNum,int sprNum, int flags = -1);
inline void stopsound(int snd) inline void stopsound(int snd)
{ {
S_StopEnvSound(snd, -1); S_StopEnvSound(snd, -1);
} }
#define S_StopSound(num) S_StopEnvSound(num, -1) #define S_StopSound(num) S_StopEnvSound(num, -1)
@ -74,7 +74,7 @@ void PlayBonusMusic();
inline bool S_IsSoundValid(int num) 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) inline bool StartCommentary(int tag, int sprnum)
{ {
return false; return false;
} }
extern TArray<FString> specialmusic; extern TArray<FString> specialmusic;

File diff suppressed because it is too large Load diff

View file

@ -7,13 +7,13 @@ BEGIN_DUKE_NS
struct STATUSBARTYPE struct STATUSBARTYPE
{ {
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon; short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
short ammo_amount[MAX_WEAPONS], holoduke_on; short ammo_amount[MAX_WEAPONS], holoduke_on;
unsigned char inven_icon, jetpack_on, heat_on; unsigned char inven_icon, jetpack_on, heat_on;
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount; short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
short heat_amount, scuba_amount, boot_amount; short heat_amount, scuba_amount, boot_amount;
short last_weapon, weapon_pos, kickback_pic; short last_weapon, weapon_pos, kickback_pic;
FixedBitArray<MAX_WEAPONS> gotweapon; // must be the same type as in player_struct FixedBitArray<MAX_WEAPONS> gotweapon; // must be the same type as in player_struct
}; };
struct weaponhit struct weaponhit
@ -28,7 +28,7 @@ struct weaponhit
struct animwalltype struct animwalltype
{ {
short wallnum, tag; short wallnum, tag;
}; };
// Todo - put more state in here // 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. // for now just flags not related to actors, may get more info later.
struct TileInfo struct TileInfo
{ {
int flags; int flags;
}; };
struct input_t // original name was input which is too generic for a type name. 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. fixed_t q16avel, q16horz; // These were expanded to 16.16 fixed point.
short fvel, svel; short fvel, svel;
ESyncBits bits; ESyncBits bits;
}; };
struct user_defs struct user_defs
{ {
unsigned char god, cashman, eog, showallmap; unsigned char god, cashman, eog, showallmap;
unsigned char show_help, scrollmode, clipping; unsigned char show_help, scrollmode, clipping;
char user_name[MAXPLAYERS][32]; char user_name[MAXPLAYERS][32];
unsigned char overhead_on, last_overhead, showweapons; unsigned char overhead_on, last_overhead, showweapons;
unsigned char user_pals[MAXPLAYERS]; unsigned char user_pals[MAXPLAYERS];
short from_bonus; short from_bonus;
short camerasprite, last_camsprite; short camerasprite, last_camsprite;
short last_level, secretlevel; short last_level, secretlevel;
int const_visibility; int const_visibility;
int folfvel, folavel, folx, foly, fola; int folfvel, folavel, folx, foly, fola;
int reccnt; int reccnt;
int runkey_mode, statusbarscale, mouseaiming, weaponswitch; int runkey_mode, statusbarscale, mouseaiming, weaponswitch;
int entered_name, shadows, executions, auto_run; int entered_name, shadows, executions, auto_run;
int coords, tickrate, levelstats, m_coop, coop, screen_size, lockout, crosshair; int coords, tickrate, levelstats, m_coop, coop, screen_size, lockout, crosshair;
int wchoice[MAXPLAYERS][MAX_WEAPONS], playerai; int wchoice[MAXPLAYERS][MAX_WEAPONS], playerai;
int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness; 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_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off, detail;
int m_ffire, ffire, m_player_skill, multimode; int m_ffire, ffire, m_player_skill, multimode;
int player_skill, m_marker, marker, mouseflip; int player_skill, m_marker, marker, mouseflip;
int statusbarmode, althud; int statusbarmode, althud;
MapRecord* nextLevel; MapRecord* nextLevel;
}; };
struct player_orig struct player_orig
{ {
int ox, oy, oz; int ox, oy, oz;
short oa, os; short oa, os;
}; };
struct player_struct 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. // 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. // The sound code wants to read a vector out of this so we need to define one for the main coordinate.
union union
{ {
vec3_t pos; vec3_t pos;
struct { int32_t posx, posy, posz; }; struct { int32_t posx, posy, posz; };
}; };
// input handles angle and horizon as fixed16 numbers. We need to account for that as well. // 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 q16ang, q16horiz, q16horizoff, q16rotscrnang, q16look_ang;
fixed_t oq16ang, oq16horiz, oq16horizoff, oq16rotscrnang; // These are only needed with synchronous mouse input. fixed_t oq16ang, oq16horiz, oq16horizoff, oq16rotscrnang; // These are only needed with synchronous mouse input.
fixed_t one_eighty_count; fixed_t one_eighty_count;
// using a bit field for this to save a bit of space. // using a bit field for this to save a bit of space.
FixedBitArray<MAX_WEAPONS> gotweapon; FixedBitArray<MAX_WEAPONS> gotweapon;
// Palette management uses indices into the engine's palette table now. // Palette management uses indices into the engine's palette table now.
unsigned int palette; unsigned int palette;
PalEntry pals; PalEntry pals;
// this was a global variable originally. // this was a global variable originally.
vec2_t fric; 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. // 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 zoom, exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt;
int invdisptime; int invdisptime;
int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff;
int posxv, posyv, poszv, last_pissed_time, truefz, truecz; int posxv, posyv, poszv, last_pissed_time, truefz, truecz;
int player_par, visibility; int player_par, visibility;
int bobcounter, weapon_sway; int bobcounter, weapon_sway;
int pals_time, randomflamex, crack_time; 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 angvel, cursectnum, last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself;
short curr_weapon, last_weapon, tipincs, wantweaponfire; short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs; short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum, access_spritenum; short ftq, access_wallnum, access_spritenum;
short kickback_pic, got_access, weapon_ang, firstaid_amount; short kickback_pic, got_access, weapon_ang, firstaid_amount;
short somethingonplayer, on_crane, i, one_parallax_sectnum; short somethingonplayer, on_crane, i, one_parallax_sectnum;
short over_shoulder_on, random_club_frame, fist_incs; short over_shoulder_on, random_club_frame, fist_incs;
short cheat_phase; short cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick; short dummyplayersprite, extra_extra8, quick_kick;
short heat_amount, actorsqu, timebeforeexit, customexitsound; short heat_amount, actorsqu, timebeforeexit, customexitsound;
short weaprecs[256], weapreccnt; short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag; unsigned int interface_toggle_flag;
short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount; short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short holoduke_on, pycount, weapon_pos, frag_ps; short holoduke_on, pycount, weapon_pos, frag_ps;
short transporter_hold, last_full_weapon, footprintshade, boot_amount; short transporter_hold, last_full_weapon, footprintshade, boot_amount;
int scream_voice; int scream_voice;
unsigned char gm; unsigned char gm;
unsigned char on_warping_sector, footprintcount; unsigned char on_warping_sector, footprintcount;
unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground; unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground;
char name[32]; char name[32];
unsigned char inven_icon, buttonpalette; unsigned char inven_icon, buttonpalette;
unsigned char jetpack_on, spritebridge, lastrandomspot; unsigned char jetpack_on, spritebridge, lastrandomspot;
unsigned char scuba_on, footprintpal, heat_on; unsigned char scuba_on, footprintpal, heat_on;
unsigned char holster_weapon; unsigned char holster_weapon;
unsigned char falling_counter; unsigned char falling_counter;
unsigned char refresh_inventory; unsigned char refresh_inventory;
unsigned char toggle_key_flag, knuckle_incs; // ,select_dir; unsigned char toggle_key_flag, knuckle_incs; // ,select_dir;
unsigned char walking_snd_toggle, palookup, hard_landing; unsigned char walking_snd_toggle, palookup, hard_landing;
unsigned char return_to_center; 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. // 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. // Items were reordered by size.
int stairs; int stairs;
int detonate_count; // at57e int detonate_count; // at57e
int noise_x, noise_y, noise_radius; // at286, at28a, at290 int noise_x, noise_y, noise_radius; // at286, at28a, at290
int drink_timer; // at58e int drink_timer; // at58e
int eat_timer; // at592 int eat_timer; // at592
int SlotWin; int SlotWin;
short recoil; short recoil;
short detonate_time; // at57c short detonate_time; // at57c
short yehaa_timer; short yehaa_timer;
short drink_amt, eat, drunkang, eatang; short drink_amt, eat, drunkang, eatang;
uint8_t shotgun_state[2]; uint8_t shotgun_state[2];
uint8_t donoise; // at28e uint8_t donoise; // at28e
uint8_t keys[5]; uint8_t keys[5];
// RRRA. The same as for the RR block applies. // RRRA. The same as for the RR block applies.
int drug_aspect; int drug_aspect;
int drug_timer; int drug_timer;
int SeaSick; int SeaSick;
short MamaEnd; // raat609 short MamaEnd; // raat609
short MotoSpeed, moto_drink; short MotoSpeed, moto_drink;
float TiltStatus; float TiltStatus;
short VBumpNow, VBumpTarget, TurbCount; short VBumpNow, VBumpTarget, TurbCount;
short drug_stat[3]; // raat5f1..5 short drug_stat[3]; // raat5f1..5
uint8_t DrugMode, lotag800kill; uint8_t DrugMode, lotag800kill;
uint8_t sea_sick_stat; // raat5dd uint8_t sea_sick_stat; // raat5dd
uint8_t hurt_delay2, nocheat; uint8_t hurt_delay2, nocheat;
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround; uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud; uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
int8_t crouch_toggle; int8_t crouch_toggle;
// input stuff. // input stuff.
float horizAngleAdjust; float horizAngleAdjust;
fix16_t horizSkew; fix16_t horizSkew;
bool lookLeft; bool lookLeft;
bool lookRight; bool lookRight;
// Access helpers for the widened angle and horizon fields. // Access helpers for the widened angle and horizon fields.
int getlookang() { return q16look_ang >> FRACBITS; } int getlookang() { return q16look_ang >> FRACBITS; }
void setlookang(int b) { q16look_ang = b << FRACBITS; } void setlookang(int b) { q16look_ang = b << FRACBITS; }
void addlookang(int b) { q16look_ang += b << FRACBITS; } void addlookang(int b) { q16look_ang += b << FRACBITS; }
void addlookang(double b) { q16look_ang += int(b *65536.); } void addlookang(double b) { q16look_ang += int(b *65536.); }
int getrotscrnang() { return q16rotscrnang >> FRACBITS; } int getrotscrnang() { return q16rotscrnang >> FRACBITS; }
void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; } void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; }
void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; } void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; }
void addrotscrnang(double b) { q16rotscrnang += int(b *65536.); } void addrotscrnang(double b) { q16rotscrnang += int(b *65536.); }
int getang() { return q16ang >> FRACBITS; } int getang() { return q16ang >> FRACBITS; }
int getoang() { return oq16ang >> FRACBITS; } int getoang() { return oq16ang >> FRACBITS; }
void setang(int v, bool smooth = false) { q16ang = v << 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 addang(int v, bool smooth = false) { q16ang = (q16ang + (v << FRACBITS)) & ((2048 << FRACBITS) - 1); }
void setoang(int v) { oq16ang = v << FRACBITS; } void setoang(int v) { oq16ang = v << FRACBITS; }
void addhoriz(int v) { q16horiz += (v << FRACBITS); } void addhoriz(int v) { q16horiz += (v << FRACBITS); }
void addhorizoff(int v) { q16horiz += (v << FRACBITS); } void addhorizoff(int v) { q16horiz += (v << FRACBITS); }
void addhorizoff(double v) { q16horiz += int(v * 65536.); } void addhorizoff(double v) { q16horiz += int(v * 65536.); }
void sethoriz(int v) { q16horiz = (v << FRACBITS); } void sethoriz(int v) { q16horiz = (v << FRACBITS); }
void sethorizoff(int v) { q16horizoff = (v << FRACBITS); } void sethorizoff(int v) { q16horizoff = (v << FRACBITS); }
int gethoriz() { return q16horiz >> FRACBITS; } int gethoriz() { return q16horiz >> FRACBITS; }
int gethorizof() { return q16horizoff >> FRACBITS; } int gethorizof() { return q16horizoff >> FRACBITS; }
int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; } int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; }
}; };