Don't repeatedly fire actions. Load some sounds for mission2.

This commit is contained in:
stevenhowes
2021-05-29 19:58:48 +01:00
parent 02bb01b3da
commit 0a431ecc82
5 changed files with 29 additions and 18 deletions
Binary file not shown.
+5 -8
View File
@@ -40,18 +40,14 @@ Squeezeflags = -o $@
# Dynamic dependencies: # Dynamic dependencies:
o.Graphics: c.Graphics
o.Graphics: C:h.swis
o.Graphics: C:h.kernel
o.Graphics: C:h.kernel
o.Input: c.Input o.Input: c.Input
o.Input: C:h.swis o.Input: C:h.swis
o.Input: C:h.kernel o.Input: C:h.kernel
o.Input: C:h.kernel o.Input: C:h.kernel
o.Graphics: c.Graphics
o.Graphics: C:h.swis
o.Graphics: C:h.kernel
o.Graphics: C:h.kernel
o.Graphics: c.Graphics
o.Graphics: C:h.swis
o.Graphics: C:h.kernel
o.Graphics: C:h.kernel
o.CTheEscape: c.CTheEscape o.CTheEscape: c.CTheEscape
o.CTheEscape: C:h.swis o.CTheEscape: C:h.swis
o.CTheEscape: C:h.kernel o.CTheEscape: C:h.kernel
@@ -82,3 +78,4 @@ o.Mission2: h.Graphics
o.Mission2: C:h.swis o.Mission2: C:h.swis
o.Mission2: C:h.kernel o.Mission2: C:h.kernel
o.Mission2: C:h.kernel o.Mission2: C:h.kernel
o.Mission2: h.Sound
+17 -4
View File
@@ -1,6 +1,7 @@
#include "Graphics.h" #include "Graphics.h"
#include "swis.h" #include "swis.h"
#include <kernel.h> #include <kernel.h>
#include "Sound.h"
extern int tick; extern int tick;
extern int lasttick; extern int lasttick;
@@ -53,6 +54,8 @@ struct TilePlayer_s {
struct EntityLocation_s lastmapoffset; struct EntityLocation_s lastmapoffset;
struct EntityLocation_s localtile; struct EntityLocation_s localtile;
int rawtile; int rawtile;
int lastrawtile;
unsigned char direction; unsigned char direction;
unsigned char facedirection; unsigned char facedirection;
unsigned char sprite[13]; unsigned char sprite[13];
@@ -231,6 +234,12 @@ void game2_fillmap(int xoffset, int yoffset)
memcpy(map[0][9],fullmap+yoffset+(xoffset*100)+900,10); memcpy(map[0][9],fullmap+yoffset+(xoffset*100)+900,10);
} }
void game2_setup_audio()
{
sound_pcm_loadsample(PCMSAMPLE_HAIL,"sounds.commbdg");
sound_pcm_loadsample(PCMSAMPLE_DOOR,"sounds.door");
}
void game2_setup() void game2_setup()
{ {
screen_flipbuffer(); screen_flipbuffer();
@@ -256,7 +265,7 @@ void game2_setup()
TilePlayer.animframe = 0; TilePlayer.animframe = 0;
TilePlayer.nextanimframe = 0; TilePlayer.nextanimframe = 0;
TilePlayer.nextanimidle = 0; TilePlayer.nextanimidle = 0;
TilePlayer.lastrawtile = -1;
memset(map[0],0xFF,100); memset(map[0],0xFF,100);
memset(map[1],0xFF,100); memset(map[1],0xFF,100);
memset(map[2],0xFF,100); memset(map[2],0xFF,100);
@@ -264,6 +273,7 @@ void game2_setup()
game2_loadmap("m2_map"); game2_loadmap("m2_map");
game2_loadsmarttiles("m2_smart"); game2_loadsmarttiles("m2_smart");
game2_loadareanames("m2_areas"); game2_loadareanames("m2_areas");
game2_setup_audio();
game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y); game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y);
} }
@@ -509,20 +519,23 @@ int game2_tick()
} }
} }
TilePlayer.lastrawtile = TilePlayer.rawtile;
TilePlayer.rawtile = (TilePlayer.mapoffset.Y) + TilePlayer.localtile.Y + (TilePlayer.mapoffset.X * 100) + (TilePlayer.localtile.X * 100); TilePlayer.rawtile = (TilePlayer.mapoffset.Y) + TilePlayer.localtile.Y + (TilePlayer.mapoffset.X * 100) + (TilePlayer.localtile.X * 100);
if(TilePlayer.rawtile != TilePlayer.lastrawtile)
{
// Trigger any smart tiles for our centre of mass // Trigger any smart tiles for our centre of mass
for(i = 0; i < SMARTTILES; i++) for(i = 0; i < SMARTTILES; i++)
{ {
if(SmartTiles[i].Tile == TilePlayer.rawtile) if(SmartTiles[i].Tile == TilePlayer.rawtile)
{ {
// Change tile sprite if(SmartTiles[i].Action == 0) // Change tile sprite
if(SmartTiles[i].Action == 0)
fullmap[SmartTiles[i].ActionTarget] = SmartTiles[i].ActionValue; fullmap[SmartTiles[i].ActionTarget] = SmartTiles[i].ActionValue;
else if(SmartTiles[i].Action == 1) else if(SmartTiles[i].Action == 1) // Change area name
sprintf(areaname,"%s",Areas[SmartTiles[i].ActionValue].name); sprintf(areaname,"%s",Areas[SmartTiles[i].ActionValue].name);
} }
} }
}
game2_tick_input(); game2_tick_input();
+1 -1
View File
@@ -44,7 +44,7 @@ enum pcmchannel_e{
PCMCHANNEL_NPC2 = 7, PCMCHANNEL_NPC2 = 7,
PCMCHANNEL_AMBIENT = 8 PCMCHANNEL_AMBIENT = 8
}; };
enum pcmsample_e{PCMSAMPLE_DURNOTORPEDO, PCMSAMPLE_PHASER, PCMSAMPLE_SHIPEXPLODE, PCMSAMPLE_TRACTOR, PCMSAMPLE_HAIL, PCMSAMPLE_MAX}; enum pcmsample_e{PCMSAMPLE_DURNOTORPEDO, PCMSAMPLE_PHASER, PCMSAMPLE_SHIPEXPLODE, PCMSAMPLE_TRACTOR, PCMSAMPLE_HAIL, PCMSAMPLE_DOOR, PCMSAMPLE_MAX};
struct CompositionElement { struct CompositionElement {
signed short int Start; signed short int Start;
File diff suppressed because one or more lines are too long