From d311792e0600015dad81b120f9273cffd898a4ca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 May 2021 10:23:50 +0200 Subject: [PATCH] - engine side preparations for Duke Statusbar scriptification. Mainly, gotweapon had to be reverted to a flat bool array to avoid implementing FixedBitArray for the VM. Also adding a few new tile names and PushV for string arrays. --- source/common/scripting/core/dynarrays.cpp | 16 ++++++++++++ source/games/duke/src/2d_d.cpp | 6 ++--- source/games/duke/src/actors_d.cpp | 6 ++--- source/games/duke/src/actors_r.cpp | 16 ++++++------ source/games/duke/src/cheats.cpp | 4 +-- source/games/duke/src/flags_r.cpp | 4 +-- source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/namelist_d.h | 25 +++++++++++++++++- source/games/duke/src/namelist_r.h | 16 +++++++++--- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 18 ++++++------- source/games/duke/src/premap.cpp | 30 +++++++++++----------- source/games/duke/src/savegame.cpp | 2 +- source/games/duke/src/sbar_d.cpp | 6 ++--- source/games/duke/src/sbar_r.cpp | 8 +++--- source/games/duke/src/spawn_r.cpp | 8 +++--- source/games/duke/src/types.h | 6 ++--- source/games/sw/src/game.h | 2 +- wadsrc/static/zscript/engine/dynarrays.zs | 1 + 19 files changed, 114 insertions(+), 64 deletions(-) diff --git a/source/common/scripting/core/dynarrays.cpp b/source/common/scripting/core/dynarrays.cpp index 6be216c12..21a362248 100644 --- a/source/common/scripting/core/dynarrays.cpp +++ b/source/common/scripting/core/dynarrays.cpp @@ -1006,6 +1006,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Push, ArrayPushPush(val)); } +DEFINE_ACTION_FUNCTION(FDynArray_String, PushV) +{ + PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String); + PARAM_VA_POINTER(va_reginfo); // Get the hidden type information array + VMVa_List args = { param + 1, 0, numparam - 2, va_reginfo + 1 }; + while (args.curindex < args.numargs) + { + if (args.reginfo[args.curindex] == REGT_STRING) + { + self->Push(args.args[args.curindex++].s()); + } + else ThrowAbortException(X_OTHER, "Invalid parameter in pushv, string expected"); + } + ACTION_RETURN_INT(self->Size() - 1); +} + DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Pop, ArrayPop) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String); diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index e8f3561f6..c84e4ce46 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -112,9 +112,9 @@ void InitFonts_d() fontdata.Clear(); // SBAR index font - for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i)); - fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); - fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); + for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE0 + i)); + fontdata.Insert(':', tileGetTexture(THREEBYFIVE0 + 10)); + fontdata.Insert('/', tileGetTexture(THREEBYFIVE0 + 11)); fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. GlyphSet::Iterator iti(fontdata); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index c0705d7d8..912d73225 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -220,9 +220,9 @@ void addweapon_d(struct player_struct *p, int weapon) { if ( p->gotweapon[weapon] == 0 ) { - p->gotweapon.Set(weapon); - if(weapon == SHRINKER_WEAPON) - p->gotweapon.Set(GROW_WEAPON); + p->gotweapon[weapon] = true; + if (weapon == SHRINKER_WEAPON) + p->gotweapon[GROW_WEAPON] = true; } p->random_club_frame = 0; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 76fcc7170..73d1a2e2a 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -118,16 +118,16 @@ void addweapon_r(struct player_struct* p, int weapon) short cw = p->curr_weapon; if (p->OnMotorcycle || p->OnBoat) { - p->gotweapon.Set(weapon); + p->gotweapon[weapon] = true;; if (weapon == THROWSAW_WEAPON) { - p->gotweapon.Set(BUZZSAW_WEAPON); + p->gotweapon[BUZZSAW_WEAPON] = true; p->ammo_amount[BUZZSAW_WEAPON] = 1; } else if (weapon == CROSSBOW_WEAPON) { - p->gotweapon.Set(CHICKEN_WEAPON); - p->gotweapon.Set(DYNAMITE_WEAPON); + p->gotweapon[CHICKEN_WEAPON] = true; + p->gotweapon[DYNAMITE_WEAPON] = true; } else if (weapon == SLINGBLADE_WEAPON) { @@ -138,17 +138,17 @@ void addweapon_r(struct player_struct* p, int weapon) if (p->gotweapon[weapon] == 0) { - p->gotweapon.Set(weapon); + p->gotweapon[weapon] = true;; if (weapon == THROWSAW_WEAPON) { - p->gotweapon.Set(BUZZSAW_WEAPON); + p->gotweapon[BUZZSAW_WEAPON] = true; p->ammo_amount[BUZZSAW_WEAPON] = 1; } if (isRRRA()) { if (weapon == CROSSBOW_WEAPON) { - p->gotweapon.Set(CHICKEN_WEAPON); + p->gotweapon[CHICKEN_WEAPON] = true; } if (weapon == SLINGBLADE_WEAPON) { @@ -157,7 +157,7 @@ void addweapon_r(struct player_struct* p, int weapon) } if (weapon == CROSSBOW_WEAPON) { - p->gotweapon.Set(DYNAMITE_WEAPON); + p->gotweapon[DYNAMITE_WEAPON] = true; } if (weapon != DYNAMITE_WEAPON) diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index c76f8c96e..e87bce1fc 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -194,7 +194,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) case CHT_RHETT: ud.god = 0; - ps[player].gotweapon.Zero(); + memset(ps[player].gotweapon, 0, MAX_WEAPONS); ps[player].curr_weapon = KNEE_WEAPON; ps[player].nocheat = 1; ps[player].GetActor()->s->extra = 1; @@ -231,7 +231,7 @@ static bool cheatWeapons(int player) for (int weapon = PISTOL_WEAPON; weapon < weaponLimit; weapon++ ) { addammo( weapon, &ps[player], gs.max_ammo_amount[weapon] ); - ps[player].gotweapon.Set(weapon); + ps[player].gotweapon[weapon] = true;; } if (isRRRA()) ps[player].ammo_amount[SLINGBLADE_WEAPON] = 1; diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 04ef28b6e..3fcb1ae8a 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -173,7 +173,7 @@ void initactorflags_r() STEROIDS, HEATSENSOR, BOOTS, - JETPACK, + COWPIE, HOLODUKE, AIRTANK }); @@ -205,7 +205,7 @@ void initactorflags_r() gs.weaponsandammosprites[2] = DEVISTATORAMMO; gs.weaponsandammosprites[3] = RPGAMMO; gs.weaponsandammosprites[4] = RPGAMMO; - gs.weaponsandammosprites[5] = JETPACK; + gs.weaponsandammosprites[5] = COWPIE; gs.weaponsandammosprites[6] = SHIELD; gs.weaponsandammosprites[7] = FIRSTAID; gs.weaponsandammosprites[8] = STEROIDS; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index aec75bf8d..e2d0b2751 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -851,7 +851,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_GOTWEAPON: - if (bSet) ps[iPlayer].gotweapon.Set(lParm2, lValue); + if (bSet) ps[iPlayer].gotweapon[lParm2, lValue] = true; else SetGameVarID(lVar2, ps[iPlayer].gotweapon[lParm2], sActor, sPlayer); break; diff --git a/source/games/duke/src/namelist_d.h b/source/games/duke/src/namelist_d.h index d05332000..d62867483 100644 --- a/source/games/duke/src/namelist_d.h +++ b/source/games/duke/src/namelist_d.h @@ -13,6 +13,7 @@ x(AMMOBOX, 31) x(GROWSPRITEICON, 32) x(INVENTORYBOX, 33) x(FREEZEAMMO, 37) +x(FREEZEAMMO1, 38) x(AMMO, 40) x(BATTERYAMMO, 41) x(DEVISTATORAMMO, 42) @@ -571,6 +572,16 @@ x(BIGFNTCURSOR, 2820) x(SMALLFNTCURSOR, 2821) x(STARTALPHANUM, 2822) x(ENDALPHANUM, 2915) +x(BIGALPHANUM0, 2930) +x(BIGALPHANUM1, 2931) +x(BIGALPHANUM2, 2932) +x(BIGALPHANUM3, 2933) +x(BIGALPHANUM4, 2934) +x(BIGALPHANUM5, 2935) +x(BIGALPHANUM6, 2936) +x(BIGALPHANUM7, 2937) +x(BIGALPHANUM8, 2938) +x(BIGALPHANUM9, 2939) x(BIGALPHANUM, 2940) x(BIGPERIOD, 3002) x(BIGCOMMA, 3003) @@ -578,7 +589,18 @@ x(BIGX, 3004) x(BIGQ, 3005) x(BIGSEMI, 3006) x(BIGCOLIN, 3007) -x(THREEBYFIVE, 3010) +x(THREEBYFIVE0, 3010) +x(THREEBYFIVE1, 3011) +x(THREEBYFIVE2, 3012) +x(THREEBYFIVE3, 3013) +x(THREEBYFIVE4, 3014) +x(THREEBYFIVE5, 3015) +x(THREEBYFIVE6, 3016) +x(THREEBYFIVE7, 3017) +x(THREEBYFIVE8, 3018) +x(THREEBYFIVE9, 3019) +x(THREEBYFIVE10, 3020) +x(THREEBYFIVE11, 3021) x(BIGAPPOS, 3022) x(BLANK, 3026) x(MINIFONT, 3072) @@ -766,6 +788,7 @@ x(WTGLASS1, 5736) x(WTGLASS2, 5737) x(FLAMETHROWERSPRITE, 5134) x(FLAMETHROWERAMMO, 5135) +x(FLAMETHROWERAMMO1, 5136) x(FLAMETHROWER, 5138) x(ONFIRE, 5152) x(LAVAPOOL, 5304) diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index 46696dd5e..ecc5e6a5d 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -35,13 +35,13 @@ x(CRYSTALAMMO, 46) x(HBOMBAMMO, 47) x(AMMOLOTS, 48) x(SHOTGUNAMMO, 49) -x(COLA, 51) +x(BEER, 51) x(SIXPAK, 52) x(FIRSTAID, 53) x(SHIELD, 54) x(STEROIDS, 55) x(AIRTANK, 56) -x(JETPACK, 57) +x(COWPIE, 57) x(HEATSENSOR, 59) x(ACCESSCARD, 60) x(BOOTS, 61) @@ -229,7 +229,17 @@ x(GUTMETER_LIGHT1, 920) x(GUTMETER_LIGHT2, 921) x(GUTMETER_LIGHT3, 922) x(GUTMETER_LIGHT4, 923) -x(AMMO_ICON, 930) +x(AMMO_ICON0, 930) +x(AMMO_ICON1, 931) +x(AMMO_ICON2, 932) +x(AMMO_ICON3, 933) +x(AMMO_ICON4, 934) +x(AMMO_ICON5, 935) +x(AMMO_ICON6, 936) +x(AMMO_ICON7, 937) +x(AMMO_ICON8, 938) +x(AMMO_ICON9, 939) +x(AMMO_ICON10, 940) x(CLOUDYSKIES, 1021) x(MOONSKY1, 1022) x(MOONSKY2, 1023) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index bcafc4276..7103dceaa 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1315,7 +1315,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum { if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) { - p->gotweapon.Set(HANDBOMB_WEAPON); + p->gotweapon[HANDBOMB_WEAPON] = true; j = HANDREMOTE_WEAPON; break; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 80fd74852..378488dc4 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1082,7 +1082,7 @@ void selectweapon_r(int snum, int weap) { if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) { - p->gotweapon.Set(DYNAMITE_WEAPON); + p->gotweapon[DYNAMITE_WEAPON] = true; j = THROWINGDYNAMITE_WEAPON; break; } @@ -1499,7 +1499,7 @@ void checkweapons_r(struct player_struct* p) j->s->ang = p->angle.ang.asbuild(); j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; p->OnMotorcycle = 0; - p->gotweapon.Clear(MOTORCYCLE_WEAPON); + p->gotweapon[MOTORCYCLE_WEAPON] = false; p->horizon.horiz = q16horiz(0); p->moto_do_bump = 0; p->MotoSpeed = 0; @@ -1515,7 +1515,7 @@ void checkweapons_r(struct player_struct* p) j->s->ang = p->angle.ang.asbuild(); j->saved_ammo = p->ammo_amount[BOAT_WEAPON]; p->OnBoat = 0; - p->gotweapon.Clear(BOAT_WEAPON); + p->gotweapon[BOAT_WEAPON] = false; p->horizon.horiz = q16horiz(0); p->moto_do_bump = 0; p->MotoSpeed = 0; @@ -3132,7 +3132,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 3) { p->ammo_amount[POWDERKEG_WEAPON]--; - p->gotweapon.Clear(POWDERKEG_WEAPON); + p->gotweapon[POWDERKEG_WEAPON] = false; if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) { k = 15; @@ -3176,7 +3176,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic > 40) { p->okickback_pic = p->kickback_pic = 0; - p->gotweapon.Clear(BOWLING_WEAPON); + p->gotweapon[BOWLING_WEAPON] = false; checkavailweapon(p); } break; @@ -4057,7 +4057,7 @@ void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite) p->OnMotorcycle = 1; p->last_full_weapon = p->curr_weapon; p->curr_weapon = MOTORCYCLE_WEAPON; - p->gotweapon.Set(MOTORCYCLE_WEAPON); + p->gotweapon[MOTORCYCLE_WEAPON] = true; p->posxv = 0; p->posyv = 0; p->horizon.horiz = q16horiz(0); @@ -4088,7 +4088,7 @@ void OffMotorcycle(struct player_struct *p) if (!S_CheckActorSoundPlaying(pact,42)) S_PlayActorSound(42, pact); p->OnMotorcycle = 0; - p->gotweapon.Clear(MOTORCYCLE_WEAPON); + p->gotweapon[MOTORCYCLE_WEAPON] = false; p->curr_weapon = p->last_full_weapon; checkavailweapon(p); p->horizon.horiz = q16horiz(0); @@ -4134,7 +4134,7 @@ void OnBoat(struct player_struct *p, DDukeActor* boat) p->OnBoat = 1; p->last_full_weapon = p->curr_weapon; p->curr_weapon = BOAT_WEAPON; - p->gotweapon.Set(BOAT_WEAPON); + p->gotweapon[BOAT_WEAPON] = true; p->posxv = 0; p->posyv = 0; p->horizon.horiz = q16horiz(0); @@ -4152,7 +4152,7 @@ void OffBoat(struct player_struct *p) if (p->OnBoat) { p->OnBoat = 0; - p->gotweapon.Clear(BOAT_WEAPON); + p->gotweapon[BOAT_WEAPON] = false; p->curr_weapon = p->last_full_weapon; checkavailweapon(p); p->horizon.horiz = q16horiz(0); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index b9ad8a3b6..b7ca8bfcf 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -208,7 +208,7 @@ void resetplayerstats(int snum) if (p->OnMotorcycle) { p->OnMotorcycle = 0; - p->gotweapon.Clear(MOTORCYCLE_WEAPON); + p->gotweapon[MOTORCYCLE_WEAPON] = false; p->curr_weapon = isRRRA()? SLINGBLADE_WEAPON : KNEE_WEAPON; // just in case this is made available for the other games } p->lotag800kill = 0; @@ -227,7 +227,7 @@ void resetplayerstats(int snum) if (p->OnBoat) { p->OnBoat = 0; - p->gotweapon.Clear(BOAT_WEAPON); + p->gotweapon[BOAT_WEAPON] = false; p->curr_weapon = isRRRA()? SLINGBLADE_WEAPON : KNEE_WEAPON; // just in case this is made available for the other games } p->NotOnWater = 0; @@ -272,14 +272,14 @@ void resetweapons(int snum) p->ammo_amount[weapon] = 0; } - p->gotweapon.Zero(); + memset(p->gotweapon, 0, MAX_WEAPONS); p->oweapon_pos = p->weapon_pos = 6; p->okickback_pic = p->kickback_pic = 5; p->curr_weapon = PISTOL_WEAPON; - p->gotweapon.Set(PISTOL_WEAPON); - p->gotweapon.Set(KNEE_WEAPON); + p->gotweapon[PISTOL_WEAPON] = true; + p->gotweapon[KNEE_WEAPON] = true; p->ammo_amount[PISTOL_WEAPON] = std::min(gs.max_ammo_amount[PISTOL_WEAPON], 48); - p->gotweapon.Set(HANDREMOTE_WEAPON); + p->gotweapon[HANDREMOTE_WEAPON] = true; p->last_weapon = -1; p->show_empty_weapon= 0; @@ -296,7 +296,7 @@ void resetweapons(int snum) { chickenphase = 0; p->ammo_amount[KNEE_WEAPON] = 1; - p->gotweapon.Set(SLINGBLADE_WEAPON); + p->gotweapon[SLINGBLADE_WEAPON] = true; p->ammo_amount[SLINGBLADE_WEAPON] = 1; } OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1); @@ -518,7 +518,7 @@ void resetpspritevars(int g) for (j = 0; j < MAX_WEAPONS; j++) { tsbar[i].ammo_amount[j] = ps[i].ammo_amount[j]; - tsbar[i].gotweapon.Set(j, ps[i].gotweapon[j]); + tsbar[i].gotweapon[j] = ps[i].gotweapon[j]; } tsbar[i].shield_amount = ps[i].shield_amount; @@ -548,7 +548,7 @@ void resetpspritevars(int g) for (j = 0; j < MAX_WEAPONS; j++) { ps[i].ammo_amount[j] = tsbar[i].ammo_amount[j]; - ps[i].gotweapon.Set(j, tsbar[i].gotweapon[j]); + ps[i].gotweapon[j] = tsbar[i].gotweapon[j]; } ps[i].shield_amount = tsbar[i].shield_amount; ps[i].curr_weapon = tsbar[i].curr_weapon; @@ -772,22 +772,22 @@ void donewgame(MapRecord* map, int sk) if (aplWeaponWorksLike[i][0] == PISTOL_WEAPON) { p->curr_weapon = i; - p->gotweapon.Set(i); + p->gotweapon[i] = true; p->ammo_amount[i] = 48; } else if (aplWeaponWorksLike[i][0] == KNEE_WEAPON || aplWeaponWorksLike[i][0] == HANDREMOTE_WEAPON) { - p->gotweapon.Set(i); + p->gotweapon[i] = true; } } } else { p->curr_weapon = PISTOL_WEAPON; - p->gotweapon.Set(PISTOL_WEAPON); - p->gotweapon.Set(KNEE_WEAPON); + p->gotweapon[PISTOL_WEAPON] = true; + p->gotweapon[KNEE_WEAPON] = true; p->ammo_amount[PISTOL_WEAPON] = 48; - p->gotweapon.Set(HANDREMOTE_WEAPON); + p->gotweapon[HANDREMOTE_WEAPON] = true; p->last_weapon = -1; } @@ -1031,7 +1031,7 @@ void enterlevel(MapRecord *mi, int gamemode) if (clearweapon) { resetweapons(i); - ps[i].gotweapon.Clear(PISTOL_WEAPON); + ps[i].gotweapon[PISTOL_WEAPON] = false; ps[i].ammo_amount[PISTOL_WEAPON] = 0; ps[i].curr_weapon = KNEE_WEAPON; ps[i].kickback_pic = 0; diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index e810c25dc..3f5cf3ae2 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -89,7 +89,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, ("posz", w.posz) ("angle", w.angle) ("horizon", w.horizon) - ("gotweapon", w.gotweapon) + .Array("gotweapon", w.gotweapon, MAX_WEAPONS) ("pals", w.pals) ("fricx", w.fric.x) ("fricy", w.fric.y) diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index e55fdea14..56b37104b 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -355,15 +355,15 @@ public: format.Format("%3d/%d", num1, num2); } y--; - DrawGraphic(tileGetTexture(THREEBYFIVE + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7)); + DrawGraphic(tileGetTexture(THREEBYFIVE0 + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7)); auto pe = LightForShade(shade); - DrawGraphic(tileGetTexture(THREEBYFIVE + 10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe); + DrawGraphic(tileGetTexture(THREEBYFIVE10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe); for (size_t i = 0; i < format.Len(); i++) { if (format[i] != ' ') { char c = format[i] == '/' ? 11 : format[i] - '0'; - DrawGraphic(tileGetTexture(THREEBYFIVE + c), x + 4 * i + (parsedDivisor ? 1 : 0), y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe); + DrawGraphic(tileGetTexture(THREEBYFIVE0 + c), x + 4 * i + (parsedDivisor ? 1 : 0), y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe); } if (format[i] == '/') { diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index 72d887140..e411950f4 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -123,7 +123,7 @@ public: // // drink // - img = tileGetTexture(COLA); + img = tileGetTexture(BEER); imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 74, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); format.Format("%d", p->drink_amt); @@ -132,7 +132,7 @@ public: // // eat // - img = tileGetTexture(JETPACK); + img = tileGetTexture(COWPIE); imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 133.5, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); format.Format("%d", p->eat); @@ -313,14 +313,14 @@ public: if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON) { - img = tileGetTexture(AMMO_ICON + 10); + img = tileGetTexture(AMMO_ICON10); format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]); } else { if (p->gotweapon[i+1]) { - img = tileGetTexture(AMMO_ICON + i); + img = tileGetTexture(AMMO_ICON0 + i); format.Format("%d", p->ammo_amount[i+1]); } } diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index d63d6cfc0..7a2067c49 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1120,7 +1120,7 @@ int spawn_r(int j, int pn) case SHIELD: case AIRTANK: case TRIPBOMBSPRITE: - case JETPACK: + case COWPIE: case HOLODUKE: case FIRSTGUNSPRITE: @@ -1142,7 +1142,7 @@ int spawn_r(int j, int pn) case BOOTS: case AMMO: case AMMOLOTS: - case COLA: + case BEER: case FIRSTAID: case SIXPAK: @@ -1224,7 +1224,7 @@ int spawn_r(int j, int pn) sp->xrepeat = 8; sp->yrepeat = 8; break; - case COLA: + case BEER: sp->xrepeat = 5; sp->yrepeat = 4; break; @@ -1242,7 +1242,7 @@ int spawn_r(int j, int pn) sp->xrepeat = 16; sp->yrepeat = 16; break; - case JETPACK: + case COWPIE: sp->xrepeat = 8; sp->yrepeat = 6; break; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index ea8399dfd..3b352ab2b 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -8,6 +8,7 @@ extern spritetype sprite_s[]; BEGIN_DUKE_NS + // all the struct types from JFDuke's duke3d.h struct STATUSBARTYPE @@ -18,7 +19,7 @@ struct STATUSBARTYPE short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount; short heat_amount, scuba_amount, boot_amount; short last_weapon, weapon_pos, kickback_pic; - FixedBitArray gotweapon; // must be the same type as in player_struct + bool gotweapon[MAX_WEAPONS]; }; struct weaponhit @@ -171,8 +172,7 @@ struct player_struct uint16_t frags[MAXPLAYERS]; - // using a bit field for this to save a bit of space. - FixedBitArray gotweapon; + bool gotweapon[MAX_WEAPONS]; // Palette management uses indices into the engine's palette table now. PalEntry pals; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 173ba99a7..4bd3a9125 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1924,7 +1924,7 @@ SECT_USERp GetSectUser(short sectnum); // 1. The variables were unmaintained and could refer to handles that had been reused already. // 2. No proper sound ownership tracking. // 3. In some cases items that were supposed to use the same check referred to different handle variables. -// In short: I was very broken. This is a list of all sound items used this way, now each one gets a dedicated channel +// In short: It was very broken. This is a list of all sound items used this way, now each one gets a dedicated channel // so that proper checks can be performed and sound ownership be tracked. enum diff --git a/wadsrc/static/zscript/engine/dynarrays.zs b/wadsrc/static/zscript/engine/dynarrays.zs index 1db4a6224..009350b8e 100644 --- a/wadsrc/static/zscript/engine/dynarrays.zs +++ b/wadsrc/static/zscript/engine/dynarrays.zs @@ -151,6 +151,7 @@ struct DynArray_String native native void Append (DynArray_String other); native uint Find(String item) const; native uint Push (String item); + native vararg uint PushV(String item, ...); native bool Pop (); native void Delete (uint index, int deletecount = 1); native void Insert (uint index, String item);