Remove unused entires from file, populate with safe data on load. Scripting for Shuttlebay, Cargo bay 1 and Cargo bay 2 doors.

This commit is contained in:
stevenhowes
2021-05-29 23:46:46 +01:00
parent 459db2afb0
commit 3b4de290cc
9 changed files with 76 additions and 79 deletions
Binary file not shown.
+2 -8
View File
@@ -48,12 +48,8 @@ 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.CTheEscape: c.CTheEscape o.Intro: c.Intro
o.CTheEscape: C:h.swis o.Intro: h.Graphics
o.CTheEscape: C:h.kernel
o.CTheEscape: C:h.kernel
o.CTheEscape: h.Sound
o.CTheEscape: h.Graphics
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
@@ -65,8 +61,6 @@ o.Sound: C:h.swis
o.Sound: C:h.kernel o.Sound: C:h.kernel
o.Sound: C:h.kernel o.Sound: C:h.kernel
o.Sound: h.Sound o.Sound: h.Sound
o.Intro: c.Intro
o.Intro: h.Graphics
o.Mission1: c.Mission1 o.Mission1: c.Mission1
o.Mission1: h.Graphics o.Mission1: h.Graphics
o.Mission1: h.Sound o.Mission1: h.Sound
+10 -16
View File
@@ -51,23 +51,17 @@ 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.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.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.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
+21
View File
@@ -123,6 +123,17 @@ void game2_saveeventactions(char* filename)
void game2_loadevents(char* filename) void game2_loadevents(char* filename)
{ {
int length; int length;
int i;
// Populate with inactive entries
for(i = 0; i<MAXEVENTS; i++)
{
// Default to Triggered with no re-arm so event never fires
sprintf(Events[i].Name,"INVALID");
Events[i].Triggered = 1;
Events[i].RearmDelay = -1;
Events[i].NextRearm = -1;
}
// Attempt to get file info // Attempt to get file info
inreg.r[0] = 5; inreg.r[0] = 5;
@@ -151,6 +162,16 @@ void game2_loadevents(char* filename)
void game2_loadeventactionss(char* filename) void game2_loadeventactionss(char* filename)
{ {
int length; int length;
int i;
// Populate with inactive entries
for(i = 0; i<MAXEVENTACTIONS; i++)
{
EventActions[i].Event = -1;
EventActions[i].Action = -1;
EventActions[i].ActionValue = -1;
EventActions[i].ActionTarget = -1;
}
// Attempt to get file info // Attempt to get file info
inreg.r[0] = 5; inreg.r[0] = 5;
-54
View File
@@ -132,40 +132,6 @@
} }
} }
$blanks = 200 - count($events);
while($blanks > 0)
{
$blanks --;
fwrite($fp, "INVALID");
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(1));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(0));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
}
fclose($fp);
$fp = fopen('m2_evact,ffd', 'w'); $fp = fopen('m2_evact,ffd', 'w');
foreach($eventactions as $eventaction) foreach($eventactions as $eventaction)
{ {
@@ -180,25 +146,5 @@
fwrite($fp, pack('V', $eventaction['ActionTarget'])); // Event fwrite($fp, pack('V', $eventaction['ActionTarget'])); // Event
} }
$blanks = 1000 - count($eventactions);
while($blanks > 0)
{
$blanks --;
fwrite($fp, chr(255)); // Event
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255)); // Action
fwrite($fp, chr(255)); // ActionValue
fwrite($fp, chr(0)); // PAD
fwrite($fp, chr(0)); // PAD
fwrite($fp, chr(255)); // ActionTarget
fwrite($fp, chr(255));
fwrite($fp, chr(255));
fwrite($fp, chr(255));
}
fclose($fp); fclose($fp);
?> ?>
Binary file not shown.
Binary file not shown.
Binary file not shown.
+43 -1
View File
@@ -1,7 +1,17 @@
AddEvent(0,"PlayerStart",0,-1,-1) AddEvent(0,"PlayerStart",0,-1,-1)
AddEvent(1,"SBBR-DOOROPEN",0,-1,-1) AddEvent(1,"SBBR-DOOROPEN",0,-1,-1)
AddEvent(2,"SBBR-DOORCLOSE",1,-1,-1) AddEvent(2,"SBBR-DOORCLOSE",1,-1,-1)
AddEvent(3,"SB-DOOROPEN",0,-1,-1)
AddEvent(4,"SB-DOORCLOSE",1,-1,-1)
AddEvent(5,"CB1-DOOROPEN",0,-1,-1)
AddEvent(6,"CB1-DOORCLOSE",1,-1,-1)
AddEvent(7,"CB2-DOOROPEN",0,-1,-1)
AddEvent(8,"CB2-DOORCLOSE",1,-1,-1)
Event("PlayerStart") Event("PlayerStart")
AreaName(1) AreaName(1)
Sound(8,4) Sound(8,4)
@@ -10,8 +20,40 @@ Event("SBBR-DOOROPEN")
SetTile(713,31) SetTile(713,31)
Sound(8,5) Sound(8,5)
ReArm("SBBR-DOORCLOSE") ReArm("SBBR-DOORCLOSE")
Event("SBBR-DOORCLOSE") Event("SBBR-DOORCLOSE")
SetTile(713,29) SetTile(713,29)
Sound(8,5) Sound(8,5)
ReArm("SBBR-DOOROPEN") ReArm("SBBR-DOOROPEN")
Event("SB-DOOROPEN")
SetTile(1213,68)
SetTile(1313,69)
Sound(8,5)
ReArm("SB-DOORCLOSE")
Event("SB-DOORCLOSE")
SetTile(1213,43)
SetTile(1313,44)
Sound(8,5)
ReArm("SB-DOOROPEN")
Event("CB1-DOOROPEN")
SetTile(2213,68)
SetTile(2313,69)
Sound(8,5)
ReArm("CB1-DOORCLOSE")
Event("CB1-DOORCLOSE")
SetTile(2213,43)
SetTile(2313,44)
Sound(8,5)
ReArm("CB1-DOOROPEN")
Event("CB2-DOOROPEN")
SetTile(3213,68)
SetTile(3313,69)
Sound(8,5)
ReArm("CB2-DOORCLOSE")
Event("CB2-DOORCLOSE")
SetTile(3213,43)
SetTile(3313,44)
Sound(8,5)
ReArm("CB2-DOOROPEN")