mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Proper event system. Improved sounds. Temporary hard-coded events
This commit is contained in:
Binary file not shown.
+70
-22
@@ -83,9 +83,9 @@ struct SmartTile_s SmartTiles[SMARTTILES];
|
|||||||
|
|
||||||
struct EventAction_s {
|
struct EventAction_s {
|
||||||
int Event;
|
int Event;
|
||||||
unsigned char Action; //0=change tile / 1=change area / sound
|
unsigned char Action; //0=change tile / 1=change area / 2=sound / 3=rearm
|
||||||
unsigned char ActionValue; //tile sprite no. / area ID / sound ID
|
unsigned char ActionValue; //tile sprite no. / area ID / sound ID / na
|
||||||
int ActionTarget; //tile ID / n/a / channel ID
|
int ActionTarget; //tile ID / n/a / channel ID / eventid
|
||||||
};
|
};
|
||||||
struct EventAction_s EventActions[MAXEVENTACTIONS];
|
struct EventAction_s EventActions[MAXEVENTACTIONS];
|
||||||
|
|
||||||
@@ -116,20 +116,72 @@ void game2_loadevents()
|
|||||||
EventActions[i].ActionTarget = -1;
|
EventActions[i].ActionTarget = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(Events[0].Name,"SetArea");
|
i=0;
|
||||||
Events[0].Triggered = 0;
|
|
||||||
Events[0].RearmDelay = 500;
|
|
||||||
Events[0].NextRearm = -1;
|
|
||||||
|
|
||||||
EventActions[0].Event = 0;
|
sprintf(Events[i].Name,"PlayerStart");
|
||||||
EventActions[0].Action = 1;
|
Events[i].Triggered = 0;
|
||||||
EventActions[0].ActionValue = 1;
|
Events[i].RearmDelay = -1;
|
||||||
EventActions[0].ActionTarget = -1;
|
Events[i].NextRearm = -1;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
sprintf(Events[i].Name,"SBBR-DOOROPEN");
|
||||||
|
Events[i].Triggered = 0;
|
||||||
|
Events[i].RearmDelay = -1;
|
||||||
|
Events[i].NextRearm = -1;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
sprintf(Events[i].Name,"SBBR-DOORCLOSE");
|
||||||
|
Events[i].Triggered = 1;
|
||||||
|
Events[i].RearmDelay = -1;
|
||||||
|
Events[i].NextRearm = -1;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
|
||||||
|
// PlayerStart
|
||||||
|
EventActions[i].Event = 0;
|
||||||
|
EventActions[i].Action = 1;
|
||||||
|
EventActions[i].ActionValue = 1;
|
||||||
|
EventActions[i].ActionTarget = -1;
|
||||||
|
i++;
|
||||||
|
EventActions[i].Event = 0;
|
||||||
|
EventActions[i].Action = 2;
|
||||||
|
EventActions[i].ActionValue = PCMSAMPLE_HAIL;
|
||||||
|
EventActions[i].ActionTarget = PCMCHANNEL_AMBIENT;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
// SBBR-DOOROPEN
|
||||||
|
EventActions[i].Event = 1;
|
||||||
|
EventActions[i].Action = 0;
|
||||||
|
EventActions[i].ActionValue = 31;
|
||||||
|
EventActions[i].ActionTarget = 713;
|
||||||
|
i++;
|
||||||
|
EventActions[i].Event = 1;
|
||||||
|
EventActions[i].Action = 2;
|
||||||
|
EventActions[i].ActionValue = PCMSAMPLE_DOOR;
|
||||||
|
EventActions[i].ActionTarget = PCMCHANNEL_AMBIENT;
|
||||||
|
i++;
|
||||||
|
EventActions[i].Event = 1;
|
||||||
|
EventActions[i].Action = 3;
|
||||||
|
EventActions[i].ActionTarget = 2;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
// SBBR-DOORCLOSE
|
||||||
|
EventActions[i].Event = 2;
|
||||||
|
EventActions[i].Action = 0;
|
||||||
|
EventActions[i].ActionValue = 29;
|
||||||
|
EventActions[i].ActionTarget = 713;
|
||||||
|
i++;
|
||||||
|
EventActions[i].Event = 2;
|
||||||
|
EventActions[i].Action = 2;
|
||||||
|
EventActions[i].ActionValue = PCMSAMPLE_DOOR;
|
||||||
|
EventActions[i].ActionTarget = PCMCHANNEL_AMBIENT;
|
||||||
|
i++;
|
||||||
|
EventActions[i].Event = 2;
|
||||||
|
EventActions[i].Action = 3;
|
||||||
|
EventActions[i].ActionTarget = 1;
|
||||||
|
i++;
|
||||||
|
|
||||||
EventActions[1].Event = 0;
|
|
||||||
EventActions[1].Action = 2;
|
|
||||||
EventActions[1].ActionValue = PCMSAMPLE_DOOR;
|
|
||||||
EventActions[1].ActionTarget = PCMCHANNEL_AMBIENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void game2_loadsmarttiles(char* filename)
|
void game2_loadsmarttiles(char* filename)
|
||||||
@@ -528,14 +580,10 @@ void game2_triggerevent(int id)
|
|||||||
|
|
||||||
// Don't trigger if we've been fired and not reset
|
// Don't trigger if we've been fired and not reset
|
||||||
if(Events[id].Triggered == 1)
|
if(Events[id].Triggered == 1)
|
||||||
{
|
|
||||||
printf("Not triggering event %d - %s\n",id,Events[id].Name);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Record firing
|
// Record firing
|
||||||
Events[id].Triggered = 1;
|
Events[id].Triggered = 1;
|
||||||
printf("Triggering event %d - %s\n",id,Events[id].Name);
|
|
||||||
|
|
||||||
// Schedule re-arm if required
|
// Schedule re-arm if required
|
||||||
if(Events[id].RearmDelay >= 0)
|
if(Events[id].RearmDelay >= 0)
|
||||||
@@ -552,6 +600,8 @@ void game2_triggerevent(int id)
|
|||||||
sprintf(areaname,"%s",Areas[EventActions[i].ActionValue].name);
|
sprintf(areaname,"%s",Areas[EventActions[i].ActionValue].name);
|
||||||
else if(EventActions[i].Action == 2) // Play sound
|
else if(EventActions[i].Action == 2) // Play sound
|
||||||
sound_pcm_playsample_ifidle(EventActions[i].ActionTarget,EventActions[i].ActionValue);
|
sound_pcm_playsample_ifidle(EventActions[i].ActionTarget,EventActions[i].ActionValue);
|
||||||
|
else if(EventActions[i].Action == 3) // Re-arm
|
||||||
|
Events[EventActions[i].ActionTarget].Triggered = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -637,13 +687,11 @@ int game2_tick()
|
|||||||
fullmap[SmartTiles[i].ActionTarget] = SmartTiles[i].ActionValue;
|
fullmap[SmartTiles[i].ActionTarget] = SmartTiles[i].ActionValue;
|
||||||
else if(SmartTiles[i].Action == 1) // Change area name
|
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);
|
||||||
else if(SmartTiles[i].Action == 2) // Change area name
|
else if(SmartTiles[i].Action == 2) // Trigger event
|
||||||
{
|
|
||||||
game2_triggerevent(SmartTiles[i].ActionValue);
|
game2_triggerevent(SmartTiles[i].ActionValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
game2_tick_input();
|
game2_tick_input();
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1,2 @@
|
|||||||
€€€€€€€€��€€�€~†…€`”�|†}†|•|}{‰~~�w‡pŠ€‡�|~}�{~�{x…|�„|€~~„~~€{�{�‚}�‚~‚|�~€~�€�~�~�€€€~€~€~€~€€€€€�€€€€€€€€€€��€~�€�€€~€~€€€€€€€€€€€€€€€~€€€€€€€€€�€~€€€€€€€€€€€€€€€€€€€€€€€�€€€€~€€€€€€~€€€€€~€€€€€€€€€€€~��€€€€€€€�€~€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€�€€€€�~�}‚}‚|�|�|„{„|�|‚‚|‡mĄPšn�s‚…kšbťe›k“u‡�{ŠtŽrŽrŚu�{�}‚|�y…{‚€~‚€|„~}‚€}�…y‚�~}…~{†z€„y‚…€y…‚x~„x…†{†�x€…yy��zy�{{‰|…‚†vŚ~‹tŽ}ŠwŠ„�‚}ŽwŽršl–lťl•rŹ�{�h§Z§R§]“r�€oŽg”f“eŤk—sŽzv�j}yŠk“f…€…�…~‡uŤ}Ťu‡u„}|~…x~z‚x‰x…{„}€€‚|�|�€}�~~€~�~€}‚|…x‰w‡v‰uŠ{„‚~Šv“o�mšl™o�}~‘k�g–i—i‰x€z�‚x�wŠpŹrŤx…}}‡w‰{„}��w†y�|‚y�|…wŠx‡~�~€‚{‡uŠw†z…|�~�z‚|�|�|�|�€~�}��}‚|‚€~�}‚y†z�{�}‚|„}‚~‚€€~€€€}�|�~��|�~�~�}�€€~€€~�~€~‚}�~�~€~�~‚}�~€€�~‚~�~€€�~€�€����~€€�~‚~�~€�~�~€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€�€€€€€€€€€€€€~€€€€€€€€€€€€�~€~…€�€~}|�€��€�~~~�€€€�~�|‚„€�}~€‚‚†€}}‰€v‚|~’���}„wvŚ��Śx~z„�~€‚~~~‚�}~~�‚}}���}}�€}Śu‚zs„x……‚†�z~{‚€‚€€€~€�€€€€�~€€€€€€€€€€€€€€~€€‚�~�‚€€~�}‚~€€€�~‚}‚}‚}�~�€€|�q‰y„|†{€€}�{„y…x†|�}~{�€�‚}}‚~�{~……{|~�…‚€‚~‚w…{~�}��z€€„€~€{…~}�~€~�}�„}€„{€}�€}�€|€�|~~�~€„}‚�‚{‚€€~€€�|‚|�{…y…w‡y…z�€�z�v‰z�y‡z�€€€€€}�}�€�€�€�}�|‚~‚}‚~‚~‚~�~�~�~�}‚}‚€~‚}�~�~€~€�~‚}‚~�~�~�~‚}�}�~€�€€~‚~�}„|…|…}…}„~‚�~†z�{„|†z…€�€�€€‚|„{„z…z�}€~‚{�|�|�}�~�~€€~‚�~‚~‚}‚€€€€€�~‚~�€�€€~�~€€~�~€€€€‚~�~����~�~�~€€~�~�€€€€€€€€€€€€€€€€€€€€€€€€~�~€€€€€�€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
|
€~�~€~��€€��‚~���{�s“‹š'Ëaźpšpµ—kxŠ“h•^’e_¦�Ž”w{w�xx`‰�w”y|�~}}{�‡s‡p‚w~‚‚{…vŠy‡z~„z|‚~~~~|€„{†~��{‚|�~�{€~}�z‚~‚}‚|�€}€~�~�}‚‚}€}�}€‚~„€�‚{„{�€‚{�‚~€z‚|�€~€�€}€~�~��€~��€~�€€~�|€~{�~€}€}~{�€€‚~‚}‚z€€€~‚€€~€€€}‚~�~‚~~�}~€€€�|�€~}�~�€‚~�~~�}€|‚�~�~�}~€€€�€€~�{€€€�}��€�€€��€€~€y„~�‚~�~�€€€€€€~€~€~�€}€|‚|€~~€€€€€~�€�€�€€�€€€�~�~€�€~�~�~€€€€~�~��€€�€€€�€€‚€€���€��€~€}€�€€€€~�}�~���€��~���€€~�~‚|�z…y†x†w…y…y„z‚|�€}…wŚn—cŁU¸,ë1nŞ6ˇ6Ţç)żXť�t§RŔDÁIµY˘iŚ{y�j•h’l‘l‹{{�{}€�t�…r‡�}z•s{Š{x‡Šgކqt’rz‘‰n‚•jsŠ�i€›zu�’qr”ve‡ycŤŽpsŠ�d—}ˇ`š�ťoŚ™„Śo¸c«TÇX·NÇaŁmžŹq°Lçű˙Ó6—‰FÂ"Ö
|
||||||
|
ŘĂ:©N‚eŹšjµ/®1~U°AŁa[ˇwśy�a«W˘ˇu�{m–i…gźi~hŽf–w€„}‹pŤrŹsŠx}‡w„‚y�z†q�u‡rŤo•j“u…v„€tź`±TÂJÇOşbŞy‹ś\Ď-đ"Ô?®Z›x\ťU”[ŞOžTŞP o‡Žn�]§b”�€�s—e‰|w�j•e‹q“i’}}“u�kšb `–w‚‚|‰rŤl—l�v„w‚u…|{†z‚{{„z€��|‚}z�u�t‹qŚmŚz~~z‰n‘oŤ{…‚…|„|€}‚z†v‰{�…y‡vŚs�‚}‚|}„~~|‡x…|�|†|€}�w‡x†z„z€�z‡{†y†}��|„{…}~�€|�~…}…€���{…{†z�€€|�{…|‚}€}�‚~��~€��€~€~�€€€~�}�€€€€�€€{€~~�~€€€}�€€€~€€~~€€�~~�€€€}€€~�‚~€~€€~€€�~‚‚€€€‚��~€~€€~~€�}}‚€�‚}~€�€~€~�}€~�~€~„}�|�z„vŤ…“�w~q}|���…€„~}~v‚‚�€�}†}‚x}“�Šv‚}„‚€•†{r’’c{�i°š}”u‹wU–śs©zn„k…Ž}{~}��y|�Ś}vz�‰‚x}z…‰…z€wz|‹nĄxm‰L‰p~™†“‹}�qvvv�€…�‚}}}€~��€~€~~€~�~��z€€}�~��~€}~~~€€��€~€�}‚~‚}€}�}~{�~‰~�~y��‚„{…x…x�~|‚‚}†z…}��{†zŠs“eˇZ�‚{…‹k–h–j’lŤq‡„~„sw~Ś}“r…r‰yŚv{zŽ‚‹€n{„†„“xŹwŽh…‚mŚ{~Žut�†‹wz‡p†�r‡„y€|�}}Ź}x�xz~y‰r�‡yxŽv{w�€€~ŚŤ‡y|Š{„w‰|ŠmŚqŤp�r�r…�y�n›ižaˇe“xŽz„…v“vŠwŠq�w„~†}†~ŠuŚx�~„~�€��~�{„uŚv‡z†u‡{‚�€{„}€~€{�z†y‰vŠx�~‚}�~‚}�}€~~�{…}„yŠuŤwŽvŚyŠ}‡‚�‡}Žr�kťk”y�{‰}}Źx�{‹w‰|‰vŽqŤtŠv‡}y‰sŠqŹn‹w†y‚�|�~‚x‰w‰|…{†{„~…|„|…|„|�z„~����€}‚|„z�}€}‚|‚~‚~�‚{„{…}���~„{…|„|�}€�|�|�|�{„}€€~€}‚|‚~€�~€€�€�€�€€�€�}„}‚~‚~�~�~�}‚{�|‚~€~€~�}�~‚~‚€€€�~‚}‚���€�€~�€€€~~€€€�~�~�€�~�~�}‚}�~�~€€€~�~‚~�~�~�€€€�€~
|
||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user