mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
Cleanup
svn-id: r19587
This commit is contained in:
parent
c4ad2ecb49
commit
267fc7e2f6
@ -26,7 +26,7 @@
|
||||
namespace Sword2 {
|
||||
|
||||
void Logic::sendEvent(uint32 id, uint32 interact_id) {
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id == id || !_eventList[i].id) {
|
||||
_eventList[i].id = id;
|
||||
_eventList[i].interact_id = interact_id;
|
||||
@ -43,7 +43,7 @@ void Logic::setPlayerActionEvent(uint32 id, uint32 interact_id) {
|
||||
}
|
||||
|
||||
int Logic::checkEventWaiting() {
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id == readVar(ID))
|
||||
return 1;
|
||||
}
|
||||
@ -55,7 +55,7 @@ void Logic::startEvent() {
|
||||
// call this from stuff like fnWalk
|
||||
// you must follow with a return IR_TERMINATE
|
||||
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id == readVar(ID)) {
|
||||
logicOne(_eventList[i].interact_id);
|
||||
_eventList[i].id = 0;
|
||||
@ -67,7 +67,7 @@ void Logic::startEvent() {
|
||||
}
|
||||
|
||||
void Logic::clearEvent(uint32 id) {
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id == id) {
|
||||
_eventList[i].id = 0;
|
||||
return;
|
||||
@ -76,7 +76,7 @@ void Logic::clearEvent(uint32 id) {
|
||||
}
|
||||
|
||||
void Logic::killAllIdsEvents(uint32 id) {
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id == id)
|
||||
_eventList[i].id = 0;
|
||||
}
|
||||
@ -87,7 +87,7 @@ void Logic::killAllIdsEvents(uint32 id) {
|
||||
uint32 Logic::countEvents() {
|
||||
uint32 count = 0;
|
||||
|
||||
for (int i = 0; i < MAX_events; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_eventList); i++) {
|
||||
if (_eventList[i].id)
|
||||
count++;
|
||||
}
|
||||
|
@ -444,19 +444,7 @@ int32 Logic::fnSendSync(int32 *params) {
|
||||
// params: 0 sync's recipient
|
||||
// 1 sync value
|
||||
|
||||
for (int i = 0; i < MAX_syncs; i++) {
|
||||
if (_syncList[i].id == 0) {
|
||||
debug(5, "%d sends sync %d to %d", readVar(ID), params[1], params[0]);
|
||||
_syncList[i].id = params[0];
|
||||
_syncList[i].sync = params[1];
|
||||
return IR_CONT;
|
||||
}
|
||||
}
|
||||
|
||||
// The original code didn't even check for this condition, so maybe
|
||||
// it should be a fatal error?
|
||||
|
||||
warning("No free sync slot");
|
||||
sendSync(params[0], params[1]);
|
||||
return IR_CONT;
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,6 @@ struct MovieTextObject;
|
||||
|
||||
#define MAX_events 10
|
||||
|
||||
// There won't be many, will there? Probably 2 at most i reckon
|
||||
#define MAX_syncs 10
|
||||
|
||||
#define TREE_SIZE 3
|
||||
|
||||
// This must allow for the largest number of objects in a screen
|
||||
@ -170,9 +167,11 @@ public:
|
||||
uint32 sync;
|
||||
};
|
||||
|
||||
SyncUnit _syncList[MAX_syncs];
|
||||
// There won't be many, will there? Probably 2 at most i reckon
|
||||
SyncUnit _syncList[10];
|
||||
|
||||
void clearSyncs(uint32 id);
|
||||
void sendSync(uint32 id, uint32 sync);
|
||||
int getSync();
|
||||
|
||||
Router *_router;
|
||||
|
@ -32,7 +32,7 @@ namespace Sword2 {
|
||||
*/
|
||||
|
||||
void Logic::clearSyncs(uint32 id) {
|
||||
for (int i = 0; i < MAX_syncs; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
|
||||
if (_syncList[i].id == id) {
|
||||
debug(5, "removing sync %d for %d", i, id);
|
||||
_syncList[i].id = 0;
|
||||
@ -40,6 +40,22 @@ void Logic::clearSyncs(uint32 id) {
|
||||
}
|
||||
}
|
||||
|
||||
void Logic::sendSync(uint32 id, uint32 sync) {
|
||||
for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
|
||||
if (_syncList[i].id == 0) {
|
||||
debug(5, "%d sends sync %d to %d", readVar(ID), sync, id);
|
||||
_syncList[i].id = id;
|
||||
_syncList[i].sync = sync;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The original code didn't even check for this condition, so maybe
|
||||
// it should be a fatal error?
|
||||
|
||||
warning("No free sync slot");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for a sync waiting for this character. Called from fnAnim() to see if
|
||||
* animation is to be finished. Returns an index into _syncList[], or -1.
|
||||
@ -48,7 +64,7 @@ void Logic::clearSyncs(uint32 id) {
|
||||
int Logic::getSync() {
|
||||
uint32 id = readVar(ID);
|
||||
|
||||
for (int i = 0; i < MAX_syncs; i++) {
|
||||
for (int i = 0; i < ARRAYSIZE(_syncList); i++) {
|
||||
if (_syncList[i].id == id)
|
||||
return i;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user