diff --git a/!TheEsc/!RunImage,ff8 b/!TheEsc/!RunImage,ff8 index d79afeb..c40d509 100644 Binary files a/!TheEsc/!RunImage,ff8 and b/!TheEsc/!RunImage,ff8 differ diff --git a/!TheEsc/Makefile,fe1 b/!TheEsc/Makefile,fe1 index 7302849..e881ed6 100644 --- a/!TheEsc/Makefile,fe1 +++ b/!TheEsc/Makefile,fe1 @@ -48,8 +48,6 @@ o.Input: c.Input o.Input: C:h.swis o.Input: C:h.kernel o.Input: C:h.kernel -o.Intro: c.Intro -o.Intro: h.Graphics o.CTheEscape: c.CTheEscape o.CTheEscape: C:h.swis o.CTheEscape: C:h.kernel @@ -61,6 +59,8 @@ o.Sound: C:h.swis o.Sound: C:h.kernel o.Sound: C:h.kernel o.Sound: h.Sound +o.Intro: c.Intro +o.Intro: h.Graphics o.Mission1: c.Mission1 o.Mission1: h.Graphics o.Mission1: h.Sound diff --git a/!TheEsc/Tools,fe1 b/!TheEsc/Tools,fe1 index 17accbe..b835451 100644 --- a/!TheEsc/Tools,fe1 +++ b/!TheEsc/Tools,fe1 @@ -51,17 +51,23 @@ o.Mission2: h.Graphics o.Mission2: C:h.swis o.Mission2: C:h.kernel o.Mission2: C:h.kernel -o.Input: c.Input -o.Input: C:h.swis -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.MapEdit: c.MapEdit o.MapEdit: C:h.swis o.MapEdit: C:h.kernel o.MapEdit: C:h.kernel o.MapEdit: h.Sound o.MapEdit: h.Graphics +o.MapEdit: c.MapEdit +o.MapEdit: C:h.swis +o.MapEdit: C:h.kernel +o.MapEdit: C:h.kernel +o.MapEdit: h.Sound +o.MapEdit: h.Graphics +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:h.swis +o.Input: C:h.kernel +o.Input: C:h.kernel diff --git a/!TheEsc/c/CTheEscape b/!TheEsc/c/CTheEscape index 7aa507b..4c4e426 100644 --- a/!TheEsc/c/CTheEscape +++ b/!TheEsc/c/CTheEscape @@ -5,8 +5,8 @@ #include "Sound.h" #include "Graphics.h" -//#define SKIP_INTRO -//#define SKIP_MISSION1 +#define SKIP_INTRO +#define SKIP_MISSION1 //#define SKIP_MISSION2 // SWI Registers diff --git a/!TheEsc/c/Mission2 b/!TheEsc/c/Mission2 index a34f05f..3b1be0b 100644 --- a/!TheEsc/c/Mission2 +++ b/!TheEsc/c/Mission2 @@ -83,9 +83,9 @@ struct SmartTile_s SmartTiles[SMARTTILES]; struct EventAction_s { int Event; - unsigned char Action; //0=change tile / 1=change area / 2=sound / 3=rearm - unsigned char ActionValue; //tile sprite no. / area ID / sound ID / na - int ActionTarget; //tile ID / n/a / channel ID / eventid + unsigned char Action; //0=change tile / 1=change area / 2=sound / 3=rearm / 4=schedule + unsigned char ActionValue; //tile sprite no. / area ID / sound ID / na / eventid + int ActionTarget; //tile ID / n/a / channel ID / eventid / ticks }; struct EventAction_s EventActions[MAXEVENTACTIONS]; @@ -97,6 +97,13 @@ struct Event_s { }; struct Event_s Events[MAXEVENTS]; +struct ScheduledEvent_s { + int Event; + int Ticks; +}; +struct ScheduledEvent_s ScheduledEvents[MAXEVENTS]; + + void game2_saveevents(char* filename) { // Attempt to get file info @@ -133,6 +140,10 @@ void game2_loadevents(char* filename) Events[i].Triggered = 1; Events[i].RearmDelay = -1; Events[i].NextRearm = -1; + + // We can populate these here as we use MAXEVENTS for both + ScheduledEvents[i].Event = -1; + ScheduledEvents[i].Ticks = -1; } // Attempt to get file info @@ -578,6 +589,29 @@ void game2_tick_input() } } +int game2_newevent() +{ + int i; + int freeid = -1; + + for(i = 0; i 0) + { + if(tick > ScheduledEvents[i].Ticks) + { + // Trigger the event + game2_triggerevent(ScheduledEvents[i].Event); + // Clear it + ScheduledEvents[i].Event = -1; + ScheduledEvents[i].Ticks = -1; + } + } + } } int game2_tick() @@ -703,6 +759,8 @@ int game2_tick() } } + game2_triggerscheduledevents(); + game2_tick_input(); if((TilePlayer.facedirection & (1 << DIRECTION_N)) && (TilePlayer.facedirection & (1 << DIRECTION_E))) //NE diff --git a/!TheEsc/compile.php b/!TheEsc/compile.php index 0e2f4c0..0027a7b 100644 --- a/!TheEsc/compile.php +++ b/!TheEsc/compile.php @@ -96,6 +96,28 @@ $eventactions[] = array("Event"=>$inevent,"Action"=>3,"ActionValue"=>255,"ActionTarget"=>$target); } break; + case "Schedule": + if($inevent < 0) + { + echo " Invalid outside event\n"; + } + else + { + $csv = str_getcsv($split[1]); + + $target = -1; + foreach($events as $eventid=>$event) + { + if($event['Name'] == $csv[0]) + $target = $eventid; + } + + if($target < 0) + echo " Unknown target: " . $csv[0] . "\n"; + else + $eventactions[] = array("Event"=>$inevent,"Action"=>4,"ActionValue"=>$target,"ActionTarget"=>$csv[1]); + } + break; default: echo " Unknown command: " . $split[0] . "\n"; } diff --git a/!TheEsc/m2_evact,ffd b/!TheEsc/m2_evact,ffd index 67c0c0b..0efc666 100644 Binary files a/!TheEsc/m2_evact,ffd and b/!TheEsc/m2_evact,ffd differ diff --git a/!TheEsc/m2_evt,ffd b/!TheEsc/m2_evt,ffd index 9cdd334..6c13b73 100644 Binary files a/!TheEsc/m2_evt,ffd and b/!TheEsc/m2_evt,ffd differ diff --git a/!TheEsc/m2_txt b/!TheEsc/m2_txt index 60630ba..4729f9d 100644 --- a/!TheEsc/m2_txt +++ b/!TheEsc/m2_txt @@ -12,8 +12,13 @@ AddEvent(6,"CB1-DOORCLOSE",1,-1,-1) AddEvent(7,"CB2-DOOROPEN",0,-1,-1) AddEvent(8,"CB2-DOORCLOSE",1,-1,-1) +AddEvent(9,"Brief",0,-1,-1) + Event("PlayerStart") AreaName(1) + Schedule("Brief",200) + +Event("Brief") Sound(8,4) Event("SBBR-DOOROPEN")