Skip to content

Commit

Permalink
Added support for RPK file format (a single file to contain all game …
Browse files Browse the repository at this point in the history
…data files) and -rpk <filename> command.

Added the ability to specify new sound effects for game events that were different but used to share common sound effects.
Added specification of new / linked sounds via an optional SOUNDLNK.HOV file.
Added the ability to set the erase color (barColor) from the game configuration file (GAME.HOV).
Fixed a bug with the incorrect initialisation of the Drone's target.
Disabled clearing of keyboard state when starting a level.
Added display of enemy statistics to intermission screen (kills / total).
  • Loading branch information
retrozombie committed Oct 25, 2014
1 parent a9e67f9 commit f050536
Show file tree
Hide file tree
Showing 14 changed files with 1,974 additions and 57 deletions.
138 changes: 112 additions & 26 deletions src/hovertank3D/HovActs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ private void SpawnPlayer(fixed_t gx, fixed_t gy)
*/
private void GetRefugee(objtype hit)
{
PlaySound(SAVEHOSTAGESND);
// as: Support for extra sound effects
if(hit.temp1 == MAN1PIC)
PlaySound(SAVEHOSTAGESND);
else
PlaySound(SNDEX_SAVHOSTAGE2); // SAVEHOSTAGESND

hit._class = classtype.nothing;

Expand All @@ -130,7 +134,12 @@ private void GetRefugee(objtype hit)
savedcount++;
if(--numrefugees == 0)
{
PlaySound(LASTHOSTAGESND);
// as: Support for extra sound effects
if(hit.temp1 == MAN1PIC)
PlaySound(LASTHOSTAGESND);
else
PlaySound(SNDEX_LSTHOSTAGE2); // LASTHOSTAGESND

SpawnWarp(warpx, warpy);
}
}
Expand Down Expand Up @@ -178,11 +187,16 @@ private void CheckFire()
DrawPic(14, 40, REARMINGPIC);
guncount = 0;

SpawnShot(obon.x, obon.y, obon.angle, (classtype)
(classtype.pshotobj + (short) (gunstate - gunstates.charging)));
classtype shotType = (classtype) (classtype.pshotobj + (short) (gunstate - gunstates.charging));
SpawnShot(obon.x, obon.y, obon.angle, shotType);

gunstate = gunstates.rearming;
PlaySound(FIRESND);

// as: Support for extra sound effects
if(shotType == classtype.pshotobj)
PlaySound(FIRESND);
else
PlaySound(SNDEX_FIRE2);
}
}

Expand All @@ -193,9 +207,10 @@ private void CheckFire()
=
===================
*/
private void DamagePlayer()
private void DamagePlayer(ushort sound)
{
PlaySound(TAKEDAMAGESND);
// as: Support for extra sound effects
PlaySound(sound); // TAKEDAMAGESND

if(godmode == 0 && --objlist[0].hitpoints == 0)
{
Expand All @@ -216,9 +231,10 @@ private void DamagePlayer()
bordertime = 60;
}

private void HealPlayer()
private void HealPlayer(ushort sound)
{
PlaySound(ARMORUPSND);
// as: Support for extra sound effects
PlaySound(sound); // ARMORUPSND

if(objlist[0].hitpoints < 3)
objlist[0].hitpoints++;
Expand Down Expand Up @@ -366,7 +382,8 @@ private void PlayerThink()
case classtype.shieldobj:
obon.CopyTo(objlist[0]);

HealPlayer();
// as: Support for extra sound effects
HealPlayer(SNDEX_SHIELDUP); // ARMORUPSND

objlist[0].CopyTo(obon);

Expand Down Expand Up @@ -459,7 +476,15 @@ private void SpawnShot(fixed_t gx, fixed_t gy, short angle, classtype _class)
*/
private void ExplodeShot()
{
PlaySound(SHOOTWALLSND);
// as: Support for extra sound effects
ushort sound = SNDEX_TSHOTWALL;
if(obon._class == classtype.pshotobj)
sound = SNDEX_PSHOTWALL;
else if(obon._class == classtype.pbigshotobj)
sound = SNDEX_PSHOTWALL2;

PlaySound(sound); // SHOOTWALLSND

obon._class = classtype.inertobj;
obon.shapenum = obon.temp1 = SHOTDIE1PIC;
obon.think = ExplodeThink;
Expand Down Expand Up @@ -592,14 +617,16 @@ private void ShotThink()
case classtype.playerobj:
if(obon._class == classtype.mshotobj)
{
DamagePlayer();
// as: Support for extra sound effects
DamagePlayer(SNDEX_TANKDAMAGE);
obon._class = classtype.nothing;
return;
}
break;

case classtype.refugeeobj:
KillRefugee(check);
// as: Support for extra sound effects
KillRefugee(check, obon._class != classtype.mshotobj);

if(obon._class == classtype.pbigshotobj)
break;
Expand Down Expand Up @@ -794,9 +821,23 @@ private void SpawnRefugee(fixed_t gx, fixed_t gy, bool sex)
=
===================
*/
private void KillRefugee(objtype hit)
private void KillRefugee(objtype hit, bool player)
{
PlaySound(HOSTAGEDEADSND);
// as: Support for extra sound effects
ushort sound = HOSTAGEDEADSND;
if(player)
{
if(hit.temp1 == MAN1PIC)
sound = SNDEX_HSTAGEDEAD3;
else
sound = SNDEX_HSTAGEDEAD4;
}
else
{
if(hit.temp1 != MAN1PIC)
sound = SNDEX_HSTAGEDEAD2;
}
PlaySound(sound); // HOSTAGEDEADSND

if(hit.radarx != 0)
XPlot(hit.radarx, hit.radary, hit.radarcolor);
Expand All @@ -806,7 +847,23 @@ private void KillRefugee(objtype hit)
DrawPic((ushort) (2 * (totalrefugees - killedcount) + 1), 6, DEADGUYPIC);
if(--numrefugees == 0)
{
PlaySound(WARPGATESND);
// as: Support for extra sound effects
if(player)
{
if(hit.temp1 == MAN1PIC)
sound = SNDEX_LASTDEAD3;
else
sound = SNDEX_LASTDEAD4;
}
else
{
if(hit.temp1 == MAN1PIC)
sound = SNDEX_LASTDEAD1;
else
sound = SNDEX_LASTDEAD2;
}
PlaySound(sound); // WARPGATESND

SpawnWarp(warpx, warpy);
}

Expand Down Expand Up @@ -868,7 +925,10 @@ private void RefugeeThink()
*/
private void SpawnDrone(fixed_t gx, fixed_t gy)
{
FindFreeObj();
// as: Enemy stats
totalEnemies++;

short newIndex = FindFreeObj();
_new.x = gx;
_new.y = gy;
_new.angle = 0;
Expand All @@ -879,7 +939,7 @@ private void SpawnDrone(fixed_t gx, fixed_t gy)
_new.hitpoints = 2;
_new.shapenum = DRONE1PIC;
_new.ticcount = (short) Rnd(DRONEANM * 3);
_new.temp1 = (short) 0; // will hunt first think
_new.temp1 = newIndex; // will hunt first think
CalcBoundsNew();
}

Expand All @@ -892,7 +952,11 @@ private void SpawnDrone(fixed_t gx, fixed_t gy)
*/
private void KillDrone(objtype hit)
{
PlaySound(SHOOTTHINGSND);
// as: Enemy stats
enemiesKilled++;

// as: Support for extra sound effects
PlaySound(SNDEX_DRONEDIE); // SHOOTTHINGSND

if(hit.radarx != 0)
XPlot(hit.radarx, hit.radary, hit.radarcolor);
Expand Down Expand Up @@ -969,13 +1033,18 @@ private void DroneThink()
switch(check._class)
{
case classtype.playerobj: // kill player and blow up
DamagePlayer();
// as: Support for extra sound effects
DamagePlayer(SNDEX_DRONEDAMAGE);

PlaySound(SHOOTTHINGSND);
// as: Support for extra sound effects
PlaySound(SNDEX_DRONEDIE); // SHOOTTHINGSND

if(obon.radarx != 0)
XPlot(obon.radarx, obon.radary, obon.radarcolor);

// as: Enemy stats
enemiesKilled++;

obon.radarcolor = 0;
obon._class = classtype.inertobj;
obon.shapenum = obon.temp1 = DRONEDIE1PIC;
Expand All @@ -984,7 +1053,8 @@ private void DroneThink()
return;

case classtype.refugeeobj:
KillRefugee(check);
// as: Support for extra sound effects
KillRefugee(check, false);
break;
}
}
Expand All @@ -1008,6 +1078,9 @@ private void DroneThink()
*/
private void SpawnTank(fixed_t gx, fixed_t gy)
{
// as: Enemy stats
totalEnemies++;

FindFreeObj();
_new.x = gx;
_new.y = gy;
Expand All @@ -1030,7 +1103,11 @@ private void SpawnTank(fixed_t gx, fixed_t gy)
*/
private void KillTank(objtype hit)
{
PlaySound(SHOOTTHINGSND);
// as: Enemy stats
enemiesKilled++;

// as: Support for extra sound effects
PlaySound(SNDEX_TANKDIE); // SHOOTTHINGSND

if(hit.radarx != 0)
XPlot(hit.radarx, hit.radary, hit.radarcolor);
Expand Down Expand Up @@ -1146,7 +1223,8 @@ private void AimAtPlayer()
goto cantshoot; // shot is blocked
}

PlaySound(FIRESND);
// as: Support for extra sound effects
PlaySound(SNDEX_TANKFIRE); // FIRESND
SpawnShot(obon.x, obon.y, obon.angle, classtype.mshotobj);
obon.ticcount = 0;
obon.stage = 1;
Expand Down Expand Up @@ -1240,6 +1318,9 @@ private void TankThink()
*/
private void SpawnMutant(fixed_t gx, fixed_t gy)
{
// as: Enemy stats
totalEnemies++;

FindFreeObj();
_new.x = gx;
_new.y = gy;
Expand All @@ -1263,7 +1344,11 @@ private void SpawnMutant(fixed_t gx, fixed_t gy)
*/
private void KillMutant(objtype hit)
{
PlaySound(SHOOTTHINGSND);
// as: Enemy stats
enemiesKilled++;

// as: Support for extra sound effects
PlaySound(SNDEX_MUTEDIE); // SHOOTTHINGSND

if(hit.radarx != 0)
XPlot(hit.radarx, hit.radary, hit.radarcolor);
Expand Down Expand Up @@ -1509,7 +1594,8 @@ private void MutantThink()
obon.stage = 4;
obon.ticcount = 0;
obon.shapenum = MUTANTHITPIC;
DamagePlayer();
// as: Support for extra sound effects
DamagePlayer(SNDEX_MUTEDAMAGE);
}
else
{
Expand Down
28 changes: 25 additions & 3 deletions src/hovertank3D/HovLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ private void HovLoopInitialise()

private short killedcount;

// as: Enemy stats
private short enemiesKilled;

// as: Enemy stats
private short totalEnemies;

private short bordertime;

//
Expand Down Expand Up @@ -156,7 +162,7 @@ private void BadThink()
=
===============
*/
private void FindFreeObj()
private short FindFreeObj()
{
short newIndex = 1;
while(objlist[newIndex]._class != classtype.nothing && newIndex <= lastobjIndex)
Expand All @@ -175,6 +181,9 @@ private void FindFreeObj()
_new.Clear();

_new.think = BadThink;

// as: Return the index of the object that was found
return newIndex;
}

//==========================================================================
Expand All @@ -190,6 +199,10 @@ private void StartLevel(memptr plane1)
{
numrefugees = 0;

// as: Enemy stats
enemiesKilled = 0;
totalEnemies = 0;

for(ushort y = 0; y < levelheader.height; y++)
{
for(ushort x = 0; x < levelheader.width; x++)
Expand Down Expand Up @@ -773,6 +786,14 @@ private void BaseScreen()
PPrintInt(savedcount);
PPrint(_strings[Strings.BaseScreen3]); // as: string replacements
PPrintInt(killedcount);

// as: Enemy stats
py += 5;
PPrint(_strings[Strings.BaseScreen9]); // as: string replacements
PPrintInt(enemiesKilled);
PPrint(_strings[Strings.BaseScreen10]); // as: string replacements
PPrintInt(totalEnemies);

ushort topofs = screenofs;

py += 5;
Expand Down Expand Up @@ -848,7 +869,7 @@ private void BaseScreen()
{
score -= 10000;
DrawScore();
HealPlayer();
HealPlayer(ARMORUPSND);
#if !PROFILE
if(NBKascii != 27)
{
Expand Down Expand Up @@ -971,7 +992,8 @@ private void PlayLoop()

if(keydown[0x57]) // DEBUG!
{
DamagePlayer();
// as: Support for extra sound effects
DamagePlayer(TAKEDAMAGESND);
ClearKeys();
}

Expand Down
Loading

0 comments on commit f050536

Please sign in to comment.