Changed the "logic" object to use ScummVM naming conventions.
svn-id: r10496
This commit is contained in:
parent
bca464fdf4
commit
b8fa67a8bb
10 changed files with 99 additions and 105 deletions
|
@ -499,7 +499,7 @@ uint32 Parse_user_input(void) {
|
||||||
Print_current_info();
|
Print_current_info();
|
||||||
return 0;
|
return 0;
|
||||||
case 15: // RUNLIST
|
case 15: // RUNLIST
|
||||||
LLogic.Examine_run_list();
|
LLogic.examineRunList();
|
||||||
return 0;
|
return 0;
|
||||||
case 16: // KILL
|
case 16: // KILL
|
||||||
res_man.Kill_res(&input[1][0]);
|
res_man.Kill_res(&input[1][0]);
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ public:
|
||||||
// FN_register_mouse and FN_register_frame)
|
// FN_register_mouse and FN_register_frame)
|
||||||
Reset_mouse_list();
|
Reset_mouse_list();
|
||||||
|
|
||||||
if (LLogic.Process_session())
|
if (LLogic.processSession())
|
||||||
Con_fatal_error("restore 1st cycle failed??");
|
Con_fatal_error("restore 1st cycle failed??");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1399,11 +1399,11 @@ void Restart_control(void) {
|
||||||
|
|
||||||
this_screen.scroll_flag = 2;
|
this_screen.scroll_flag = 2;
|
||||||
|
|
||||||
if (LLogic.Process_session())
|
if (LLogic.processSession())
|
||||||
Con_fatal_error("restart 1st cycle failed??");
|
Con_fatal_error("restart 1st cycle failed??");
|
||||||
|
|
||||||
// (JEL08oct97) so palette not restored immediately after control
|
// So palette not restored immediately after control panel - we want
|
||||||
// panel - we want to fade up instead!
|
// to fade up instead!
|
||||||
this_screen.new_palette = 99;
|
this_screen.new_palette = 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ void Print_current_info(void) {
|
||||||
Print_to_console(" %d normal layers",
|
Print_to_console(" %d normal layers",
|
||||||
this_screen.number_of_layers);
|
this_screen.number_of_layers);
|
||||||
|
|
||||||
LLogic.Examine_run_list();
|
LLogic.examineRunList();
|
||||||
} else
|
} else
|
||||||
Print_to_console(" no screen");
|
Print_to_console(" no screen");
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ int32 FN_check_for_event(int32 *params) {
|
||||||
if (event_list[j].id == ID) {
|
if (event_list[j].id == ID) {
|
||||||
// start the event
|
// start the event
|
||||||
// run 3rd script of target object on level 1
|
// run 3rd script of target object on level 1
|
||||||
LLogic.Logic_one(event_list[j].interact_id);
|
LLogic.logicOne(event_list[j].interact_id);
|
||||||
// clear the event slot
|
// clear the event slot
|
||||||
event_list[j].id = 0;
|
event_list[j].id = 0;
|
||||||
return IR_TERMINATE;
|
return IR_TERMINATE;
|
||||||
|
@ -245,7 +245,7 @@ int32 FN_pause_for_event(int32 *params) {
|
||||||
|
|
||||||
// start the event
|
// start the event
|
||||||
// run 3rd script of target object on level 1
|
// run 3rd script of target object on level 1
|
||||||
LLogic.Logic_one(event_list[j].interact_id);
|
LLogic.logicOne(event_list[j].interact_id);
|
||||||
|
|
||||||
// clear the event slot
|
// clear the event slot
|
||||||
event_list[j].id = 0;
|
event_list[j].id = 0;
|
||||||
|
@ -311,7 +311,7 @@ void Start_event(void) {
|
||||||
for (int j = 0; j < MAX_events; j++) {
|
for (int j = 0; j < MAX_events; j++) {
|
||||||
if (event_list[j].id == ID) {
|
if (event_list[j].id == ID) {
|
||||||
// run 3rd script of target object on level 1
|
// run 3rd script of target object on level 1
|
||||||
LLogic.Logic_one( event_list[j].interact_id);
|
LLogic.logicOne(event_list[j].interact_id);
|
||||||
|
|
||||||
//clear the slot
|
//clear the slot
|
||||||
event_list[j].id = 0;
|
event_list[j].id = 0;
|
||||||
|
@ -327,7 +327,7 @@ int32 FN_start_event(int32 *params) {
|
||||||
for (int j = 0; j < MAX_events; j++)
|
for (int j = 0; j < MAX_events; j++)
|
||||||
if (event_list[j].id == ID) {
|
if (event_list[j].id == ID) {
|
||||||
// run 3rd script of target object on level 1
|
// run 3rd script of target object on level 1
|
||||||
LLogic.Logic_one(event_list[j].interact_id);
|
LLogic.logicOne(event_list[j].interact_id);
|
||||||
|
|
||||||
// clear the slot
|
// clear the slot
|
||||||
event_list[j].id = 0;
|
event_list[j].id = 0;
|
||||||
|
|
|
@ -54,7 +54,7 @@ int32 FN_gosub(int32 *params) {
|
||||||
// hurray, script subroutines
|
// hurray, script subroutines
|
||||||
// param 0 id of script
|
// param 0 id of script
|
||||||
|
|
||||||
LLogic.Logic_up(params[0]);
|
LLogic.logicUp(params[0]);
|
||||||
|
|
||||||
// logic goes up - pc is saved for current level
|
// logic goes up - pc is saved for current level
|
||||||
return IR_GOSUB;
|
return IR_GOSUB;
|
||||||
|
@ -70,7 +70,7 @@ int32 FN_new_script(int32 *params) {
|
||||||
// must clear this
|
// must clear this
|
||||||
PLAYER_ACTION = 0;
|
PLAYER_ACTION = 0;
|
||||||
|
|
||||||
LLogic.Logic_replace(params[0]);
|
LLogic.logicReplace(params[0]);
|
||||||
|
|
||||||
//drop out no pc save - and around again
|
//drop out no pc save - and around again
|
||||||
return IR_TERMINATE;
|
return IR_TERMINATE;
|
||||||
|
@ -88,7 +88,7 @@ int32 FN_interact(int32 *params) {
|
||||||
PLAYER_ACTION = 0;
|
PLAYER_ACTION = 0;
|
||||||
|
|
||||||
// 3rd script of clicked on id
|
// 3rd script of clicked on id
|
||||||
LLogic.Logic_up((params[0] * 65536) + 2);
|
LLogic.logicUp((params[0] * 65536) + 2);
|
||||||
|
|
||||||
// out, up and around again - pc is saved for current level to be
|
// out, up and around again - pc is saved for current level to be
|
||||||
// returned to
|
// returned to
|
||||||
|
|
133
sword2/logic.cpp
133
sword2/logic.cpp
|
@ -23,13 +23,13 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "interpreter.h"
|
#include "interpreter.h"
|
||||||
#include "logic.h"
|
#include "logic.h"
|
||||||
#include "router.h" // for ClearWalkGridList()
|
#include "router.h" // for ClearWalkGridList()
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
|
|
||||||
logic LLogic;
|
logic LLogic;
|
||||||
|
|
||||||
#define LEVEL (cur_object_hub->logic_level)
|
#define LEVEL (_curObjectHub->logic_level)
|
||||||
|
|
||||||
// this must allow for the largest number of objects in a screen
|
// this must allow for the largest number of objects in a screen
|
||||||
#define OBJECT_KILL_LIST_SIZE 50
|
#define OBJECT_KILL_LIST_SIZE 50
|
||||||
|
@ -39,7 +39,7 @@ uint32 object_kill_list[OBJECT_KILL_LIST_SIZE];
|
||||||
// keeps note of no. of objects in the kill list
|
// keeps note of no. of objects in the kill list
|
||||||
uint32 kills = 0;
|
uint32 kills = 0;
|
||||||
|
|
||||||
int logic::Process_session(void) {
|
int logic::processSession(void) {
|
||||||
// do one cycle of the current session
|
// do one cycle of the current session
|
||||||
|
|
||||||
uint32 run_list;
|
uint32 run_list;
|
||||||
|
@ -53,15 +53,15 @@ int logic::Process_session(void) {
|
||||||
uint32 id;
|
uint32 id;
|
||||||
|
|
||||||
// might change during the session, so take a copy here
|
// might change during the session, so take a copy here
|
||||||
run_list = current_run_list;
|
run_list = _currentRunList;
|
||||||
|
|
||||||
// point to first object in list
|
// point to first object in list
|
||||||
pc = 0;
|
_pc = 0;
|
||||||
|
|
||||||
// by minusing the pc we can cause an immediate cessation of logic
|
// by minusing the pc we can cause an immediate cessation of logic
|
||||||
// processing on the current list
|
// processing on the current list
|
||||||
|
|
||||||
while (pc != 0xffffffff) {
|
while (_pc != 0xffffffff) {
|
||||||
head = (_standardHeader*) res_man.Res_open(run_list);
|
head = (_standardHeader*) res_man.Res_open(run_list);
|
||||||
|
|
||||||
if (head->fileType != RUN_LIST)
|
if (head->fileType != RUN_LIST)
|
||||||
|
@ -70,7 +70,7 @@ int logic::Process_session(void) {
|
||||||
game_object_list = (uint32 *) (head + 1);
|
game_object_list = (uint32 *) (head + 1);
|
||||||
|
|
||||||
// read the next id
|
// read the next id
|
||||||
ID = game_object_list[pc++];
|
ID = game_object_list[_pc++];
|
||||||
id = ID;
|
id = ID;
|
||||||
|
|
||||||
// release the list again so it can float in memory - at this
|
// release the list again so it can float in memory - at this
|
||||||
|
@ -91,12 +91,12 @@ int logic::Process_session(void) {
|
||||||
if (head->fileType != GAME_OBJECT)
|
if (head->fileType != GAME_OBJECT)
|
||||||
Con_fatal_error("Logic_engine %d not an object", ID);
|
Con_fatal_error("Logic_engine %d not an object", ID);
|
||||||
|
|
||||||
cur_object_hub = (_object_hub *) (head + 1);
|
_curObjectHub = (_object_hub *) (head + 1);
|
||||||
|
|
||||||
debug(5, " %d id(%d) pc(%d)",
|
debug(5, " %d id(%d) pc(%d)",
|
||||||
cur_object_hub->logic_level,
|
LEVEL,
|
||||||
cur_object_hub->script_id[cur_object_hub->logic_level],
|
_curObjectHub->script_id[LEVEL],
|
||||||
cur_object_hub->script_pc[cur_object_hub->logic_level]);
|
_curObjectHub->script_pc[LEVEL]);
|
||||||
|
|
||||||
// do the logic for this object
|
// do the logic for this object
|
||||||
// we keep going until a function says to stop - remember,
|
// we keep going until a function says to stop - remember,
|
||||||
|
@ -106,7 +106,7 @@ int logic::Process_session(void) {
|
||||||
// get the script id as we may be running a script
|
// get the script id as we may be running a script
|
||||||
// from another object...
|
// from another object...
|
||||||
|
|
||||||
script = cur_object_hub->script_id[LEVEL];
|
script = _curObjectHub->script_id[LEVEL];
|
||||||
|
|
||||||
// there is a distinction between running one of our
|
// there is a distinction between running one of our
|
||||||
// own scripts and that of another object
|
// own scripts and that of another object
|
||||||
|
@ -115,15 +115,15 @@ int logic::Process_session(void) {
|
||||||
|
|
||||||
debug(5, "run script %d pc%d",
|
debug(5, "run script %d pc%d",
|
||||||
script / SIZE,
|
script / SIZE,
|
||||||
cur_object_hub->script_pc[LEVEL]);
|
_curObjectHub->script_pc[LEVEL]);
|
||||||
|
|
||||||
// this is the script data
|
// this is the script data
|
||||||
// raw_script_ad = (char *) (cur_object_hub + 1);
|
// raw_script_ad = (char *) (_curObjectHub + 1);
|
||||||
|
|
||||||
raw_script_ad = (char*) head;
|
raw_script_ad = (char*) head;
|
||||||
|
|
||||||
// script and data object are us/same
|
// script and data object are us/same
|
||||||
ret = RunScript(raw_script_ad, raw_script_ad, &cur_object_hub->script_pc[LEVEL]);
|
ret = RunScript(raw_script_ad, raw_script_ad, &_curObjectHub->script_pc[LEVEL]);
|
||||||
} else {
|
} else {
|
||||||
// we're running the script of another game
|
// we're running the script of another game
|
||||||
// object - get our data object address
|
// object - get our data object address
|
||||||
|
@ -140,11 +140,11 @@ int logic::Process_session(void) {
|
||||||
// raw_script_ad = (char*) (head + 1) + sizeof(_standardHeader);
|
// raw_script_ad = (char*) (head + 1) + sizeof(_standardHeader);
|
||||||
|
|
||||||
// get our objects data address
|
// get our objects data address
|
||||||
// raw_data_ad = (char*) (cur_object_hub + 1);
|
// raw_data_ad = (char*) (_curObjectHub + 1);
|
||||||
|
|
||||||
raw_script_ad = (char*) far_head;
|
raw_script_ad = (char*) far_head;
|
||||||
|
|
||||||
ret = RunScript(raw_script_ad, raw_data_ad, &cur_object_hub->script_pc[LEVEL]);
|
ret = RunScript(raw_script_ad, raw_data_ad, &_curObjectHub->script_pc[LEVEL]);
|
||||||
|
|
||||||
// close foreign object again
|
// close foreign object again
|
||||||
res_man.Res_close(script / SIZE);
|
res_man.Res_close(script / SIZE);
|
||||||
|
@ -157,8 +157,8 @@ int logic::Process_session(void) {
|
||||||
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
// check that it's not already on level 0 !
|
// check that it's not already on level 0 !
|
||||||
if (cur_object_hub->logic_level)
|
if (LEVEL)
|
||||||
cur_object_hub->logic_level--;
|
LEVEL--;
|
||||||
else {
|
else {
|
||||||
// Hmmm, level 0 terminated :-| Let's
|
// Hmmm, level 0 terminated :-| Let's
|
||||||
// be different this time and simply
|
// be different this time and simply
|
||||||
|
@ -167,13 +167,13 @@ int logic::Process_session(void) {
|
||||||
debug(5, "**WARNING object %d script 0 terminated!", id);
|
debug(5, "**WARNING object %d script 0 terminated!", id);
|
||||||
|
|
||||||
// reset to rerun
|
// reset to rerun
|
||||||
cur_object_hub->script_pc[LEVEL] = cur_object_hub->script_id[LEVEL] & 0xffff;
|
_curObjectHub->script_pc[LEVEL] = _curObjectHub->script_id[LEVEL] & 0xffff;
|
||||||
|
|
||||||
// cause us to drop out for a cycle
|
// cause us to drop out for a cycle
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
} else if (ret > 2) {
|
} else if (ret > 2) {
|
||||||
Con_fatal_error("Process_session: illegal script return type %d", ret);
|
Con_fatal_error("processSession: illegal script return type %d", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ret == 2 then we simply go around again - a new
|
// if ret == 2 then we simply go around again - a new
|
||||||
|
@ -189,7 +189,7 @@ int logic::Process_session(void) {
|
||||||
|
|
||||||
Clear_syncs(ID);
|
Clear_syncs(ID);
|
||||||
|
|
||||||
if (pc != 0xffffffff) {
|
if (_pc != 0xffffffff) {
|
||||||
// the session is still valid so run the service script
|
// the session is still valid so run the service script
|
||||||
null_pc = 0;
|
null_pc = 0;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ int logic::Process_session(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// leaving a room so remove all ids that must reboot correctly
|
// leaving a room so remove all ids that must reboot correctly
|
||||||
Process_kill_list();
|
processKillList();
|
||||||
|
|
||||||
debug(5, "RESTART the loop");
|
debug(5, "RESTART the loop");
|
||||||
|
|
||||||
|
@ -215,15 +215,15 @@ int logic::Process_session(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Express_change_session(uint32 sesh_id) {
|
void logic::expressChangeSession(uint32 sesh_id) {
|
||||||
// a game-object can bring an immediate halt to the session and cause
|
// a game-object can bring an immediate halt to the session and cause
|
||||||
// a new one to start without a screen update
|
// a new one to start without a screen update
|
||||||
|
|
||||||
//set to new
|
//set to new
|
||||||
current_run_list = sesh_id;
|
_currentRunList = sesh_id;
|
||||||
|
|
||||||
//causes session to quit
|
//causes session to quit
|
||||||
pc = 0xffffffff;
|
_pc = 0xffffffff;
|
||||||
|
|
||||||
// reset now in case we double-clicked an exit prior to changing screen
|
// reset now in case we double-clicked an exit prior to changing screen
|
||||||
EXIT_FADING = 0;
|
EXIT_FADING = 0;
|
||||||
|
@ -244,29 +244,25 @@ void logic::Express_change_session(uint32 sesh_id) {
|
||||||
FreeAllRouteMem();
|
FreeAllRouteMem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Natural_change_session(uint32 sesh_id) {
|
void logic::naturalChangeSession(uint32 sesh_id) {
|
||||||
// a new session will begin next game cycle.
|
// FIXME: This function doesn't seem to be used anywhere
|
||||||
// the current cycle will conclude and build the screen and flip
|
|
||||||
// into view as normal
|
|
||||||
|
|
||||||
//set to new
|
// A new session will begin next game cycle. The current cycle will
|
||||||
current_run_list = sesh_id;
|
// conclude and build the screen and flip into view as normal
|
||||||
|
|
||||||
|
_currentRunList = sesh_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 logic::Return_run_list(void) {
|
uint32 logic::getRunList(void) {
|
||||||
// pass back the private cur_object_list variable - not sure we need
|
// pass back the private _currentRunList variable
|
||||||
// this
|
return _currentRunList;
|
||||||
|
|
||||||
//return the id
|
|
||||||
return current_run_list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 FN_set_session(int32 *params) {
|
int32 FN_set_session(int32 *params) {
|
||||||
// used by player invoked start scripts
|
// used by player invoked start scripts
|
||||||
// param 0 id of new run list
|
// param 0 id of new run list
|
||||||
|
|
||||||
//now!
|
LLogic.expressChangeSession(params[0]);
|
||||||
LLogic.Express_change_session(*params);
|
|
||||||
return IR_CONT;
|
return IR_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,63 +274,63 @@ int32 FN_end_session(int32 *params) {
|
||||||
// param 0 id of new run-list
|
// param 0 id of new run-list
|
||||||
|
|
||||||
// terminate current and change to next run-list
|
// terminate current and change to next run-list
|
||||||
LLogic.Express_change_session(*params);
|
LLogic.expressChangeSession(params[0]);
|
||||||
|
|
||||||
// stop the script - logic engine will now go around and the new
|
// stop the script - logic engine will now go around and the new
|
||||||
// screen will begin
|
// screen will begin
|
||||||
return IR_STOP;
|
return IR_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Logic_up(uint32 new_script) {
|
void logic::logicUp(uint32 new_script) {
|
||||||
// move the current object up a level
|
// move the current object up a level
|
||||||
// called by FN_gosub command - remember, only the logic object has
|
// called by FN_gosub command - remember, only the logic object has
|
||||||
// access to cur_object_hub
|
// access to _curObjectHub
|
||||||
|
|
||||||
// going up a level - and we'll keeping going this cycle
|
// going up a level - and we'll keeping going this cycle
|
||||||
cur_object_hub->logic_level++;
|
LEVEL++;
|
||||||
|
|
||||||
// can be 0, 1, 2
|
// can be 0, 1, 2
|
||||||
if (cur_object_hub->logic_level == 3)
|
if (LEVEL == 3)
|
||||||
Con_fatal_error("Logic_up id %d has run off script tree! :-O", ID);
|
Con_fatal_error("logicUp id %d has run off script tree! :-O", ID);
|
||||||
|
|
||||||
// setup new script on next level (not the current level)
|
// setup new script on next level (not the current level)
|
||||||
|
|
||||||
debug(5, "new pc = %d", new_script & 0xffff);
|
debug(5, "new pc = %d", new_script & 0xffff);
|
||||||
|
|
||||||
cur_object_hub->script_id[cur_object_hub->logic_level] = new_script;
|
_curObjectHub->script_id[LEVEL] = new_script;
|
||||||
cur_object_hub->script_pc[cur_object_hub->logic_level] = new_script & 0xffff;
|
_curObjectHub->script_pc[LEVEL] = new_script & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Logic_one(uint32 new_script) {
|
void logic::logicOne(uint32 new_script) {
|
||||||
// force to level one
|
// force to level one
|
||||||
|
|
||||||
cur_object_hub->logic_level = 1;
|
LEVEL = 1;
|
||||||
|
|
||||||
// setup new script on level 1
|
// setup new script on level 1
|
||||||
cur_object_hub->script_id[1] = new_script;
|
_curObjectHub->script_id[1] = new_script;
|
||||||
cur_object_hub->script_pc[1] = new_script & 0xffff;
|
_curObjectHub->script_pc[1] = new_script & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Logic_replace(uint32 new_script) {
|
void logic::logicReplace(uint32 new_script) {
|
||||||
// change current logic - script must quit with a TERMINATE directive
|
// change current logic - script must quit with a TERMINATE directive
|
||||||
// - which does not write to &pc
|
// - which does not write to &pc
|
||||||
|
|
||||||
// setup new script on this level
|
// setup new script on this level
|
||||||
cur_object_hub->script_id[cur_object_hub->logic_level] = new_script;
|
_curObjectHub->script_id[LEVEL] = new_script;
|
||||||
cur_object_hub->script_pc[cur_object_hub->logic_level] = new_script & 0xffff;
|
_curObjectHub->script_pc[LEVEL] = new_script & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 logic::Examine_run_list(void) {
|
uint32 logic::examineRunList(void) {
|
||||||
uint32 *game_object_list;
|
uint32 *game_object_list;
|
||||||
_standardHeader *file_header;
|
_standardHeader *file_header;
|
||||||
int scrolls = 0;
|
int scrolls = 0;
|
||||||
_keyboardEvent ke;
|
_keyboardEvent ke;
|
||||||
|
|
||||||
if (current_run_list) {
|
if (_currentRunList) {
|
||||||
// open and lock in place
|
// open and lock in place
|
||||||
game_object_list = (uint32 *) (res_man.Res_open(current_run_list) + sizeof(_standardHeader));
|
game_object_list = (uint32 *) (res_man.Res_open(_currentRunList) + sizeof(_standardHeader));
|
||||||
|
|
||||||
Print_to_console("runlist number %d", current_run_list);
|
Print_to_console("runlist number %d", _currentRunList);
|
||||||
|
|
||||||
while(*(game_object_list)) {
|
while(*(game_object_list)) {
|
||||||
file_header = (_standardHeader*) res_man.Res_open(*(game_object_list));
|
file_header = (_standardHeader*) res_man.Res_open(*(game_object_list));
|
||||||
|
@ -365,7 +361,7 @@ uint32 logic::Examine_run_list(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res_man.Res_close(current_run_list);
|
res_man.Res_close(_currentRunList);
|
||||||
} else
|
} else
|
||||||
Print_to_console("no run list set");
|
Print_to_console("no run list set");
|
||||||
|
|
||||||
|
@ -373,21 +369,21 @@ uint32 logic::Examine_run_list(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Total_restart(void) {
|
void logic::totalRestart(void) {
|
||||||
// reset the object restart script 1 on level 0
|
// reset the object restart script 1 on level 0
|
||||||
|
|
||||||
cur_object_hub->logic_level = 0;
|
LEVEL = 0;
|
||||||
// cur_object_hub->script_id[0] = 1;
|
// _curObjectHub->script_id[0] = 1;
|
||||||
|
|
||||||
// reset to rerun
|
// reset to rerun
|
||||||
cur_object_hub->script_pc[0] = 1;
|
_curObjectHub->script_pc[0] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 FN_total_restart(int32 *params) {
|
int32 FN_total_restart(int32 *params) {
|
||||||
// mega runs this to restart its base logic again - like being cached
|
// mega runs this to restart its base logic again - like being cached
|
||||||
// in again
|
// in again
|
||||||
|
|
||||||
LLogic.Total_restart();
|
LLogic.totalRestart();
|
||||||
|
|
||||||
// drop out without saving pc and go around again
|
// drop out without saving pc and go around again
|
||||||
return IR_TERMINATE;
|
return IR_TERMINATE;
|
||||||
|
@ -409,14 +405,13 @@ int32 FN_add_to_kill_list(int32 *params) {
|
||||||
// DON'T EVER KILL GEORGE!
|
// DON'T EVER KILL GEORGE!
|
||||||
if (ID != 8) {
|
if (ID != 8) {
|
||||||
// first, scan list to see if this object is already included
|
// first, scan list to see if this object is already included
|
||||||
// (05mar97 James)
|
|
||||||
|
|
||||||
entry = 0;
|
entry = 0;
|
||||||
while (entry < kills && object_kill_list[entry] != ID)
|
while (entry < kills && object_kill_list[entry] != ID)
|
||||||
entry++;
|
entry++;
|
||||||
|
|
||||||
// if this ID isn't already in the list, then add it,
|
// if this ID isn't already in the list, then add it,
|
||||||
// (otherwise finish) (05mar97 James)
|
// (otherwise finish)
|
||||||
|
|
||||||
if (entry == kills) {
|
if (entry == kills) {
|
||||||
#ifdef _SWORD2_DEBUG
|
#ifdef _SWORD2_DEBUG
|
||||||
|
@ -443,13 +438,13 @@ int32 FN_add_to_kill_list(int32 *params) {
|
||||||
return IR_CONT;
|
return IR_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Process_kill_list(void) {
|
void logic::processKillList(void) {
|
||||||
for (uint32 j = 0; j < kills; j++)
|
for (uint32 j = 0; j < kills; j++)
|
||||||
res_man.Remove_res(object_kill_list[j]);
|
res_man.Remove_res(object_kill_list[j]);
|
||||||
|
|
||||||
kills = 0;
|
kills = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void logic::Reset_kill_list(void) {
|
void logic::resetKillList(void) {
|
||||||
kills = 0;
|
kills = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,37 +30,37 @@
|
||||||
class logic {
|
class logic {
|
||||||
public:
|
public:
|
||||||
//do one cycle of the current session
|
//do one cycle of the current session
|
||||||
int Process_session(void);
|
int processSession(void);
|
||||||
|
|
||||||
// cause the logic loop to terminate and drop out
|
// cause the logic loop to terminate and drop out
|
||||||
void Express_change_session(uint32 sesh_id);
|
void expressChangeSession(uint32 sesh_id);
|
||||||
|
|
||||||
// new logic begins next cycle
|
// new logic begins next cycle
|
||||||
void Natural_change_session(uint32 sesh_id);
|
void naturalChangeSession(uint32 sesh_id);
|
||||||
|
|
||||||
uint32 Return_run_list(void);
|
uint32 getRunList(void);
|
||||||
|
|
||||||
// setup script_id and script_pc in cur_object_hub - called by
|
// setup script_id and script_pc in _curObjectHub - called by
|
||||||
// FN_gosub()
|
// FN_gosub()
|
||||||
void Logic_up(uint32 new_script);
|
void logicUp(uint32 new_script);
|
||||||
|
|
||||||
void Logic_replace(uint32 new_script);
|
void logicReplace(uint32 new_script);
|
||||||
void Logic_one(uint32 new_script);
|
void logicOne(uint32 new_script);
|
||||||
void Total_restart(void);
|
void totalRestart(void);
|
||||||
uint32 Examine_run_list(void);
|
uint32 examineRunList(void);
|
||||||
void Reset_kill_list(void);
|
void resetKillList(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// denotes the res id of the game-object-list in current use
|
// denotes the res id of the game-object-list in current use
|
||||||
uint32 current_run_list;
|
uint32 _currentRunList;
|
||||||
|
|
||||||
void Process_kill_list(void);
|
void processKillList(void);
|
||||||
|
|
||||||
//pc during logic loop
|
//pc during logic loop
|
||||||
uint32 pc;
|
uint32 _pc;
|
||||||
|
|
||||||
// each object has one of these tacked onto the beginning
|
// each object has one of these tacked onto the beginning
|
||||||
_object_hub *cur_object_hub;
|
_object_hub *_curObjectHub;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern logic LLogic;
|
extern logic LLogic;
|
||||||
|
|
|
@ -183,7 +183,7 @@ void FillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) {
|
||||||
g_header.screenId = this_screen.background_layer_id;
|
g_header.screenId = this_screen.background_layer_id;
|
||||||
|
|
||||||
// resource id of current run-list
|
// resource id of current run-list
|
||||||
g_header.runListId = LLogic.Return_run_list();
|
g_header.runListId = LLogic.getRunList();
|
||||||
|
|
||||||
// those scroll position control things
|
// those scroll position control things
|
||||||
g_header.feet_x = this_screen.feet_x;
|
g_header.feet_x = this_screen.feet_x;
|
||||||
|
@ -382,7 +382,7 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size) {
|
||||||
res_man.Kill_all_res(0);
|
res_man.Kill_all_res(0);
|
||||||
|
|
||||||
// clean out the system kill list (no more objects to kill)
|
// clean out the system kill list (no more objects to kill)
|
||||||
LLogic.Reset_kill_list();
|
LLogic.resetKillList();
|
||||||
|
|
||||||
// get player character data from savegame buffer
|
// get player character data from savegame buffer
|
||||||
|
|
||||||
|
@ -432,9 +432,8 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size) {
|
||||||
this_screen.feet_y = g_header.feet_y;
|
this_screen.feet_y = g_header.feet_y;
|
||||||
|
|
||||||
// start the new run list
|
// start the new run list
|
||||||
LLogic.Express_change_session(g_header.runListId);
|
LLogic.expressChangeSession(g_header.runListId);
|
||||||
|
|
||||||
// (James01aug97)
|
|
||||||
// Force in the new scroll position, so unsightly scroll-catch-up does
|
// Force in the new scroll position, so unsightly scroll-catch-up does
|
||||||
// not occur when screen first draws after returning from restore panel
|
// not occur when screen first draws after returning from restore panel
|
||||||
|
|
||||||
|
|
|
@ -346,10 +346,10 @@ int32 FN_end_conversation(int32 *params) {
|
||||||
debug(5, " holding");
|
debug(5, " holding");
|
||||||
}
|
}
|
||||||
|
|
||||||
TALK_FLAG = 0; //in-case DC forgets
|
TALK_FLAG = 0; // in-case DC forgets
|
||||||
|
|
||||||
// restart george's base script
|
// restart george's base script
|
||||||
// LLogic.Total_restart();
|
// LLogic.totalRestart();
|
||||||
|
|
||||||
//drop out without saving pc and go around again
|
//drop out without saving pc and go around again
|
||||||
return IR_CONT;
|
return IR_CONT;
|
||||||
|
|
|
@ -213,7 +213,7 @@ int32 GameCycle(void) {
|
||||||
// do one game cycle
|
// do one game cycle
|
||||||
|
|
||||||
//got a screen to run?
|
//got a screen to run?
|
||||||
if (LLogic.Return_run_list()) {
|
if (LLogic.getRunList()) {
|
||||||
//run the logic session UNTIL a full loop has been performed
|
//run the logic session UNTIL a full loop has been performed
|
||||||
do {
|
do {
|
||||||
// reset the graphic 'buildit' list before a new
|
// reset the graphic 'buildit' list before a new
|
||||||
|
@ -226,7 +226,7 @@ int32 GameCycle(void) {
|
||||||
|
|
||||||
// keep going as long as new lists keep getting put in
|
// keep going as long as new lists keep getting put in
|
||||||
// - i.e. screen changes
|
// - i.e. screen changes
|
||||||
} while (LLogic.Process_session());
|
} while (LLogic.processSession());
|
||||||
} else {
|
} else {
|
||||||
// start the console and print the start options perhaps?
|
// start the console and print the start options perhaps?
|
||||||
StartConsole();
|
StartConsole();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue