[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.46,1.47 script.h,1.31,1.32 sfuncs.cpp,1.48,1.49 sthread.cpp,1.46,1.47
Andrew Kurushin
h00ligan at users.sourceforge.net
Fri Dec 24 02:23:06 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: web/news 20041223.xml,1.1,1.2
- Next message: [Scummvm-cvs-logs] CVS: web/poll Greenbar.gif,NONE,1.1 Orangebar.gif,NONE,1.1 Redbar.gif,NONE,1.1 Yellowbar.gif,NONE,1.1 index.php,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27718
Modified Files:
actor.cpp script.h sfuncs.cpp sthread.cpp
Log Message:
- fix of 8 to 4 direction conversion
- added sfSetActorState function
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- actor.cpp 22 Dec 2004 21:04:49 -0000 1.46
+++ actor.cpp 24 Dec 2004 10:22:01 -0000 1.47
@@ -157,7 +157,9 @@
for (orient = 0; orient < ACTOR_DIRECTIONS_COUNT; orient++) {
// Load all four orientations
framesPointer[i].directions[orient].frameIndex = readS.readUint16();
- framesPointer[i].directions[orient].frameCount = readS.readUint16();
+ framesPointer[i].directions[orient].frameCount = readS.readSint16();
+ if (framesPointer[i].directions[orient].frameCount < 0)
+ warning("frameCount < 0", framesPointer[i].directions[orient].frameCount);
if (framesPointer[i].directions[orient].frameIndex > lastFrame) {
lastFrame = framesPointer[i].directions[orient].frameIndex;
}
@@ -228,6 +230,7 @@
ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) {
ActorData *actor;
+ int fourDirection;
actor = getActor(actorId);
if (actor->disabled)
@@ -239,7 +242,8 @@
if ((actor->facingDirection < kDirUp) || (actor->facingDirection > kDirUpLeft))
error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->facingDirection, actorId);
- return &actor->frames[frameType].directions[actor->facingDirection];
+ fourDirection = ActorDirectectionsLUT[actor->facingDirection];
+ return &actor->frames[frameType].directions[fourDirection];
}
void Actor::handleSpeech(int msec) {
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- script.h 22 Dec 2004 21:04:50 -0000 1.31
+++ script.h 24 Dec 2004 10:22:01 -0000 1.32
@@ -112,6 +112,7 @@
struct SCRIPT_THREAD {
int flags; // ThreadFlags
int waitType; // ThreadWaitTypes
+ void *threadObj; // which object we're handling
uint sleepTime;
int ep_num; // Entrypoint number
@@ -262,6 +263,7 @@
void SThreadCompleteThread(void);
int SThreadDestroy(SCRIPT_THREAD *thread);
+ void wakeUpActorThread(int waitType, void *threadObj);
void wakeUpThreads(int waitType);
void wakeUpThreadsDelayed(int waitType, int sleepTime);
@@ -310,7 +312,7 @@
int SF_startAnim(SCRIPTFUNC_PARAMS);
int SF_actorWalkToAsync(SCRIPTFUNC_PARAMS);
int SF_enableZone(SCRIPTFUNC_PARAMS);
- int SF_setActorState(SCRIPTFUNC_PARAMS);
+ int sfSetActorState(SCRIPTFUNC_PARAMS);
int scriptMoveTo(SCRIPTFUNC_PARAMS);
int SF_sceneEq(SCRIPTFUNC_PARAMS);
int SF_dropObject(SCRIPTFUNC_PARAMS);
Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- sfuncs.cpp 22 Dec 2004 21:04:50 -0000 1.48
+++ sfuncs.cpp 24 Dec 2004 10:22:01 -0000 1.49
@@ -74,7 +74,7 @@
OPCODE(SF_startAnim),
OPCODE(SF_actorWalkToAsync),
OPCODE(SF_enableZone),
- OPCODE(SF_setActorState),
+ OPCODE(sfSetActorState),
OPCODE(scriptMoveTo),
OPCODE(SF_sceneEq),
OPCODE(SF_dropObject),
@@ -247,6 +247,7 @@
actor = _vm->_actor->getActor(actorId);
actor->facingDirection = actor->actionDirection = actorDirection;
+ actor->targetObject = ID_NOTHING;
return SUCCESS;
}
@@ -507,11 +508,24 @@
}
// Script function #29 (0x1D)
-int Script::SF_setActorState(SCRIPTFUNC_PARAMS) {
- ScriptDataWord param1 = thread->pop();
- ScriptDataWord param2 = thread->pop();
+// Param1: actor id
+// Param2: current action
+int Script::sfSetActorState(SCRIPTFUNC_PARAMS) {
+ uint16 actorId;
+ int currentAction;
+ ActorData *actor;
+
+ actorId = getSWord(thread->pop());
+ currentAction = getSWord(thread->pop());
+
+ actor = _vm->_actor->getActor(actorId);
+
+ if ((currentAction >= kActionWalkToPoint) && (currentAction <= kActionWalkToPoint)) {
+ wakeUpActorThread(kWaitTypeWalk, actor);
+ }
+ actor->currentAction = currentAction;
+ actor->actorFlags &= ~kActorBackwards;
- debug(1, "stub: SF_setActorState(%d, %d)", param1, param2);
return SUCCESS;
}
@@ -742,8 +756,11 @@
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
- if (frameRange->frameCount <= frameOffset)
- error("Wrong frameOffset 0x%X", frameOffset);
+ if (frameRange->frameCount <= frameOffset) {
+ // frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
+
+ warning("Wrong frameOffset 0x%X", frameOffset);
+ }
actor->frameNumber = frameRange->frameIndex + frameOffset;
if (actor->currentAction != kActionFall) {
@@ -839,6 +856,7 @@
actor->location.x = actorLocation.x;
actor->location.y = actorLocation.y;
actor->facingDirection = actor->actionDirection = actorDirection;
+
if (frameType >= 0) {
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- sthread.cpp 22 Dec 2004 21:04:50 -0000 1.46
+++ sthread.cpp 24 Dec 2004 10:22:01 -0000 1.47
@@ -63,6 +63,18 @@
return new_thread;
}
+void Script::wakeUpActorThread(int waitType, void *threadObj) {
+ SCRIPT_THREAD *thread;
+ ScriptThreadList::iterator threadIterator;
+
+ for (threadIterator = _threadList.begin(); threadIterator != _threadList.end(); ++threadIterator) {
+ thread = threadIterator.operator->();
+ if ((thread->flags & kTFlagWaiting) && (thread->waitType == waitType) && (thread->threadObj == threadObj)) {
+ thread->flags &= ~kTFlagWaiting;
+ }
+ }
+}
+
void Script::wakeUpThreads(int waitType) {
SCRIPT_THREAD *thread;
ScriptThreadList::iterator threadIterator;
@@ -109,15 +121,26 @@
continue;
}
- if ((thread->flags & kTFlagWaiting) && (thread->waitType == kWaitTypeDelay)) {
- if (thread->sleepTime < msec) {
- thread->sleepTime = 0;
+ if (thread->flags & kTFlagWaiting) {
+
+ if (thread->waitType == kWaitTypeDelay) {
+ if (thread->sleepTime < msec) {
+ thread->sleepTime = 0;
+ } else {
+ thread->sleepTime -= msec;
+ }
+
+ if (thread->sleepTime == 0)
+ thread->flags &= ~kTFlagWaiting;
} else {
- thread->sleepTime -= msec;
+ if (thread->waitType == kWaitTypeWalk) {
+ ActorData *actor;
+ actor = (ActorData *)thread->threadObj;
+ if (actor->currentAction == kActionWait) {
+ thread->flags &= ~kTFlagWaiting;
+ }
+ }
}
-
- if (thread->sleepTime == 0)
- thread->flags &= ~kTFlagWaiting;
}
if (!(thread->flags & kTFlagWaiting))
- Previous message: [Scummvm-cvs-logs] CVS: web/news 20041223.xml,1.1,1.2
- Next message: [Scummvm-cvs-logs] CVS: web/poll Greenbar.gif,NONE,1.1 Orangebar.gif,NONE,1.1 Redbar.gif,NONE,1.1 Yellowbar.gif,NONE,1.1 index.php,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list