- 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.
This commit is contained in:
Christoph Oelckers 2021-05-15 10:23:50 +02:00
parent 845ce63348
commit d311792e06
19 changed files with 114 additions and 64 deletions

View file

@ -1006,6 +1006,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Push, ArrayPush<FDynArray_String
ACTION_RETURN_INT(self->Push(val)); ACTION_RETURN_INT(self->Push(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<FDynArray_String>) DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Pop, ArrayPop<FDynArray_String>)
{ {
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String); PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String);

View file

@ -112,9 +112,9 @@ void InitFonts_d()
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(THREEBYFIVE0 + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10)); fontdata.Insert(':', tileGetTexture(THREEBYFIVE0 + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); fontdata.Insert('/', tileGetTexture(THREEBYFIVE0 + 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.
GlyphSet::Iterator iti(fontdata); GlyphSet::Iterator iti(fontdata);

View file

@ -220,9 +220,9 @@ void addweapon_d(struct player_struct *p, int weapon)
{ {
if ( p->gotweapon[weapon] == 0 ) if ( p->gotweapon[weapon] == 0 )
{ {
p->gotweapon.Set(weapon); p->gotweapon[weapon] = true;
if (weapon == SHRINKER_WEAPON) if (weapon == SHRINKER_WEAPON)
p->gotweapon.Set(GROW_WEAPON); p->gotweapon[GROW_WEAPON] = true;
} }
p->random_club_frame = 0; p->random_club_frame = 0;

View file

@ -118,16 +118,16 @@ void addweapon_r(struct player_struct* p, int weapon)
short cw = p->curr_weapon; short cw = p->curr_weapon;
if (p->OnMotorcycle || p->OnBoat) if (p->OnMotorcycle || p->OnBoat)
{ {
p->gotweapon.Set(weapon); p->gotweapon[weapon] = true;;
if (weapon == THROWSAW_WEAPON) if (weapon == THROWSAW_WEAPON)
{ {
p->gotweapon.Set(BUZZSAW_WEAPON); p->gotweapon[BUZZSAW_WEAPON] = true;
p->ammo_amount[BUZZSAW_WEAPON] = 1; p->ammo_amount[BUZZSAW_WEAPON] = 1;
} }
else if (weapon == CROSSBOW_WEAPON) else if (weapon == CROSSBOW_WEAPON)
{ {
p->gotweapon.Set(CHICKEN_WEAPON); p->gotweapon[CHICKEN_WEAPON] = true;
p->gotweapon.Set(DYNAMITE_WEAPON); p->gotweapon[DYNAMITE_WEAPON] = true;
} }
else if (weapon == SLINGBLADE_WEAPON) else if (weapon == SLINGBLADE_WEAPON)
{ {
@ -138,17 +138,17 @@ void addweapon_r(struct player_struct* p, int weapon)
if (p->gotweapon[weapon] == 0) if (p->gotweapon[weapon] == 0)
{ {
p->gotweapon.Set(weapon); p->gotweapon[weapon] = true;;
if (weapon == THROWSAW_WEAPON) if (weapon == THROWSAW_WEAPON)
{ {
p->gotweapon.Set(BUZZSAW_WEAPON); p->gotweapon[BUZZSAW_WEAPON] = true;
p->ammo_amount[BUZZSAW_WEAPON] = 1; p->ammo_amount[BUZZSAW_WEAPON] = 1;
} }
if (isRRRA()) if (isRRRA())
{ {
if (weapon == CROSSBOW_WEAPON) if (weapon == CROSSBOW_WEAPON)
{ {
p->gotweapon.Set(CHICKEN_WEAPON); p->gotweapon[CHICKEN_WEAPON] = true;
} }
if (weapon == SLINGBLADE_WEAPON) if (weapon == SLINGBLADE_WEAPON)
{ {
@ -157,7 +157,7 @@ void addweapon_r(struct player_struct* p, int weapon)
} }
if (weapon == CROSSBOW_WEAPON) if (weapon == CROSSBOW_WEAPON)
{ {
p->gotweapon.Set(DYNAMITE_WEAPON); p->gotweapon[DYNAMITE_WEAPON] = true;
} }
if (weapon != DYNAMITE_WEAPON) if (weapon != DYNAMITE_WEAPON)

View file

@ -194,7 +194,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
case CHT_RHETT: case CHT_RHETT:
ud.god = 0; ud.god = 0;
ps[player].gotweapon.Zero(); memset(ps[player].gotweapon, 0, MAX_WEAPONS);
ps[player].curr_weapon = KNEE_WEAPON; ps[player].curr_weapon = KNEE_WEAPON;
ps[player].nocheat = 1; ps[player].nocheat = 1;
ps[player].GetActor()->s->extra = 1; ps[player].GetActor()->s->extra = 1;
@ -231,7 +231,7 @@ static bool cheatWeapons(int player)
for (int weapon = PISTOL_WEAPON; weapon < weaponLimit; weapon++ ) for (int weapon = PISTOL_WEAPON; weapon < weaponLimit; weapon++ )
{ {
addammo( weapon, &ps[player], gs.max_ammo_amount[weapon] ); addammo( weapon, &ps[player], gs.max_ammo_amount[weapon] );
ps[player].gotweapon.Set(weapon); ps[player].gotweapon[weapon] = true;;
} }
if (isRRRA()) if (isRRRA())
ps[player].ammo_amount[SLINGBLADE_WEAPON] = 1; ps[player].ammo_amount[SLINGBLADE_WEAPON] = 1;

View file

@ -173,7 +173,7 @@ void initactorflags_r()
STEROIDS, STEROIDS,
HEATSENSOR, HEATSENSOR,
BOOTS, BOOTS,
JETPACK, COWPIE,
HOLODUKE, HOLODUKE,
AIRTANK }); AIRTANK });
@ -205,7 +205,7 @@ void initactorflags_r()
gs.weaponsandammosprites[2] = DEVISTATORAMMO; gs.weaponsandammosprites[2] = DEVISTATORAMMO;
gs.weaponsandammosprites[3] = RPGAMMO; gs.weaponsandammosprites[3] = RPGAMMO;
gs.weaponsandammosprites[4] = RPGAMMO; gs.weaponsandammosprites[4] = RPGAMMO;
gs.weaponsandammosprites[5] = JETPACK; gs.weaponsandammosprites[5] = COWPIE;
gs.weaponsandammosprites[6] = SHIELD; gs.weaponsandammosprites[6] = SHIELD;
gs.weaponsandammosprites[7] = FIRSTAID; gs.weaponsandammosprites[7] = FIRSTAID;
gs.weaponsandammosprites[8] = STEROIDS; gs.weaponsandammosprites[8] = STEROIDS;

View file

@ -851,7 +851,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break; break;
case PLAYER_GOTWEAPON: 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); else SetGameVarID(lVar2, ps[iPlayer].gotweapon[lParm2], sActor, sPlayer);
break; break;

View file

@ -13,6 +13,7 @@ x(AMMOBOX, 31)
x(GROWSPRITEICON, 32) x(GROWSPRITEICON, 32)
x(INVENTORYBOX, 33) x(INVENTORYBOX, 33)
x(FREEZEAMMO, 37) x(FREEZEAMMO, 37)
x(FREEZEAMMO1, 38)
x(AMMO, 40) x(AMMO, 40)
x(BATTERYAMMO, 41) x(BATTERYAMMO, 41)
x(DEVISTATORAMMO, 42) x(DEVISTATORAMMO, 42)
@ -571,6 +572,16 @@ x(BIGFNTCURSOR, 2820)
x(SMALLFNTCURSOR, 2821) x(SMALLFNTCURSOR, 2821)
x(STARTALPHANUM, 2822) x(STARTALPHANUM, 2822)
x(ENDALPHANUM, 2915) 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(BIGALPHANUM, 2940)
x(BIGPERIOD, 3002) x(BIGPERIOD, 3002)
x(BIGCOMMA, 3003) x(BIGCOMMA, 3003)
@ -578,7 +589,18 @@ x(BIGX, 3004)
x(BIGQ, 3005) x(BIGQ, 3005)
x(BIGSEMI, 3006) x(BIGSEMI, 3006)
x(BIGCOLIN, 3007) 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(BIGAPPOS, 3022)
x(BLANK, 3026) x(BLANK, 3026)
x(MINIFONT, 3072) x(MINIFONT, 3072)
@ -766,6 +788,7 @@ x(WTGLASS1, 5736)
x(WTGLASS2, 5737) x(WTGLASS2, 5737)
x(FLAMETHROWERSPRITE, 5134) x(FLAMETHROWERSPRITE, 5134)
x(FLAMETHROWERAMMO, 5135) x(FLAMETHROWERAMMO, 5135)
x(FLAMETHROWERAMMO1, 5136)
x(FLAMETHROWER, 5138) x(FLAMETHROWER, 5138)
x(ONFIRE, 5152) x(ONFIRE, 5152)
x(LAVAPOOL, 5304) x(LAVAPOOL, 5304)

View file

@ -35,13 +35,13 @@ x(CRYSTALAMMO, 46)
x(HBOMBAMMO, 47) x(HBOMBAMMO, 47)
x(AMMOLOTS, 48) x(AMMOLOTS, 48)
x(SHOTGUNAMMO, 49) x(SHOTGUNAMMO, 49)
x(COLA, 51) x(BEER, 51)
x(SIXPAK, 52) x(SIXPAK, 52)
x(FIRSTAID, 53) x(FIRSTAID, 53)
x(SHIELD, 54) x(SHIELD, 54)
x(STEROIDS, 55) x(STEROIDS, 55)
x(AIRTANK, 56) x(AIRTANK, 56)
x(JETPACK, 57) x(COWPIE, 57)
x(HEATSENSOR, 59) x(HEATSENSOR, 59)
x(ACCESSCARD, 60) x(ACCESSCARD, 60)
x(BOOTS, 61) x(BOOTS, 61)
@ -229,7 +229,17 @@ x(GUTMETER_LIGHT1, 920)
x(GUTMETER_LIGHT2, 921) x(GUTMETER_LIGHT2, 921)
x(GUTMETER_LIGHT3, 922) x(GUTMETER_LIGHT3, 922)
x(GUTMETER_LIGHT4, 923) 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(CLOUDYSKIES, 1021)
x(MOONSKY1, 1022) x(MOONSKY1, 1022)
x(MOONSKY2, 1023) x(MOONSKY2, 1023)

View file

@ -1315,7 +1315,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
{ {
if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{ {
p->gotweapon.Set(HANDBOMB_WEAPON); p->gotweapon[HANDBOMB_WEAPON] = true;
j = HANDREMOTE_WEAPON; j = HANDREMOTE_WEAPON;
break; break;
} }

View file

@ -1082,7 +1082,7 @@ void selectweapon_r(int snum, int weap)
{ {
if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{ {
p->gotweapon.Set(DYNAMITE_WEAPON); p->gotweapon[DYNAMITE_WEAPON] = true;
j = THROWINGDYNAMITE_WEAPON; j = THROWINGDYNAMITE_WEAPON;
break; break;
} }
@ -1499,7 +1499,7 @@ void checkweapons_r(struct player_struct* p)
j->s->ang = p->angle.ang.asbuild(); j->s->ang = p->angle.ang.asbuild();
j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
p->OnMotorcycle = 0; p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon[MOTORCYCLE_WEAPON] = false;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
@ -1515,7 +1515,7 @@ void checkweapons_r(struct player_struct* p)
j->s->ang = p->angle.ang.asbuild(); j->s->ang = p->angle.ang.asbuild();
j->saved_ammo = p->ammo_amount[BOAT_WEAPON]; j->saved_ammo = p->ammo_amount[BOAT_WEAPON];
p->OnBoat = 0; p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon[BOAT_WEAPON] = false;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
@ -3132,7 +3132,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic == 3) if (p->kickback_pic == 3)
{ {
p->ammo_amount[POWDERKEG_WEAPON]--; p->ammo_amount[POWDERKEG_WEAPON]--;
p->gotweapon.Clear(POWDERKEG_WEAPON); p->gotweapon[POWDERKEG_WEAPON] = false;
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{ {
k = 15; k = 15;
@ -3176,7 +3176,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic > 40) if (p->kickback_pic > 40)
{ {
p->okickback_pic = p->kickback_pic = 0; p->okickback_pic = p->kickback_pic = 0;
p->gotweapon.Clear(BOWLING_WEAPON); p->gotweapon[BOWLING_WEAPON] = false;
checkavailweapon(p); checkavailweapon(p);
} }
break; break;
@ -4057,7 +4057,7 @@ void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
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[MOTORCYCLE_WEAPON] = true;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
@ -4088,7 +4088,7 @@ void OffMotorcycle(struct player_struct *p)
if (!S_CheckActorSoundPlaying(pact,42)) if (!S_CheckActorSoundPlaying(pact,42))
S_PlayActorSound(42, pact); S_PlayActorSound(42, pact);
p->OnMotorcycle = 0; p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon[MOTORCYCLE_WEAPON] = false;
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
@ -4134,7 +4134,7 @@ void OnBoat(struct player_struct *p, DDukeActor* boat)
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[BOAT_WEAPON] = true;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
@ -4152,7 +4152,7 @@ void OffBoat(struct player_struct *p)
if (p->OnBoat) if (p->OnBoat)
{ {
p->OnBoat = 0; p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon[BOAT_WEAPON] = false;
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);

View file

@ -208,7 +208,7 @@ void resetplayerstats(int snum)
if (p->OnMotorcycle) if (p->OnMotorcycle)
{ {
p->OnMotorcycle = 0; 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->curr_weapon = isRRRA()? SLINGBLADE_WEAPON : KNEE_WEAPON; // just in case this is made available for the other games
} }
p->lotag800kill = 0; p->lotag800kill = 0;
@ -227,7 +227,7 @@ void resetplayerstats(int snum)
if (p->OnBoat) if (p->OnBoat)
{ {
p->OnBoat = 0; 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->curr_weapon = isRRRA()? SLINGBLADE_WEAPON : KNEE_WEAPON; // just in case this is made available for the other games
} }
p->NotOnWater = 0; p->NotOnWater = 0;
@ -272,14 +272,14 @@ void resetweapons(int snum)
p->ammo_amount[weapon] = 0; p->ammo_amount[weapon] = 0;
} }
p->gotweapon.Zero(); memset(p->gotweapon, 0, MAX_WEAPONS);
p->oweapon_pos = p->weapon_pos = 6; p->oweapon_pos = p->weapon_pos = 6;
p->okickback_pic = p->kickback_pic = 5; p->okickback_pic = p->kickback_pic = 5;
p->curr_weapon = PISTOL_WEAPON; p->curr_weapon = PISTOL_WEAPON;
p->gotweapon.Set(PISTOL_WEAPON); p->gotweapon[PISTOL_WEAPON] = true;
p->gotweapon.Set(KNEE_WEAPON); p->gotweapon[KNEE_WEAPON] = true;
p->ammo_amount[PISTOL_WEAPON] = std::min<int16_t>(gs.max_ammo_amount[PISTOL_WEAPON], 48); p->ammo_amount[PISTOL_WEAPON] = std::min<int16_t>(gs.max_ammo_amount[PISTOL_WEAPON], 48);
p->gotweapon.Set(HANDREMOTE_WEAPON); p->gotweapon[HANDREMOTE_WEAPON] = true;
p->last_weapon = -1; p->last_weapon = -1;
p->show_empty_weapon= 0; p->show_empty_weapon= 0;
@ -296,7 +296,7 @@ void resetweapons(int snum)
{ {
chickenphase = 0; chickenphase = 0;
p->ammo_amount[KNEE_WEAPON] = 1; p->ammo_amount[KNEE_WEAPON] = 1;
p->gotweapon.Set(SLINGBLADE_WEAPON); p->gotweapon[SLINGBLADE_WEAPON] = true;
p->ammo_amount[SLINGBLADE_WEAPON] = 1; p->ammo_amount[SLINGBLADE_WEAPON] = 1;
} }
OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1); OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1);
@ -518,7 +518,7 @@ void resetpspritevars(int g)
for (j = 0; j < MAX_WEAPONS; j++) for (j = 0; j < MAX_WEAPONS; j++)
{ {
tsbar[i].ammo_amount[j] = ps[i].ammo_amount[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; tsbar[i].shield_amount = ps[i].shield_amount;
@ -548,7 +548,7 @@ void resetpspritevars(int g)
for (j = 0; j < MAX_WEAPONS; j++) for (j = 0; j < MAX_WEAPONS; j++)
{ {
ps[i].ammo_amount[j] = tsbar[i].ammo_amount[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].shield_amount = tsbar[i].shield_amount;
ps[i].curr_weapon = tsbar[i].curr_weapon; ps[i].curr_weapon = tsbar[i].curr_weapon;
@ -772,22 +772,22 @@ void donewgame(MapRecord* map, int sk)
if (aplWeaponWorksLike[i][0] == PISTOL_WEAPON) if (aplWeaponWorksLike[i][0] == PISTOL_WEAPON)
{ {
p->curr_weapon = i; p->curr_weapon = i;
p->gotweapon.Set(i); p->gotweapon[i] = true;
p->ammo_amount[i] = 48; p->ammo_amount[i] = 48;
} }
else if (aplWeaponWorksLike[i][0] == KNEE_WEAPON || aplWeaponWorksLike[i][0] == HANDREMOTE_WEAPON) else if (aplWeaponWorksLike[i][0] == KNEE_WEAPON || aplWeaponWorksLike[i][0] == HANDREMOTE_WEAPON)
{ {
p->gotweapon.Set(i); p->gotweapon[i] = true;
} }
} }
} }
else else
{ {
p->curr_weapon = PISTOL_WEAPON; p->curr_weapon = PISTOL_WEAPON;
p->gotweapon.Set(PISTOL_WEAPON); p->gotweapon[PISTOL_WEAPON] = true;
p->gotweapon.Set(KNEE_WEAPON); p->gotweapon[KNEE_WEAPON] = true;
p->ammo_amount[PISTOL_WEAPON] = 48; p->ammo_amount[PISTOL_WEAPON] = 48;
p->gotweapon.Set(HANDREMOTE_WEAPON); p->gotweapon[HANDREMOTE_WEAPON] = true;
p->last_weapon = -1; p->last_weapon = -1;
} }
@ -1031,7 +1031,7 @@ void enterlevel(MapRecord *mi, int gamemode)
if (clearweapon) if (clearweapon)
{ {
resetweapons(i); resetweapons(i);
ps[i].gotweapon.Clear(PISTOL_WEAPON); ps[i].gotweapon[PISTOL_WEAPON] = false;
ps[i].ammo_amount[PISTOL_WEAPON] = 0; ps[i].ammo_amount[PISTOL_WEAPON] = 0;
ps[i].curr_weapon = KNEE_WEAPON; ps[i].curr_weapon = KNEE_WEAPON;
ps[i].kickback_pic = 0; ps[i].kickback_pic = 0;

View file

@ -89,7 +89,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("posz", w.posz) ("posz", w.posz)
("angle", w.angle) ("angle", w.angle)
("horizon", w.horizon) ("horizon", w.horizon)
("gotweapon", w.gotweapon) .Array("gotweapon", w.gotweapon, MAX_WEAPONS)
("pals", w.pals) ("pals", w.pals)
("fricx", w.fric.x) ("fricx", w.fric.x)
("fricy", w.fric.y) ("fricy", w.fric.y)

View file

@ -355,15 +355,15 @@ public:
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, 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); 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++) 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 + (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] == '/') if (format[i] == '/')
{ {

View file

@ -123,7 +123,7 @@ public:
// //
// drink // drink
// //
img = tileGetTexture(COLA); img = tileGetTexture(BEER);
imgScale = baseScale / img->GetDisplayHeight(); imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 74, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); DrawGraphic(img, 74, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
format.Format("%d", p->drink_amt); format.Format("%d", p->drink_amt);
@ -132,7 +132,7 @@ public:
// //
// eat // eat
// //
img = tileGetTexture(JETPACK); img = tileGetTexture(COWPIE);
imgScale = baseScale / img->GetDisplayHeight(); imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 133.5, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); DrawGraphic(img, 133.5, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
format.Format("%d", p->eat); format.Format("%d", p->eat);
@ -313,14 +313,14 @@ public:
if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON) 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]); format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]);
} }
else else
{ {
if (p->gotweapon[i+1]) if (p->gotweapon[i+1])
{ {
img = tileGetTexture(AMMO_ICON + i); img = tileGetTexture(AMMO_ICON0 + i);
format.Format("%d", p->ammo_amount[i+1]); format.Format("%d", p->ammo_amount[i+1]);
} }
} }

View file

@ -1120,7 +1120,7 @@ int spawn_r(int j, int pn)
case SHIELD: case SHIELD:
case AIRTANK: case AIRTANK:
case TRIPBOMBSPRITE: case TRIPBOMBSPRITE:
case JETPACK: case COWPIE:
case HOLODUKE: case HOLODUKE:
case FIRSTGUNSPRITE: case FIRSTGUNSPRITE:
@ -1142,7 +1142,7 @@ int spawn_r(int j, int pn)
case BOOTS: case BOOTS:
case AMMO: case AMMO:
case AMMOLOTS: case AMMOLOTS:
case COLA: case BEER:
case FIRSTAID: case FIRSTAID:
case SIXPAK: case SIXPAK:
@ -1224,7 +1224,7 @@ int spawn_r(int j, int pn)
sp->xrepeat = 8; sp->xrepeat = 8;
sp->yrepeat = 8; sp->yrepeat = 8;
break; break;
case COLA: case BEER:
sp->xrepeat = 5; sp->xrepeat = 5;
sp->yrepeat = 4; sp->yrepeat = 4;
break; break;
@ -1242,7 +1242,7 @@ int spawn_r(int j, int pn)
sp->xrepeat = 16; sp->xrepeat = 16;
sp->yrepeat = 16; sp->yrepeat = 16;
break; break;
case JETPACK: case COWPIE:
sp->xrepeat = 8; sp->xrepeat = 8;
sp->yrepeat = 6; sp->yrepeat = 6;
break; break;

View file

@ -8,6 +8,7 @@ extern spritetype sprite_s[];
BEGIN_DUKE_NS BEGIN_DUKE_NS
// all the struct types from JFDuke's duke3d.h // all the struct types from JFDuke's duke3d.h
struct STATUSBARTYPE struct STATUSBARTYPE
@ -18,7 +19,7 @@ struct STATUSBARTYPE
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 bool gotweapon[MAX_WEAPONS];
}; };
struct weaponhit struct weaponhit
@ -171,8 +172,7 @@ struct player_struct
uint16_t frags[MAXPLAYERS]; uint16_t frags[MAXPLAYERS];
// using a bit field for this to save a bit of space. bool gotweapon[MAX_WEAPONS];
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.
PalEntry pals; PalEntry pals;

View file

@ -1924,7 +1924,7 @@ SECT_USERp GetSectUser(short sectnum);
// 1. The variables were unmaintained and could refer to handles that had been reused already. // 1. The variables were unmaintained and could refer to handles that had been reused already.
// 2. No proper sound ownership tracking. // 2. No proper sound ownership tracking.
// 3. In some cases items that were supposed to use the same check referred to different handle variables. // 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. // so that proper checks can be performed and sound ownership be tracked.
enum enum

View file

@ -151,6 +151,7 @@ struct DynArray_String native
native void Append (DynArray_String other); native void Append (DynArray_String other);
native uint Find(String item) const; native uint Find(String item) const;
native uint Push (String item); native uint Push (String item);
native vararg uint PushV(String item, ...);
native bool Pop (); native bool Pop ();
native void Delete (uint index, int deletecount = 1); native void Delete (uint index, int deletecount = 1);
native void Insert (uint index, String item); native void Insert (uint index, String item);