[Scummvm-git-logs] scummvm master -> 9ffcbb3fb7b00b2ae426ae79bda9adba368ec245
sev-
noreply at scummvm.org
Tue Sep 27 15:45:23 UTC 2022
This automated email contains information about 16 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
54907f9465 SAGA2: Rename class variables in script.h
d7d4d1b210 SAGA2: Rename class variables in sensor.h
7b7603556b SAGA2: Rename class variables in speech.h
a68914295d SAGA2: Rename class variables in spelshow.h
c68a1a910c SAGA2: Renamed class variables in spellbuk.h
6ccffbfbf8 SAGA2: Rename class variables in spelshow.h
7bcf7224e2 SAGA2: Rename class variables in sprite.h
90c4c7e547 SAGA2: Rename class variables in target.h
9d393ffc61 SAGA2: Rename class variables in task.h
5b7b40af0b SAGA2: Rename class variables in tile.h
8a35749334 SAGA2: Rename class variables in tilemode.cpp
2865f33aa3 SAGA2: Rename class variables in uidialog.h
490cf62fc4 SAGA2: Rename class variables in vbacksav.h
c070fe7274 SAGA2: Rename class variables in vdraw.h
5fe1ff2ff4 SAGA2: Rename class variables in videobox.h
9ffcbb3fb7 SAGA2: Rename class variables in vpage.h
Commit: 54907f9465f75a8c4ee2678e0b46c3903eb7a444
https://github.com/scummvm/scummvm/commit/54907f9465f75a8c4ee2678e0b46c3903eb7a444
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Rename class variables in script.h
Changed paths:
engines/saga2/interp.cpp
engines/saga2/sagafunc.cpp
engines/saga2/script.h
diff --git a/engines/saga2/interp.cpp b/engines/saga2/interp.cpp
index 3f30350655d..bc8710dec39 100644
--- a/engines/saga2/interp.cpp
+++ b/engines/saga2/interp.cpp
@@ -39,8 +39,8 @@ namespace Saga2 {
#define IMMED_WORD(w) ((w = *pc++),(w |= (*pc++)<<8)); \
debugC(3, kDebugScripts, "IMMED_WORD(%d 0x%04x)", w, w)
-#define BRANCH(w) pc = codeSeg + (w); \
- debugC(3, kDebugScripts, "BRANCH(%ld 0x%04lx)", long(pc - codeSeg), long(pc - codeSeg))
+#define BRANCH(w) pc = _codeSeg + (w); \
+ debugC(3, kDebugScripts, "BRANCH(%ld 0x%04lx)", long(pc - _codeSeg), long(pc - _codeSeg))
const uint32 sagaID = MKTAG('S', 'A', 'G', 'A'),
dataSegID = MKTAG('_', '_', 'D', 'A'),
@@ -74,7 +74,7 @@ extern hResource *scriptResFile; // script resources
hResContext *scriptRes; // script resource handle
void script_error(const char *msg) {
- thisThread->flags |= Thread::aborted;
+ thisThread->_flags |= Thread::aborted;
WriteStatusF(0, msg);
}
@@ -235,9 +235,9 @@ uint8 *byteAddress(Thread *th, uint8 **pcPtr) {
case addr_near:
IMMED_WORD(offset);
- debugC(3, kDebugScripts, "byteAddress: near[%d] = %d", offset, th->codeSeg[offset]);
+ debugC(3, kDebugScripts, "byteAddress: near[%d] = %d", offset, th->_codeSeg[offset]);
*pcPtr = pc;
- return th->codeSeg + offset;
+ return th->_codeSeg + offset;
case addr_far:
IMMED_WORD(seg);
@@ -266,19 +266,19 @@ uint8 *byteAddress(Thread *th, uint8 **pcPtr) {
case addr_stack:
IMMED_WORD(offset);
- debugC(3, kDebugScripts, "byteAddress: stack[%d] = %d", offset, *(th->stackBase + th->framePtr + (int16)offset));
+ debugC(3, kDebugScripts, "byteAddress: stack[%d] = %d", offset, *(th->_stackBase + th->_framePtr + (int16)offset));
*pcPtr = pc;
- return th->stackBase + th->framePtr + (int16)offset;
+ return th->_stackBase + th->_framePtr + (int16)offset;
case addr_thread:
IMMED_WORD(offset);
- debugC(3, kDebugScripts, "byteAddress: thread[%d] = %d", offset, *((uint8 *)&th->threadArgs + offset));
+ debugC(3, kDebugScripts, "byteAddress: thread[%d] = %d", offset, *((uint8 *)&th->_threadArgs + offset));
*pcPtr = pc;
- return (uint8 *)&th->threadArgs + offset;
+ return (uint8 *)&th->_threadArgs + offset;
case addr_this:
IMMED_WORD(offset);
- arg = (uint16 *)(th->stackBase + th->framePtr + 8);
+ arg = (uint16 *)(th->_stackBase + th->_framePtr + 8);
*pcPtr = pc;
if (arg[0] == dataSegIndex) {
debugC(3, kDebugScripts, "byteAddress: thisD[%d:%d] = %d", arg[1], offset, dataSegment[arg[1] + offset]);
@@ -350,7 +350,7 @@ uint8 *objectAddress(
case addr_this:
IMMED_WORD(offset);
- arg = (uint16 *)(th->stackBase + th->framePtr + 8);
+ arg = (uint16 *)(th->_stackBase + th->_framePtr + 8);
seg = arg[0];
index = arg[1];
if (seg == dataSegIndex) {
@@ -410,8 +410,8 @@ uint8 *bitAddress(Thread *th, uint8 **pcPtr, int16 *mask) {
IMMED_WORD(offset);
*pcPtr = pc;
*mask = (1 << (offset & 7));
- debugC(3, kDebugScripts, "bitAddress: near[%d] = %d", offset, (*(th->codeSeg + (offset >> 3)) & *mask) != 0);
- return th->codeSeg + (offset >> 3);
+ debugC(3, kDebugScripts, "bitAddress: near[%d] = %d", offset, (*(th->_codeSeg + (offset >> 3)) & *mask) != 0);
+ return th->_codeSeg + (offset >> 3);
case addr_far:
IMMED_WORD(seg);
@@ -435,15 +435,15 @@ uint8 *bitAddress(Thread *th, uint8 **pcPtr, int16 *mask) {
IMMED_WORD(offset);
*pcPtr = pc;
*mask = (1 << (offset & 7));
- debugC(3, kDebugScripts, "bitAddress: stack[%d] = %d", offset, (*(th->stackBase + th->framePtr + (offset >>3)) & *mask) != 0);
- return th->stackBase + th->framePtr + (offset >> 3);
+ debugC(3, kDebugScripts, "bitAddress: stack[%d] = %d", offset, (*(th->_stackBase + th->_framePtr + (offset >>3)) & *mask) != 0);
+ return th->_stackBase + th->_framePtr + (offset >> 3);
case addr_thread:
IMMED_WORD(offset);
*pcPtr = pc;
*mask = (1 << (offset & 7));
- debugC(3, kDebugScripts, "bitAddress: thread[%d] = %d", offset, (*((uint8 *)&th->threadArgs + (offset >> 3)) & *mask) != 0);
- return (uint8 *)&th->threadArgs + (offset >> 3);
+ debugC(3, kDebugScripts, "bitAddress: thread[%d] = %d", offset, (*((uint8 *)&th->_threadArgs + (offset >> 3)) & *mask) != 0);
+ return (uint8 *)&th->_threadArgs + (offset >> 3);
case addr_this:
error("Addressing relative to 'this' not supported just yet.\n");
@@ -455,12 +455,12 @@ uint8 *bitAddress(Thread *th, uint8 **pcPtr, int16 *mask) {
// Returns the address of a string
uint8 *Thread::strAddress(int strNum) {
- uint16 seg = READ_LE_INT16(codeSeg + 2);
- uint16 offset = READ_LE_INT16(codeSeg + 4);
+ uint16 seg = READ_LE_INT16(_codeSeg + 2);
+ uint16 offset = READ_LE_INT16(_codeSeg + 4);
uint8 *strSeg = segmentAddress(seg, offset);
assert(strNum >= 0);
- assert(codeSeg);
+ assert(_codeSeg);
assert(strSeg);
return strSeg + (uint16)READ_LE_INT16(strSeg + 2 * strNum);
@@ -544,8 +544,8 @@ const char *objectName(int16 segNum, uint16 segOff) {
#define STACK_PRINT_DEPTH 30
-static void print_stack(int16 *stackBase, int16 *stack) {
- int16 *end = (int16 *)((byte *)stackBase + kStackSize - initialStackFrameSize);
+static void print_stack(int16 *_stackBase, int16 *stack) {
+ int16 *end = (int16 *)((byte *)_stackBase + kStackSize - initialStackFrameSize);
int size = end - stack;
if (size > STACK_PRINT_DEPTH)
@@ -560,27 +560,27 @@ static void print_stack(int16 *stackBase, int16 *stack) {
debugC(3, kDebugScripts, "]");
}
-#define D_OP(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s", (pc - codeSeg - 1), (pc - codeSeg - 1), #x)
-#define D_OP1(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s = %d", long(pc - codeSeg - 1), long(pc - codeSeg - 1), #x, *stack)
-#define D_OP2(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s [%p] = %d", long(pc - codeSeg - 1), long(pc - codeSeg - 1), #x, (void *)addr, *stack)
-#define D_OP3(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s [%p] %d", long(pc - codeSeg - 1), long(pc - codeSeg - 1), #x, (void *)addr, *addr)
+#define D_OP(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s", (pc - _codeSeg - 1), (pc - _codeSeg - 1), #x)
+#define D_OP1(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s = %d", long(pc - _codeSeg - 1), long(pc - _codeSeg - 1), #x, *stack)
+#define D_OP2(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s [%p] = %d", long(pc - _codeSeg - 1), long(pc - _codeSeg - 1), #x, (void *)addr, *stack)
+#define D_OP3(x) debugC(1, kDebugScripts, "[%04ld 0x%04lx]: %s [%p] %d", long(pc - _codeSeg - 1), long(pc - _codeSeg - 1), #x, (void *)addr, *addr)
bool Thread::interpret() {
uint8 *pc,
*addr;
- int16 *stack = (int16 *)stackPtr;
+ int16 *stack = (int16 *)_stackPtr;
int16 instruction_count;
uint8 op;
int16 w,
n;
C_Call *cfunc;
- pc = (codeSeg) + programCounter.offset;
+ pc = (_codeSeg) + _programCounter.offset;
thisThread = this; // set current thread address
for (instruction_count = 0; instruction_count < maxTimeSlice; instruction_count++) {
- print_stack((int16 *)stackBase, stack);
+ print_stack((int16 *)_stackBase, stack);
switch (op = *pc++) {
case op_dup:
@@ -678,8 +678,8 @@ bool Thread::interpret() {
case op_enter:
D_OP(op_enter);
print_script_name(pc - 1);
- *--stack = framePtr; // save old frame ptr on stack
- framePtr = (uint8 *)stack - stackBase; // new frame pointer
+ *--stack = _framePtr; // save old frame ptr on stack
+ _framePtr = (uint8 *)stack - _stackBase; // new frame pointer
IMMED_WORD(w); // pick up word after address
stack -= w / 2; // make room for the locals!
break;
@@ -688,33 +688,33 @@ bool Thread::interpret() {
case op_return: // return with value
D_OP(op_return);
- returnVal = *stack++;
+ _returnVal = *stack++;
// fall through
case op_return_v: // return with void
D_OP(op_return_v);
- stack = (int16 *)(stackBase + framePtr); // pop autos
- framePtr = *stack++; // restore frame pointer
+ stack = (int16 *)(_stackBase + _framePtr); // pop autos
+ _framePtr = *stack++; // restore frame pointer
- if (stack >= (int16 *)(stackBase + stackSize - initialStackFrameSize)) {
+ if (stack >= (int16 *)(_stackBase + _stackSize - initialStackFrameSize)) {
// Halt the thread here, wait for death
- programCounter.offset = (pc - (codeSeg));
- stackPtr = (uint8 *)stack;
- flags |= finished;
+ _programCounter.offset = (pc - (_codeSeg));
+ _stackPtr = (uint8 *)stack;
+ _flags |= finished;
return true;
} else {
- programCounter.segment = *stack++;
- programCounter.offset = *stack++;
+ _programCounter.segment = *stack++;
+ _programCounter.offset = *stack++;
- //RUnlockHandle((RHANDLE)codeSeg);
- codeSeg = scriptRes->loadIndexResource(programCounter.segment, "saga code segment");
- pc = (codeSeg) + programCounter.offset;
+ //RUnlockHandle((RHANDLE)_codeSeg);
+ _codeSeg = scriptRes->loadIndexResource(_programCounter.segment, "saga code segment");
+ pc = (_codeSeg) + _programCounter.offset;
n = *stack++; // get argument count from call
stack += n; // pop that many args
if (op == op_return) // if not void
- *--stack = returnVal;// push return value
+ *--stack = _returnVal;// push return value
}
break;
@@ -723,17 +723,17 @@ bool Thread::interpret() {
n = *pc++; // get argument count
- programCounter.offset = (pc + 2 - codeSeg);
+ _programCounter.offset = (pc + 2 - _codeSeg);
*--stack = n; // push number of args (16 bits)
// push the program counter
- *--stack = programCounter.offset;
- *--stack = programCounter.segment;
+ *--stack = _programCounter.offset;
+ *--stack = _programCounter.segment;
IMMED_WORD(w); // pick up segment offset
- programCounter.offset = w; // store into pc
+ _programCounter.offset = w; // store into pc
- pc = codeSeg + w; // calculate PC address
+ pc = _codeSeg + w; // calculate PC address
print_script_name(pc);
break;
@@ -743,21 +743,21 @@ bool Thread::interpret() {
n = *pc++; // get argument count
- programCounter.offset = (pc + 4 - codeSeg);
+ _programCounter.offset = (pc + 4 - _codeSeg);
*--stack = n; // push number of args (16 bits)
// push the program counter
- *--stack = programCounter.offset;
- *--stack = programCounter.segment;
+ *--stack = _programCounter.offset;
+ *--stack = _programCounter.segment;
IMMED_WORD(w); // pick up segment number
- programCounter.segment = w; // set current segment
- //RUnlockHandle((RHANDLE)codeSeg);
- codeSeg = scriptRes->loadIndexResource(w, "saga code segment");
+ _programCounter.segment = w; // set current segment
+ //RUnlockHandle((RHANDLE)_codeSeg);
+ _codeSeg = scriptRes->loadIndexResource(w, "saga code segment");
IMMED_WORD(w); // pick up segment offset
- programCounter.offset = w; // store into pc
+ _programCounter.offset = w; // store into pc
- pc = codeSeg + w; // calculate PC address
+ pc = _codeSeg + w; // calculate PC address
print_script_name(pc);
break;
@@ -774,18 +774,18 @@ bool Thread::interpret() {
error("Invalid function number");
cfunc = globalCFuncs.table[w];
- argCount = n;
- returnVal = cfunc(stack); // call the function
+ _argCount = n;
+ _returnVal = cfunc(stack); // call the function
stack += n; // pop args of of the stack
if (op == op_ccall) { // push the return value
- *--stack = returnVal; // onto the stack
- flags |= expectResult; // script expecting result
- } else flags &= ~expectResult; // script not expecting result
+ *--stack = _returnVal; // onto the stack
+ _flags |= expectResult; // script expecting result
+ } else _flags &= ~expectResult; // script not expecting result
// if the thread is asleep, then no more instructions
- if (flags & asleep)
+ if (_flags & asleep)
instruction_count = maxTimeSlice; // break out of loop!
break;
@@ -829,7 +829,7 @@ bool Thread::interpret() {
if (vtable == nullptr) {
// Do nothing...
} else if (vtableEntry[0] != 0xffff) { // It's a SAGA func
- programCounter.offset = (pc - codeSeg);
+ _programCounter.offset = (pc - _codeSeg);
// Push the address of the object
*--stack = offset;
@@ -838,28 +838,28 @@ bool Thread::interpret() {
*--stack = n + 2;
// push the program counter
- *--stack = programCounter.offset;
- *--stack = programCounter.segment;
+ *--stack = _programCounter.offset;
+ *--stack = _programCounter.segment;
// Get the segment of the member function, and
// determine it's real address (save segment number
// into thread).
w = vtableEntry[0];
- programCounter.segment = w;
- //RUnlockHandle((RHANDLE)codeSeg);
- codeSeg = scriptRes->loadIndexResource(w, "saga code segment");
+ _programCounter.segment = w;
+ //RUnlockHandle((RHANDLE)_codeSeg);
+ _codeSeg = scriptRes->loadIndexResource(w, "saga code segment");
// store pc-offset into pc
- programCounter.offset = vtableEntry[1];
+ _programCounter.offset = vtableEntry[1];
// calculate PC address
- pc = (codeSeg) + programCounter.offset;
+ pc = (_codeSeg) + _programCounter.offset;
print_script_name(pc, objectName(seg, offset));
break;
} else if (vtableEntry[1] != 0xffff) { // It's a C func
// Save the ID of the invoked object
- ObjectID saveID = threadArgs.invokedObject;
+ ObjectID saveID = _threadArgs.invokedObject;
// Get the function number
w = vtableEntry[1];
@@ -867,16 +867,16 @@ bool Thread::interpret() {
error("Invalid member function number");
// Set up thread-specific vars
- thisObject = addr;
- argCount = n;
- threadArgs.invokedObject = offset;
+ _thisObject = addr;
+ _argCount = n;
+ _threadArgs.invokedObject = offset;
// Get address of function and call it.
cfunc = callTab->table[w];
- returnVal = cfunc(stack); // call the function
+ _returnVal = cfunc(stack); // call the function
// Restore object ID from thread args
- threadArgs.invokedObject = saveID;
+ _threadArgs.invokedObject = saveID;
// Pop args off of the stack
stack += n;
@@ -884,12 +884,12 @@ bool Thread::interpret() {
// Push the return value onto the stack if it's
// not a 'void' call.
if (op == op_call_member) {
- *--stack = returnVal; // onto the stack
- flags |= expectResult; // script expecting result
- } else flags &= ~expectResult; // script not expecting result
+ *--stack = _returnVal; // onto the stack
+ _flags |= expectResult; // script expecting result
+ } else _flags &= ~expectResult; // script not expecting result
// if the thread is asleep, then break interpret loop
- if (flags & asleep) instruction_count = maxTimeSlice;
+ if (_flags & asleep) instruction_count = maxTimeSlice;
break;
}
// else it's a NULL function (i.e. pure virtual)
@@ -1157,8 +1157,8 @@ bool Thread::interpret() {
}
}
- programCounter.offset = (pc - (codeSeg));
- stackPtr = (uint8 *)stack;
+ _programCounter.offset = (pc - (_codeSeg));
+ _stackPtr = (uint8 *)stack;
return false;
}
@@ -1428,24 +1428,24 @@ Thread *getThreadAddress(ThreadID id) {
// Thread constructor
Thread::Thread(uint16 segNum, uint16 segOff, scriptCallFrame &args) {
- codeSeg = scriptRes->loadIndexResource(segNum, "saga code segment");
+ _codeSeg = scriptRes->loadIndexResource(segNum, "saga code segment");
// initialize the thread
- stackSize = kStackSize;
- flags = 0;
- returnVal = 0;
- programCounter.segment = segNum;
- programCounter.offset = segOff;
- threadArgs = args;
- stackBase = (byte *)malloc(stackSize);
- stackPtr = stackBase + stackSize - initialStackFrameSize;
- ((uint16 *)stackPtr)[0] = 0; // 0 args
- ((uint16 *)stackPtr)[1] = 0; // dummy return address
- ((uint16 *)stackPtr)[2] = 0; // dummy return address
- framePtr = stackSize;
+ _stackSize = kStackSize;
+ _flags = 0;
+ _returnVal = 0;
+ _programCounter.segment = segNum;
+ _programCounter.offset = segOff;
+ _threadArgs = args;
+ _stackBase = (byte *)malloc(_stackSize);
+ _stackPtr = _stackBase + _stackSize - initialStackFrameSize;
+ ((uint16 *)_stackPtr)[0] = 0; // 0 args
+ ((uint16 *)_stackPtr)[1] = 0; // dummy return address
+ ((uint16 *)_stackPtr)[2] = 0; // dummy return address
+ _framePtr = _stackSize;
_valid = true;
- if ((codeSeg)[programCounter.offset] != op_enter) {
+ if ((_codeSeg)[_programCounter.offset] != op_enter) {
//warning("SAGA failure: Invalid script entry point (export=%d) [segment=%d:%d]\n", lastExport, segNum, segOff);
_valid = false;
}
@@ -1456,30 +1456,30 @@ Thread::Thread(uint16 segNum, uint16 segOff, scriptCallFrame &args) {
Thread::Thread(Common::SeekableReadStream *stream, ThreadID id) {
int16 stackOffset;
- programCounter.segment = stream->readUint16LE();
- programCounter.offset = stream->readUint16LE();
+ _programCounter.segment = stream->readUint16LE();
+ _programCounter.offset = stream->readUint16LE();
- stackSize = stream->readSint16LE();
- flags = stream->readSint16LE();
- framePtr = stream->readSint16LE();
- returnVal = stream->readSint16LE();
+ _stackSize = stream->readSint16LE();
+ _flags = stream->readSint16LE();
+ _framePtr = stream->readSint16LE();
+ _returnVal = stream->readSint16LE();
- waitAlarm.read(stream);
+ _waitAlarm.read(stream);
stackOffset = stream->readSint16LE();
- debugC(4, kDebugSaveload, "...... stackSize = %d", stackSize);
- debugC(4, kDebugSaveload, "...... flags = %d", flags);
- debugC(4, kDebugSaveload, "...... framePtr = %d", framePtr);
- debugC(4, kDebugSaveload, "...... returnVal = %d", returnVal);
+ debugC(4, kDebugSaveload, "...... _stackSize = %d", _stackSize);
+ debugC(4, kDebugSaveload, "...... flags = %d", _flags);
+ debugC(4, kDebugSaveload, "...... _framePtr = %d", _framePtr);
+ debugC(4, kDebugSaveload, "...... _returnVal = %d", _returnVal);
debugC(4, kDebugSaveload, "...... stackOffset = %d", stackOffset);
- codeSeg = scriptRes->loadIndexResource(programCounter.segment, "saga code segment");
+ _codeSeg = scriptRes->loadIndexResource(_programCounter.segment, "saga code segment");
- stackBase = (byte *)malloc(stackSize);
- stackPtr = stackBase + stackSize - stackOffset;
+ _stackBase = (byte *)malloc(_stackSize);
+ _stackPtr = _stackBase + _stackSize - stackOffset;
- stream->read(stackPtr, stackOffset);
+ stream->read(_stackPtr, stackOffset);
newThread(this, id);
}
@@ -1492,10 +1492,10 @@ Thread::~Thread() {
clearExtended();
// Free the thread's code segment
- //RUnlockHandle((RHANDLE)codeSeg);
+ //RUnlockHandle((RHANDLE)_codeSeg);
// Deallocate the thread stack
- free(stackBase);
+ free(_stackBase);
deleteThread(this);
}
@@ -1505,39 +1505,39 @@ Thread::~Thread() {
// buffer
int32 Thread::archiveSize() {
- return sizeof(programCounter)
- + sizeof(stackSize)
- + sizeof(flags)
- + sizeof(framePtr)
- + sizeof(returnVal)
- + sizeof(waitAlarm)
+ return sizeof(_programCounter)
+ + sizeof(_stackSize)
+ + sizeof(_flags)
+ + sizeof(_framePtr)
+ + sizeof(_returnVal)
+ + sizeof(_waitAlarm)
+ sizeof(int16) // stack offset
- + (stackBase + stackSize) - stackPtr;
+ + (_stackBase + _stackSize) - _stackPtr;
}
void Thread::write(Common::MemoryWriteStreamDynamic *out) {
int16 stackOffset;
- out->writeUint16LE(programCounter.segment);
- out->writeUint16LE(programCounter.offset);
+ out->writeUint16LE(_programCounter.segment);
+ out->writeUint16LE(_programCounter.offset);
- out->writeSint16LE(stackSize);
- out->writeSint16LE(flags);
- out->writeSint16LE(framePtr);
- out->writeSint16LE(returnVal);
+ out->writeSint16LE(_stackSize);
+ out->writeSint16LE(_flags);
+ out->writeSint16LE(_framePtr);
+ out->writeSint16LE(_returnVal);
- waitAlarm.write(out);
+ _waitAlarm.write(out);
warning("STUB: Thread::write: Pointer arithmetic");
- stackOffset = (stackBase + stackSize) - stackPtr;
+ stackOffset = (_stackBase + _stackSize) - _stackPtr;
out->writeSint16LE(stackOffset);
- out->write(stackPtr, stackOffset);
+ out->write(_stackPtr, stackOffset);
- debugC(4, kDebugSaveload, "...... stackSize = %d", stackSize);
- debugC(4, kDebugSaveload, "...... flags = %d", flags);
- debugC(4, kDebugSaveload, "...... framePtr = %d", framePtr);
- debugC(4, kDebugSaveload, "...... returnVal = %d", returnVal);
+ debugC(4, kDebugSaveload, "...... _stackSize = %d", _stackSize);
+ debugC(4, kDebugSaveload, "...... flags = %d", _flags);
+ debugC(4, kDebugSaveload, "...... _framePtr = %d", _framePtr);
+ debugC(4, kDebugSaveload, "...... _returnVal = %d", _returnVal);
debugC(4, kDebugSaveload, "...... stackOffset = %d", stackOffset);
}
@@ -1556,8 +1556,8 @@ void Thread::dispatch() {
numWaitOther = 0;
for (th = threadList.first(); th; th = threadList.next(th)) {
- if (th->flags & waiting) {
- switch (th->waitType) {
+ if (th->_flags & waiting) {
+ switch (th->_waitType) {
case waitDelay:
numWaitDelay++;
@@ -1581,32 +1581,32 @@ void Thread::dispatch() {
for (th = threadList.first(); th; th = nextThread) {
nextThread = threadList.next(th);
- if (th->flags & (finished | aborted)) {
+ if (th->_flags & (finished | aborted)) {
delete th;
continue;
}
- if (th->flags & waiting) {
- switch (th->waitType) {
+ if (th->_flags & waiting) {
+ switch (th->_waitType) {
case waitDelay:
// Wake up the thread!
- if (th->waitAlarm.check())
- th->flags &= ~waiting;
+ if (th->_waitAlarm.check())
+ th->_flags &= ~waiting;
break;
case waitFrameDelay:
- if (th->waitFrameAlarm.check())
- th->flags &= ~waiting;
+ if (th->_waitFrameAlarm.check())
+ th->_flags &= ~waiting;
break;
case waitTagSemaphore:
- if (th->waitParam->isExclusive() == false) {
- th->flags &= ~waiting;
- th->waitParam->setExclusive(true);
+ if (th->_waitParam->isExclusive() == false) {
+ th->_flags &= ~waiting;
+ th->_waitParam->setExclusive(true);
}
break;
default:
@@ -1615,12 +1615,12 @@ void Thread::dispatch() {
}
do {
- if (th->flags & (waiting | finished | aborted))
+ if (th->_flags & (waiting | finished | aborted))
break;
if (th->interpret())
goto break_thread_loop;
- } while (th->flags & synchronous);
+ } while (th->_flags & synchronous);
}
break_thread_loop:
;
@@ -1641,9 +1641,9 @@ scriptResult Thread::run() {
while (i--) {
// If script stopped, then return
- if (flags & (waiting | finished | aborted)) {
- if (flags & finished) return scriptResultFinished;
- if (flags & waiting) return scriptResultAsync;
+ if (_flags & (waiting | finished | aborted)) {
+ if (_flags & finished) return scriptResultFinished;
+ if (_flags & waiting) return scriptResultAsync;
return scriptResultAborted;
// can't ever fall thru here...
}
@@ -1658,8 +1658,8 @@ scriptResult Thread::run() {
// Convert to extended thread
void Thread::setExtended() {
- if (!(flags & extended)) {
- flags |= extended;
+ if (!(_flags & extended)) {
+ _flags |= extended;
extendedThreadLevel++;
}
}
@@ -1668,8 +1668,8 @@ void Thread::setExtended() {
// Convert back to regular thread
void Thread::clearExtended() {
- if (flags & extended) {
- flags &= ~extended;
+ if (_flags & extended) {
+ _flags &= ~extended;
extendedThreadLevel--;
}
}
@@ -1785,11 +1785,11 @@ scriptResult runScript(uint16 exportEntryNum, scriptCallFrame &args) {
debugC(4, kDebugScripts, "Scripts: %d is not valid", lastExport);
return scriptResultNoScript;
}
- print_script_name((th->codeSeg) + th->programCounter.offset, objectName(segNum, segOff));
+ print_script_name((th->_codeSeg) + th->_programCounter.offset, objectName(segNum, segOff));
// Run the thread to completion
result = th->run();
- args.returnVal = th->returnVal;
+ args.returnVal = th->_returnVal;
// If the thread is not still running, then delete it
if (result != scriptResultAsync) delete th;
@@ -1864,16 +1864,16 @@ scriptResult runMethod(
debugC(3, kDebugScripts, "Scripts: %d is not valid", lastExport);
return scriptResultNoScript;
}
- print_script_name((th->codeSeg) + th->programCounter.offset, objectName(bType, index));
+ print_script_name((th->_codeSeg) + th->_programCounter.offset, objectName(bType, index));
// Put the object segment and ID onto the dummy stack frame
- ((uint16 *)th->stackPtr)[3] = bType;
- ((uint16 *)th->stackPtr)[4] = index;
+ ((uint16 *)th->_stackPtr)[3] = bType;
+ ((uint16 *)th->_stackPtr)[4] = index;
// Run the thread to completion
result = th->run();
- args.returnVal = th->returnVal;
- debugC(3, kDebugScripts, "return: %d", th->returnVal);
+ args.returnVal = th->_returnVal;
+ debugC(3, kDebugScripts, "return: %d", th->_returnVal);
if (result != scriptResultAsync) delete th;
}
@@ -1927,21 +1927,21 @@ void wakeUpThread(ThreadID id) {
if (id != NoThread) {
Thread *thread = getThreadAddress(id);
- thread->flags &= ~Thread::waiting;
+ thread->_flags &= ~Thread::waiting;
}
}
-void wakeUpThread(ThreadID id, int16 returnVal) {
+void wakeUpThread(ThreadID id, int16 _returnVal) {
if (id != NoThread) {
Thread *thread = getThreadAddress(id);
- if (thread->flags & Thread::expectResult) {
- WriteStatusF(8, "Result %d", returnVal);
- thread->returnVal = returnVal;
- *(int16 *)thread->stackPtr = returnVal;
+ if (thread->_flags & Thread::expectResult) {
+ WriteStatusF(8, "Result %d", _returnVal);
+ thread->_returnVal = _returnVal;
+ *(int16 *)thread->_stackPtr = _returnVal;
} else WriteStatusF(8, "Thread not expecting result!");
- thread->flags &= ~(Thread::waiting | Thread::expectResult);
+ thread->_flags &= ~(Thread::waiting | Thread::expectResult);
}
}
diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index 6424d77c69f..99ec47dd3b1 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -51,7 +51,7 @@
void drawMainDisplay();
#define MONOLOG(s) {debugC(2, kDebugScripts, "cfunc: " #s );}
-#define OBJLOG(s) {debugC(2, kDebugScripts, "cfunc: [%s]." #s , (((ObjectData *)thisThread->thisObject)->obj)->objName() );}
+#define OBJLOG(s) {debugC(2, kDebugScripts, "cfunc: [%s]." #s , (((ObjectData *)thisThread->_thisObject)->obj)->objName() );}
namespace Saga2 {
@@ -134,7 +134,7 @@ int stringf(char *buffer, long maxlen, int formatStr, int16 *args) {
int16 scriptGameObjectThisID(int16 *args) {
OBJLOG(ThisID);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->thisID();
}
@@ -145,7 +145,7 @@ int16 scriptGameObjectThisID(int16 *args) {
int16 scriptGameObjectRecharge(int16 *args) {
OBJLOG(Recharge);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->recharge();
return 0;
@@ -158,7 +158,7 @@ int16 scriptGameObjectRecharge(int16 *args) {
int16 scriptGameObjectGetChargeType(int16 *args) {
OBJLOG(GetChargeType);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->getChargeType();
}
@@ -170,13 +170,13 @@ int16 scriptGameObjectGetChargeType(int16 *args) {
int16 scriptActorMove(int16 *args) {
OBJLOG(Move);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
// Move the object to a new location
obj->move(TilePoint(args[0], args[1], args[2]));
// If optional 4th parameter is present, then set actor facing
- if (thisThread->argCount > 3 && isActor(obj)) {
+ if (thisThread->_argCount > 3 && isActor(obj)) {
Actor *a = (Actor *)obj;
a->_currentFacing = args[3];
@@ -194,7 +194,7 @@ extern const StaticTilePoint dirTable[8];
int16 scriptActorMoveRel(int16 *args) {
OBJLOG(MoveRel);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj,
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj,
*baseObj = GameObject::objectAddress(args[0]);
Location l;
TilePoint tp;
@@ -210,7 +210,7 @@ int16 scriptActorMoveRel(int16 *args) {
obj->move(l);
// If optional 4th parameter is present, then set actor facing
- if (thisThread->argCount > 3 && isActor(obj)) {
+ if (thisThread->_argCount > 3 && isActor(obj)) {
Actor *a = (Actor *)obj;
a->_currentFacing = args[3];
@@ -226,7 +226,7 @@ int16 scriptActorMoveRel(int16 *args) {
int16 scriptActorTransfer(int16 *args) {
OBJLOG(Transfer);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
// Move the object to a new location
if ((isObject(args[0])
@@ -252,7 +252,7 @@ int16 scriptActorTransfer(int16 *args) {
}
// If optional 5th parameter is present, then set actor facing
- if (thisThread->argCount > 4 && isActor(obj)) {
+ if (thisThread->_argCount > 4 && isActor(obj)) {
Actor *a = (Actor *)obj;
a->_currentFacing = args[4];
@@ -267,7 +267,7 @@ int16 scriptActorTransfer(int16 *args) {
int16 scriptMoveRandom(int16 *args) {
OBJLOG(MoveRandom);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
TilePoint tpMin, tpMax;
int16 distance = args[3];
@@ -289,7 +289,7 @@ int16 scriptMoveRandom(int16 *args) {
int16 scriptActorGetName(int16 *) {
OBJLOG(GetName);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
int16 oldName = obj->getNameIndex();
return oldName;
@@ -301,7 +301,7 @@ int16 scriptActorGetName(int16 *) {
int16 scriptActorSetName(int16 *args) {
OBJLOG(SetName);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
int16 oldName = obj->getNameIndex();
obj->setNameIndex(args[0]);
@@ -315,7 +315,7 @@ int16 scriptActorSetName(int16 *args) {
int16 scriptActorGetProto(int16 *) {
OBJLOG(GetProto);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->getProtoNum();
}
@@ -325,7 +325,7 @@ int16 scriptActorGetProto(int16 *) {
int16 scriptActorSetProto(int16 *args) {
OBJLOG(SetProto);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
int16 oldProto = obj->getProtoNum();
if (isActor(obj) && (((Actor *)obj)->_flags & Actor::temporary)) {
@@ -344,7 +344,7 @@ int16 scriptActorSetProto(int16 *args) {
int16 scriptActorGetProtoClass(int16 *) {
OBJLOG(GetProtoClass);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
ProtoObj *objProto = obj->proto();
return objProto->classType;
@@ -356,7 +356,7 @@ int16 scriptActorGetProtoClass(int16 *) {
int16 scriptActorGetScript(int16 *) {
OBJLOG(GetScript);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->getScript();
}
@@ -366,7 +366,7 @@ int16 scriptActorGetScript(int16 *) {
int16 scriptActorSetScript(int16 *args) {
OBJLOG(SetScript);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
int16 oldScript = obj->getScript();
obj->setScript(args[0]);
@@ -380,7 +380,7 @@ int16 scriptActorSetScript(int16 *args) {
int16 scriptGameObjectUse(int16 *args) {
OBJLOG(Use);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->use(args[0]);
}
@@ -391,7 +391,7 @@ int16 scriptGameObjectUse(int16 *args) {
int16 scriptGameObjectUseOn(int16 *args) {
OBJLOG(UseOn);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->useOn(args[0], args[1]);
}
@@ -402,7 +402,7 @@ int16 scriptGameObjectUseOn(int16 *args) {
int16 scriptGameObjectUseOnTAI(int16 *args) {
OBJLOG(UseOnTAI);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->useOn(args[0], ActiveItem::activeItemAddress(args[1]));
}
@@ -418,7 +418,7 @@ int16 scriptGameObjectUseOnTAI(int16 *args) {
int16 scriptGameObjectDrop(int16 *args) {
OBJLOG(Drop);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->drop(
args[0],
@@ -431,7 +431,7 @@ int16 scriptGameObjectDrop(int16 *args) {
int16 scriptGameObjectDropOn(int16 *args) {
OBJLOG(DropOn);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->dropOn(args[0], args[1]);
}
@@ -445,7 +445,7 @@ int16 scriptGameObjectDropOn(int16 *args) {
int16 scriptGameObjectDropMergeableOn(int16 *args) {
OBJLOG(DropMergeableOn);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->dropOn(args[0], args[1], args[2]);
}
@@ -462,7 +462,7 @@ int16 scriptGameObjectDropMergeableOn(int16 *args) {
int16 scriptGameObjectDropOnTAI(int16 *args) {
OBJLOG(DropOnTAI);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->dropOn(
args[0],
@@ -486,7 +486,7 @@ int16 scriptActorSay(int16 *args) {
// };
// 'obj' is the actor doing the speaking.
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
uint16 flags = args[0];
Speech *sp;
@@ -513,7 +513,7 @@ int16 scriptActorSay(int16 *args) {
// Loop through each of the arguments.
// REM: Might want to do some range checking on the arguments.
- for (int i = 1; i < thisThread->argCount; i += 2) {
+ for (int i = 1; i < thisThread->_argCount; i += 2) {
uint16 sampleNum = args[i];
char *speechText = STRING(args[i + 1]);
@@ -544,7 +544,7 @@ int16 scriptActorSay(int16 *args) {
int16 scriptActorSayText(int16 *args) {
OBJLOG(SayText);
// 'obj' is the actor doing the speaking.
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
Speech *sp;
char buffer[256];
@@ -564,7 +564,7 @@ int16 scriptActorSayText(int16 *args) {
int16 scriptActorObjectType(int16 *) {
OBJLOG(ObjectType);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return (int16)(obj->containmentSet());
}
@@ -575,7 +575,7 @@ int16 scriptActorObjectType(int16 *) {
int16 scriptActorCopyObject(int16 *) {
OBJLOG(CopyObject);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
Location l(0, 0, 0, Nothing);
return (int16)(obj->copy(l));
@@ -587,7 +587,7 @@ int16 scriptActorCopyObject(int16 *) {
int16 scriptGameObjectIsActivated(int16 *args) {
OBJLOG(IsActivated);
- return (((ObjectData *)thisThread->thisObject)->obj)->isActivated();
+ return (((ObjectData *)thisThread->_thisObject)->obj)->isActivated();
}
//-----------------------------------------------------------------------
@@ -595,28 +595,28 @@ int16 scriptGameObjectIsActivated(int16 *args) {
int16 scriptActorGetOpen(int16 *) {
OBJLOG(GetOpen);
- return (((ObjectData *)thisThread->thisObject)->obj)->isOpen();
+ return (((ObjectData *)thisThread->_thisObject)->obj)->isOpen();
}
int16 scriptActorGetLocked(int16 *) {
OBJLOG(GetLocked);
- return (((ObjectData *)thisThread->thisObject)->obj)->isLocked();
+ return (((ObjectData *)thisThread->_thisObject)->obj)->isLocked();
}
int16 scriptActorGetImportant(int16 *) {
OBJLOG(GetImportant);
- return (((ObjectData *)thisThread->thisObject)->obj)->isImportant();
+ return (((ObjectData *)thisThread->_thisObject)->obj)->isImportant();
}
int16 scriptActorGetScavengable(int16 *) {
OBJLOG(GetScavengable);
- return (((ObjectData *)thisThread->thisObject)->obj)->isScavengable();
+ return (((ObjectData *)thisThread->_thisObject)->obj)->isScavengable();
}
/*
int16 scriptActorSetOpen( int16 *args )
{
- (((ObjectData *)thisThread->thisObject)->obj)->setFlags(
+ (((ObjectData *)thisThread->_thisObject)->obj)->setFlags(
args[0] ? 0xffff : 0,
objectOpen );
return 0;
@@ -624,7 +624,7 @@ int16 scriptActorSetOpen( int16 *args )
int16 scriptActorSetLocked( int16 *args )
{
- (((ObjectData *)thisThread->thisObject)->obj)->setFlags(
+ (((ObjectData *)thisThread->_thisObject)->obj)->setFlags(
args[0] ? 0xffff : 0,
objectLocked );
return 0;
@@ -633,7 +633,7 @@ int16 scriptActorSetLocked( int16 *args )
int16 scriptActorSetImportant(int16 *args) {
OBJLOG(SetImportant);
- (((ObjectData *)thisThread->thisObject)->obj)->setFlags(
+ (((ObjectData *)thisThread->_thisObject)->obj)->setFlags(
args[0] ? (int16) 0xffff : (int16) 0,
objectImportant);
return 0;
@@ -641,7 +641,7 @@ int16 scriptActorSetImportant(int16 *args) {
int16 scriptActorSetScavengable(int16 *args) {
OBJLOG(SetScavengable);
- (((ObjectData *)thisThread->thisObject)->obj)->setFlags(
+ (((ObjectData *)thisThread->_thisObject)->obj)->setFlags(
args[0] ? (int16) 0xffff : (int16) 0,
objectScavengable);
return 0;
@@ -653,7 +653,7 @@ int16 scriptActorSetScavengable(int16 *args) {
int16 scriptGameObjectAddTimer(int16 *args) {
OBJLOG(AddTimer);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addTimer(args[0], args[1]);
}
@@ -665,7 +665,7 @@ int16 scriptGameObjectAddTimer(int16 *args) {
int16 scriptGameObjectAddStdTimer(int16 *args) {
OBJLOG(AddStdTimer);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addTimer(args[0]);
}
@@ -676,7 +676,7 @@ int16 scriptGameObjectAddStdTimer(int16 *args) {
int16 scriptGameObjectRemoveTimer(int16 *args) {
OBJLOG(RemoveTimer);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->removeTimer(args[0]);
@@ -689,7 +689,7 @@ int16 scriptGameObjectRemoveTimer(int16 *args) {
int16 scriptGameObjectRemoveAllTimers(int16 *args) {
OBJLOG(RemoveAllTimers);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->removeAllTimers();
@@ -703,7 +703,7 @@ int16 scriptGameObjectRemoveAllTimers(int16 *args) {
int16 scriptGameObjectAddProtaganistSensor(int16 *args) {
OBJLOG(AddProtaganistSensor);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addProtaganistSensor(args[0], args[1]);
}
@@ -720,7 +720,7 @@ int16 scriptGameObjectAddSpecificActorSensor(int16 *args) {
OBJLOG(AddSpecificActorSensor);
assert(isActor(args[2]));
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addSpecificActorSensor(
args[0],
@@ -740,7 +740,7 @@ int16 scriptGameObjectAddSpecificObjectSensor(int16 *args) {
OBJLOG(AddSpecificObjectSensor);
assert(isObject(args[2]) || isActor(args[2]));
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addSpecificObjectSensor(args[0], args[1], args[2]);
}
@@ -755,7 +755,7 @@ int16 scriptGameObjectAddSpecificObjectSensor(int16 *args) {
int16 scriptGameObjectAddActorPropertySensor(int16 *args) {
OBJLOG(AddActorPropertySensor);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addActorPropertySensor(args[0], args[1], args[2]);
}
@@ -770,7 +770,7 @@ int16 scriptGameObjectAddActorPropertySensor(int16 *args) {
int16 scriptGameObjectAddObjectPropertySensor(int16 *args) {
OBJLOG(AddObjectPropertySensor);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addObjectPropertySensor(args[0], args[1], args[2]);
}
@@ -782,7 +782,7 @@ int16 scriptGameObjectAddObjectPropertySensor(int16 *args) {
int16 scriptGameObjectAddEventSensor(int16 *args) {
OBJLOG(AddEventSensor);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->addEventSensor(
args[0],
@@ -796,7 +796,7 @@ int16 scriptGameObjectAddEventSensor(int16 *args) {
int16 scriptGameObjectRemoveSensor(int16 *args) {
OBJLOG(RemoveSensor);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->removeSensor(args[0]);
@@ -809,7 +809,7 @@ int16 scriptGameObjectRemoveSensor(int16 *args) {
int16 scriptGameObjectRemoveAllSensors(int16 *args) {
OBJLOG(RemoveAllSensors);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->removeAllSensors();
@@ -822,11 +822,11 @@ int16 scriptGameObjectRemoveAllSensors(int16 *args) {
int16 scriptGameObjectCanSenseProtaganist(int16 *args) {
OBJLOG(CanSenseProtaganist);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
SenseInfo info;
if (obj->canSenseProtaganist(info, args[0])) {
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.enactor = obj->thisID();
scf.directObject = info.sensedObject->thisID();
@@ -846,14 +846,14 @@ int16 scriptGameObjectCanSenseSpecificActor(int16 *args) {
OBJLOG(CanSenseSpecificActor);
assert(isActor(args[1]));
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
SenseInfo info;
if (obj->canSenseSpecificActor(
info,
args[0],
(Actor *)GameObject::objectAddress(args[1]))) {
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.enactor = obj->thisID();
scf.directObject = info.sensedObject->thisID();
@@ -873,11 +873,11 @@ int16 scriptGameObjectCanSenseSpecificObject(int16 *args) {
OBJLOG(CanSenseSpecificObject);
assert(isObject(args[1]) || isActor(args[1]));
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
SenseInfo info;
if (obj->canSenseSpecificObject(info, args[0], args[1])) {
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.enactor = obj->thisID();
scf.directObject = info.sensedObject->thisID();
@@ -895,11 +895,11 @@ int16 scriptGameObjectCanSenseSpecificObject(int16 *args) {
int16 scriptGameObjectCanSenseActorProperty(int16 *args) {
OBJLOG(CanSenseActorProperty);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
SenseInfo info;
if (obj->canSenseActorProperty(info, args[0], args[1])) {
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.enactor = obj->thisID();
scf.directObject = info.sensedObject->thisID();
@@ -917,11 +917,11 @@ int16 scriptGameObjectCanSenseActorProperty(int16 *args) {
int16 scriptGameObjectCanSenseObjectProperty(int16 *args) {
OBJLOG(CanSenseObjectProperty);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
SenseInfo info;
if (obj->canSenseObjectProperty(info, args[0], args[1])) {
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.enactor = obj->thisID();
scf.directObject = info.sensedObject->thisID();
@@ -938,7 +938,7 @@ int16 scriptGameObjectCanSenseObjectProperty(int16 *args) {
int16 scriptGameObjectGetActualScript(int16 *) {
OBJLOG(GetActualScript);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
int16 script;
script = obj->getScript();
@@ -953,7 +953,7 @@ int16 scriptGameObjectGetActualScript(int16 *) {
int16 scriptGameObjectGetProtoScript(int16 *) {
OBJLOG(GetProtoScript);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->proto()->script;
}
@@ -964,7 +964,7 @@ int16 scriptGameObjectGetProtoScript(int16 *) {
int16 scriptGameObjectGetMass(int16 *) {
OBJLOG(GetMass);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return (obj->proto()->flags & ResourceObjectPrototype::objPropMergeable)
? obj->getExtra() : 1;
@@ -976,7 +976,7 @@ int16 scriptGameObjectGetMass(int16 *) {
int16 scriptGameObjectSetMass(int16 *args) {
OBJLOG(SetMass);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
if (obj->proto()->flags & ResourceObjectPrototype::objPropMergeable) {
obj->setExtra(args[0]);
@@ -993,7 +993,7 @@ int16 scriptGameObjectSetMass(int16 *args) {
int16 scriptGameObjectGetExtra(int16 *) {
OBJLOG(GetExtra);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->getExtra();
}
@@ -1004,7 +1004,7 @@ int16 scriptGameObjectGetExtra(int16 *) {
int16 scriptGameObjectSetExtra(int16 *args) {
OBJLOG(SetExtra);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->setExtra(args[0]);
@@ -1042,7 +1042,7 @@ int16 deepCopy(GameObject *src, ObjectID parentID, TilePoint tp) {
int16 scriptGameObjectDeepCopy(int16 *args) {
OBJLOG(DeepCopy);
ObjectID newParentID = args[0];
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj,
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj,
*newParent = GameObject::objectAddress(newParentID),
*newObj;
ObjectID id;
@@ -1069,7 +1069,7 @@ int16 scriptGameObjectDeepCopy(int16 *args) {
int16 scriptGameObjectAddEnchantment(int16 *args) {
OBJLOG(Enchant);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return EnchantObject(obj->thisID(),
makeEnchantmentID(args[0], args[1], args[2]),
@@ -1082,7 +1082,7 @@ int16 scriptGameObjectAddEnchantment(int16 *args) {
int16 scriptGameObjectRemoveEnchantment(int16 *args) {
OBJLOG(Disenchant);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return DispelObjectEnchantment(obj->thisID(),
makeEnchantmentID(args[0], args[1], 0));
@@ -1094,7 +1094,7 @@ int16 scriptGameObjectRemoveEnchantment(int16 *args) {
int16 scriptGameObjectFindEnchantment(int16 *args) {
OBJLOG(FindEnchantment);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return FindObjectEnchantment(obj->thisID(),
makeEnchantmentID(args[0], args[1], 0));
@@ -1106,7 +1106,7 @@ int16 scriptGameObjectFindEnchantment(int16 *args) {
int16 scriptGameObjectInUse(int16 *) {
OBJLOG(InUse);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
return obj->proto()->isObjectBeingUsed(obj);
}
@@ -1117,8 +1117,8 @@ int16 scriptGameObjectInUse(int16 *) {
int16 scriptActorGetScratchVar(int16 *args) {
OBJLOG(GetScratchVar);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->_scriptVar[args[0]];
}
@@ -1132,8 +1132,8 @@ int16 scriptActorGetScratchVar(int16 *args) {
int16 scriptActorSetScratchVar(int16 *args) {
OBJLOG(SetScratchVar);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
int16 oldVal = a->_scriptVar[args[0]];
a->_scriptVar[args[0]] = args[1];
@@ -1150,8 +1150,8 @@ int16 scriptActorSetScratchVar(int16 *args) {
int16 scriptActorGetDisposition(int16 *args) {
OBJLOG(GetDisposition);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getDisposition();
}
@@ -1165,8 +1165,8 @@ int16 scriptActorGetDisposition(int16 *args) {
int16 scriptActorSetDisposition(int16 *args) {
OBJLOG(SetDisposition);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->setDisposition(args[0]);
}
@@ -1180,8 +1180,8 @@ int16 scriptActorSetDisposition(int16 *args) {
int16 scriptActorGetSkill(int16 *args) {
OBJLOG(GetSkill);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getStats()->skill(args[0]);
}
@@ -1195,8 +1195,8 @@ int16 scriptActorGetSkill(int16 *args) {
int16 scriptActorSetSkill(int16 *args) {
OBJLOG(SetSkill);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
uint8 &skillRef = a->getStats()->skill(args[0]);
uint8 oldVal = skillRef;
@@ -1214,8 +1214,8 @@ int16 scriptActorSetSkill(int16 *args) {
int16 scriptActorGetBaseSkill(int16 *args) {
OBJLOG(GetBaseSkill);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getBaseStats()->skill(args[0]);
}
@@ -1229,8 +1229,8 @@ int16 scriptActorGetBaseSkill(int16 *args) {
int16 scriptActorSetBaseSkill(int16 *args) {
OBJLOG(SetBaseSkill);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
uint8 &skillRef = a->getBaseStats()->skill(args[0]);
uint8 oldVal = skillRef;
@@ -1250,8 +1250,8 @@ int16 scriptActorSetBaseSkill(int16 *args) {
int16 scriptActorGetVitality(int16 *) {
OBJLOG(GetVitality);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
debugC(2, kDebugScripts, " - value = %d", a->getStats()->vitality);
return a->getStats()->vitality;
@@ -1266,8 +1266,8 @@ int16 scriptActorGetVitality(int16 *) {
int16 scriptActorSetVitality(int16 *args) {
OBJLOG(SetVitality);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (a->_godmode)
return 0;
@@ -1292,8 +1292,8 @@ int16 scriptActorSetVitality(int16 *args) {
int16 scriptActorGetBaseVitality(int16 *) {
OBJLOG(GetBaseVitality);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getBaseStats()->vitality;
}
@@ -1307,8 +1307,8 @@ int16 scriptActorGetBaseVitality(int16 *) {
int16 scriptActorSetBaseVitality(int16 *args) {
OBJLOG(SetBaseVitality);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
int16 &vitalityRef = a->getBaseStats()->vitality;
int16 oldVal = vitalityRef;
PlayerActorID pID;
@@ -1331,8 +1331,8 @@ int16 scriptActorSetBaseVitality(int16 *args) {
int16 scriptActorGetMana(int16 *args) {
OBJLOG(GetMana);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getStats()->mana(args[0]);
}
@@ -1346,8 +1346,8 @@ int16 scriptActorGetMana(int16 *args) {
int16 scriptActorSetMana(int16 *args) {
OBJLOG(SetMana);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
int16 &manaRef = a->getStats()->mana(args[0]);
int16 oldVal = manaRef;
PlayerActorID pID;
@@ -1367,8 +1367,8 @@ int16 scriptActorSetMana(int16 *args) {
int16 scriptActorGetBaseMana(int16 *args) {
OBJLOG(GetBaseMana);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->getBaseStats()->mana(args[0]);
}
@@ -1382,8 +1382,8 @@ int16 scriptActorGetBaseMana(int16 *args) {
int16 scriptActorSetBaseMana(int16 *args) {
OBJLOG(SetBaseMana);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
int16 &manaRef = a->getBaseStats()->mana(args[0]);
int16 oldVal = manaRef;
PlayerActorID pID;
@@ -1404,8 +1404,8 @@ int16 scriptActorSetBaseMana(int16 *args) {
int16 scriptActorGetSchedule(int16 *args) {
OBJLOG(GetSchedule);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->_schedule;
}
@@ -1419,8 +1419,8 @@ int16 scriptActorGetSchedule(int16 *args) {
int16 scriptActorSetSchedule(int16 *args) {
OBJLOG(SetSchedule);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
uint16 oldSchedule = a->_schedule;
a->_schedule = (uint16)args[0];
@@ -1440,8 +1440,8 @@ int16 scriptActorSetSchedule(int16 *args) {
int16 scriptActorLobotomize(int16 *args) {
OBJLOG(Lobotomize);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
a->lobotomize();
}
@@ -1455,8 +1455,8 @@ int16 scriptActorLobotomize(int16 *args) {
int16 scriptActorDelobotomize(int16 *args) {
OBJLOG(Delobotomize);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
a->delobotomize();
}
@@ -1470,8 +1470,8 @@ int16 scriptActorDelobotomize(int16 *args) {
int16 scriptActorIsActionAvailable(int16 *args) {
OBJLOG(IsActionAvailable);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->isActionAvailable(args[0], args[1]);
}
@@ -1487,8 +1487,8 @@ int16 scriptActorIsActionAvailable(int16 *args) {
int16 scriptActorSetAction(int16 *args) {
OBJLOG(SetAction);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->setAction(args[0], args[1]);
}
@@ -1503,8 +1503,8 @@ int16 scriptActorSetAction(int16 *args) {
int16 scriptActorAnimationFrames(int16 *args) {
OBJLOG(AnimationFrames);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->animationFrames(args[0], args[1]);
}
@@ -1520,8 +1520,8 @@ int16 scriptActorAnimationFrames(int16 *args) {
int16 scriptActorNextAnimationFrame(int16 *args) {
OBJLOG(NextAnimationFrame);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->nextAnimationFrame();
}
@@ -1537,8 +1537,8 @@ int16 scriptActorFace(int16 *args) {
OBJLOG(Face);
int16 oldFacing = 0;
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
oldFacing = a->_currentFacing;
@@ -1557,10 +1557,10 @@ int16 scriptActorFaceTowards(int16 *args) {
OBJLOG(FaceTowards);
int16 oldFacing = 0;
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
assert(isObject(args[0]) || isActor(args[0]));
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
oldFacing = a->_currentFacing;
@@ -1578,8 +1578,8 @@ int16 scriptActorFaceTowards(int16 *args) {
int16 scriptActorTurn(int16 *args) {
OBJLOG(Turn);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (a->isDead()) return 0;
@@ -1603,10 +1603,10 @@ int16 scriptActorTurn(int16 *args) {
int16 scriptActorTurnTowards(int16 *args) {
OBJLOG(TurnTowards);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
assert(isObject(args[0]) || isActor(args[0]));
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (a->isDead()) return 0;
@@ -1633,8 +1633,8 @@ int16 scriptActorTurnTowards(int16 *args) {
int16 scriptActorWalk(int16 *args) {
OBJLOG(Walk);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (a->isDead()) return 0;
@@ -1665,8 +1665,8 @@ int16 scriptActorWalk(int16 *args) {
int16 scriptActorAssignPatrolRoute(int16 *args) {
OBJLOG(AssignPatrolRoute);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
// Delete the actor's current assignment
if (a->getAssignment() != nullptr) delete a->getAssignment();
@@ -1676,7 +1676,7 @@ int16 scriptActorAssignPatrolRoute(int16 *args) {
* CalenderTime::kFramesPerHour,
args[1],
(uint8)args[2],
- thisThread->argCount >= 4
+ thisThread->_argCount >= 4
? args[3]
: -1)
!= nullptr)
@@ -1697,8 +1697,8 @@ int16 scriptActorAssignPatrolRoute(int16 *args) {
int16 scriptActorAssignPartialPatrolRoute(int16 *args) {
OBJLOG(AssignPartialPatrolRoute);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
// Delete the actor's current assignment
if (a->getAssignment() != nullptr) delete a->getAssignment();
@@ -1729,8 +1729,8 @@ int16 scriptActorAssignPartialPatrolRoute(int16 *args) {
int16 scriptActorAssignBeNearLocation(int16 *args) {
OBJLOG(AssignBeNearLocation);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
TilePoint targetLoc = TilePoint(args[1], args[2], args[3]);
// Delete the actor's current assignment
@@ -1758,10 +1758,10 @@ int16 scriptActorAssignBeNearLocation(int16 *args) {
int16 scriptActorAssignBeNearActor(int16 *args) {
OBJLOG(AssignBeNearActor);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
assert(isActor(args[1]));
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj,
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj,
*targetActor;
targetActor = (Actor *)GameObject::objectAddress(args[1]);
@@ -1787,10 +1787,10 @@ int16 scriptActorAssignBeNearActor(int16 *args) {
int16 scriptActorAssignKillActor(int16 *args) {
OBJLOG(AssignKillActor);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
assert(isActor(args[1]));
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj,
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj,
*targetActor;
targetActor = (Actor *)GameObject::objectAddress(args[1]);
@@ -1820,8 +1820,8 @@ int16 scriptActorAssignKillActor(int16 *args) {
int16 scriptActorAssignTetheredWander(int16 *args) {
OBJLOG(AssignTetheredWander);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
// Delete the actor's current assignment
if (a->getAssignment() != nullptr) delete a->getAssignment();
@@ -1864,8 +1864,8 @@ int16 scriptActorAssignTetheredWander(int16 *args) {
int16 scriptActorAssignAttend(int16 *args) {
OBJLOG(AssignAttend);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
// Delete the actor's current assignment
if (a->getAssignment() != nullptr) delete a->getAssignment();
@@ -1888,8 +1888,8 @@ int16 scriptActorAssignAttend(int16 *args) {
int16 scriptActorRemoveAssignment(int16 *args) {
OBJLOG(removeAssignment);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (a->getAssignment() != nullptr) delete a->getAssignment();
}
@@ -1903,8 +1903,8 @@ int16 scriptActorRemoveAssignment(int16 *args) {
int16 scriptActorBandWith(int16 *args) {
OBJLOG(BandWith);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
assert(isActor(args[0]));
@@ -1920,8 +1920,8 @@ int16 scriptActorBandWith(int16 *args) {
int16 scriptActorDisband(int16 *) {
OBJLOG(Disband);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
a->disband();
}
@@ -1935,8 +1935,8 @@ int16 scriptActorDisband(int16 *) {
int16 scriptActorGetLeader(int16 *) {
OBJLOG(GetLeader);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->_leader != nullptr ? a->_leader->thisID() : Nothing;
}
@@ -1950,8 +1950,8 @@ int16 scriptActorGetLeader(int16 *) {
int16 scriptActorNumFollowers(int16 *) {
OBJLOG(ActorNumFollowers);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
return a->_followers != nullptr ? a->_followers->size() : 0;
}
@@ -1965,8 +1965,8 @@ int16 scriptActorNumFollowers(int16 *) {
int16 scriptActorGetFollower(int16 *args) {
OBJLOG(GetFollower);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
assert(a->_followers != nullptr);
assert(args[0] < a->_followers->size());
@@ -1984,13 +1984,13 @@ int16 scriptActorGetFollower(int16 *args) {
int16 scriptActorUseKnowledge(int16 *) {
OBJLOG(UseKnowledge);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
- a->useKnowledge(thisThread->threadArgs);
+ a->useKnowledge(thisThread->_threadArgs);
}
- return thisThread->threadArgs.returnVal;
+ return thisThread->_threadArgs.returnVal;
}
//-----------------------------------------------------------------------
@@ -1999,8 +1999,8 @@ int16 scriptActorUseKnowledge(int16 *) {
int16 scriptActorAddKnowledge(int16 *args) {
OBJLOG(AddKnowledge);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
a->addKnowledge(args[0]);
}
@@ -2014,8 +2014,8 @@ int16 scriptActorAddKnowledge(int16 *args) {
int16 scriptActorDeleteKnowledge(int16 *args) {
OBJLOG(DeleteKnowledge);
- if (isActor(((ObjectData *)thisThread->thisObject)->obj)) {
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ if (isActor(((ObjectData *)thisThread->_thisObject)->obj)) {
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
if (args[0] == 0) a->clearKnowledge();
else a->removeKnowledge(args[0]);
@@ -2030,7 +2030,7 @@ int16 scriptActorDeleteKnowledge(int16 *args) {
int16 scriptActorAddMissionKnowledge(int16 *args) {
OBJLOG(AddMissionKnowledge);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
ActiveMission *am = ActiveMission::missionAddress(args[0]);
if (isActor(obj)) {
@@ -2045,7 +2045,7 @@ int16 scriptActorAddMissionKnowledge(int16 *args) {
int16 scriptActorDeleteMissionKnowledge(int16 *args) {
OBJLOG(DeleteMissionKnowledge);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
ActiveMission *am = ActiveMission::missionAddress(args[0]);
if (isActor(obj)) {
@@ -2060,7 +2060,7 @@ int16 scriptActorDeleteMissionKnowledge(int16 *args) {
int16 scriptActorDeductPayment(int16 *args) {
OBJLOG(DeductPayment);
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
ProtoObj *currencyProto = g_vm->_objectProtos[args[0]];
int32 paymentAmount = args[1];
@@ -2138,7 +2138,7 @@ int16 scriptActorDeductPayment(int16 *args) {
int16 scriptActorCountPayment(int16 *args) {
OBJLOG(CountPayment);
- Actor *a = (Actor *)((ObjectData *)thisThread->thisObject)->obj;
+ Actor *a = (Actor *)((ObjectData *)thisThread->_thisObject)->obj;
ProtoObj *currencyProto = g_vm->_objectProtos[args[0]];
int32 paymentFound = 0;
@@ -2165,7 +2165,7 @@ int16 scriptActorCountPayment(int16 *args) {
int16 scriptActorAcceptHealing(int16 *args) {
OBJLOG(acceptHealing);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->acceptHealing(obj->thisID(), args[0]);
return 0;
@@ -2177,7 +2177,7 @@ int16 scriptActorAcceptHealing(int16 *args) {
int16 scriptActorAcceptDamage(int16 *args) {
OBJLOG(acceptHealing);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
obj->acceptDamage(args[0], args[1], (enum effectDamageTypes)args[2]);
return 0;
@@ -2189,7 +2189,7 @@ int16 scriptActorAcceptDamage(int16 *args) {
int16 scriptActorImNotQuiteDead(int16 *args) {
OBJLOG(imNotQuiteDead);
- GameObject *obj = ((ObjectData *)thisThread->thisObject)->obj;
+ GameObject *obj = ((ObjectData *)thisThread->_thisObject)->obj;
if (isActor(obj)) {
((Actor *)obj)->imNotQuiteDead();
@@ -2348,7 +2348,7 @@ CallTable actorCFuncs = { actorCFuncList, ARRAYSIZE(actorCFuncList), 0 };
int16 scriptTagThisID(int16 *) {
MONOLOG(TAG::ThisID);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->thisID();
}
@@ -2359,7 +2359,7 @@ int16 scriptTagThisID(int16 *) {
int16 scriptTagGetState(int16 *args) {
MONOLOG(TAG::GetState);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->getInstanceState(ai->getMapNum());
}
@@ -2370,7 +2370,7 @@ int16 scriptTagGetState(int16 *args) {
int16 scriptTagSetState(int16 *args) {
MONOLOG(TAG::SetState);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
ai->setInstanceState(ai->getMapNum(), args[0]);
@@ -2383,7 +2383,7 @@ int16 scriptTagSetState(int16 *args) {
int16 scriptTagNumAssoc(int16 *args) {
MONOLOG(TAG::NumAssoc);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->_data.numAssociations;
}
@@ -2394,7 +2394,7 @@ int16 scriptTagNumAssoc(int16 *args) {
int16 scriptTagAssoc(int16 *args) {
MONOLOG(TAG::Assoc);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
int mapNum = ai->getMapNum();
assert(args[0] >= 0);
@@ -2411,7 +2411,7 @@ int16 scriptTagAssoc(int16 *args) {
int16 scriptTagGetTargetU(int16 *args) {
MONOLOG(TAG::GetTargetU);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->_data.instance.targetU;
}
@@ -2422,7 +2422,7 @@ int16 scriptTagGetTargetU(int16 *args) {
int16 scriptTagGetTargetV(int16 *) {
MONOLOG(TAG::GetTargetV);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->_data.instance.targetV;
}
@@ -2433,7 +2433,7 @@ int16 scriptTagGetTargetV(int16 *) {
int16 scriptTagGetTargetZ(int16 *) {
MONOLOG(TAG::GetTargetZ);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->_data.instance.targetZ;
}
@@ -2444,7 +2444,7 @@ int16 scriptTagGetTargetZ(int16 *) {
int16 scriptTagGetTargetW(int16 *) {
MONOLOG(TAG::GetTargetW);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->_data.instance.worldNum;
}
@@ -2455,7 +2455,7 @@ int16 scriptTagGetTargetW(int16 *) {
int16 scriptTagIsLocked(int16 *) {
MONOLOG(TAG::IsLocked);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->isLocked() ? true : false;
}
@@ -2467,7 +2467,7 @@ int16 scriptTagIsLocked(int16 *) {
int16 scriptTagSetLocked(int16 *args) {
MONOLOG(TAG::SetLocked);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
ai->setLocked(args[0]);
@@ -2480,7 +2480,7 @@ int16 scriptTagSetLocked(int16 *args) {
int16 scriptTagGetKeyType(int16 *) {
MONOLOG(TAG::GetKeyType);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return ai->lockType();
}
@@ -2491,7 +2491,7 @@ int16 scriptTagGetKeyType(int16 *) {
int16 scriptTagUse(int16 *args) {
MONOLOG(TAG::Use);
- ActiveItem *tai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *tai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
return tai->use(args[0]);
}
@@ -2507,7 +2507,7 @@ enum {
int16 scriptTagSetAnimation(int16 *args) {
MONOLOG(TAG::SetAnimation);
extern uint32 parse_res_id(char IDstr[]);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
//TilePoint tagLoc;
int32 soundID = parse_res_id(STRING(args[2]));
Location ail = ai->getInstanceLocation();
@@ -2541,7 +2541,7 @@ int16 scriptTagSetAnimation(int16 *args) {
int16 scriptTagSetWait(int16 *args) {
MONOLOG(TAG::SetAnimation);
extern uint32 parse_res_id(char IDstr[]);
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
if (TileActivityTask::setWait(ai, getThreadID(thisThread))) {
// Wait for the animation
@@ -2561,7 +2561,7 @@ static int16 lockCount;
#endif
int16 scriptTagObtainLock(int16 *) {
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
if (ai->isExclusive() == false) {
ai->setExclusive(true);
@@ -2580,7 +2580,7 @@ int16 scriptTagObtainLock(int16 *) {
}
int16 scriptTagReleaseLock(int16 *) {
- ActiveItem *ai = ((ActiveItemData *)thisThread->thisObject)->aItem;
+ ActiveItem *ai = ((ActiveItemData *)thisThread->_thisObject)->aItem;
ai->setExclusive(false);
#if DEBUG*0
@@ -2621,7 +2621,7 @@ CallTable tagCFuncs = { tagCFuncList, ARRAYSIZE(tagCFuncList), 0 };
int16 scriptMissionDelete(int16 *args) {
MONOLOG(ActiveMission::Delete);
- ActiveMission *am = ((ActiveMissionData *)thisThread->thisObject)->aMission;
+ ActiveMission *am = ((ActiveMissionData *)thisThread->_thisObject)->aMission;
am->cleanup();
return 0;
@@ -2637,7 +2637,7 @@ int16 scriptMakeObject(int16 *args);
int16 scriptMissionMakeObject(int16 *args) {
MONOLOG(TAG::MakeObject);
- ActiveMission *am = ((ActiveMissionData *)thisThread->thisObject)->aMission;
+ ActiveMission *am = ((ActiveMissionData *)thisThread->_thisObject)->aMission;
ObjectID id;
// If there's room in the mission to record the existence of the object
@@ -2666,7 +2666,7 @@ int16 scriptMakeActor(int16 *args);
int16 scriptMissionMakeActor(int16 *args) {
MONOLOG(ActiveMission::MakeActor);
- ActiveMission *am = ((ActiveMissionData *)thisThread->thisObject)->aMission;
+ ActiveMission *am = ((ActiveMissionData *)thisThread->_thisObject)->aMission;
ObjectID id;
// If there's room in the mission to record the existence of the actor
@@ -2850,7 +2850,7 @@ int16 scriptSetGameMode(int16 *args) {
int16 scriptWait(int16 *args) {
MONOLOG(Wait);
- thisThread->waitAlarm.set(args[0]);
+ thisThread->_waitAlarm.set(args[0]);
thisThread->waitForEvent(Thread::waitDelay, nullptr);
thisThread->setExtended();
return 0;
@@ -2858,7 +2858,7 @@ int16 scriptWait(int16 *args) {
int16 scriptWaitFrames(int16 *args) {
MONOLOG(WaitFrames);
- thisThread->waitFrameAlarm.set(args[0]);
+ thisThread->_waitFrameAlarm.set(args[0]);
thisThread->waitForEvent(Thread::waitFrameDelay, nullptr);
thisThread->setExtended();
return 0;
@@ -3151,7 +3151,7 @@ int16 scriptWorldNum2Object(int16 *args) {
int16 scriptAppendBookText(int16 *args) {
MONOLOG(AppendBookText);
// If optional 4th parameter is present, then set actor facing
- for (int i = 0; i < thisThread->argCount; i++) {
+ for (int i = 0; i < thisThread->_argCount; i++) {
char *bookText = STRING(args[i]);
appendBookText(bookText);
@@ -3182,7 +3182,7 @@ int16 scriptAppendScrollTextF(int16 *args) {
int16 scriptAppendScrollText(int16 *args) {
MONOLOG(AppendScrollText);
// If optional 4th parameter is present, then set actor facing
- for (int i = 0; i < thisThread->argCount; i++) {
+ for (int i = 0; i < thisThread->_argCount; i++) {
char *ScrollText = STRING(args[i]);
appendBookText(ScrollText);
@@ -3358,7 +3358,7 @@ int16 scriptSelectNearbySite(int16 *args) {
args[6]);
if (tp == Nowhere) return 0;
- scriptCallFrame &scf = thisThread->threadArgs;
+ scriptCallFrame &scf = thisThread->_threadArgs;
scf.coords = tp;
return true;
@@ -3373,7 +3373,7 @@ int16 scriptPickRandomLivingActor(int16 *args) {
int livingCount = 0,
i;
- for (i = 0; i < thisThread->argCount; i++) {
+ for (i = 0; i < thisThread->_argCount; i++) {
if (isActor(args[i])) {
Actor *a = (Actor *)GameObject::objectAddress(args[i]);
@@ -3385,7 +3385,7 @@ int16 scriptPickRandomLivingActor(int16 *args) {
livingCount = g_vm->_rnd->getRandomNumber(livingCount - 1);
- for (i = 0; i < thisThread->argCount; i++) {
+ for (i = 0; i < thisThread->_argCount; i++) {
if (isActor(args[i])) {
Actor *a = (Actor *)GameObject::objectAddress(args[i]);
@@ -3484,9 +3484,9 @@ int16 scriptSearchRegion(int16 *args) {
for (searchObj = iter.first(nullptr);
searchObj != Nothing;
searchObj = iter.next(nullptr)) {
- // Starting from the 5th argument, until we reach argCount,
+ // Starting from the 5th argument, until we reach _argCount,
// see if the iterated object matches one in the arg list
- for (int i = 5; i < thisThread->argCount; i++) {
+ for (int i = 5; i < thisThread->_argCount; i++) {
if (args[i] == searchObj) {
count++;
break;
@@ -3828,12 +3828,12 @@ int16 scriptFadeUp(int16 *) {
int16 scriptSetSynchronous(int16 *args) {
MONOLOG(SetSynchronous);
- int16 oldVal = (thisThread->flags & Thread::synchronous) != 0;
+ int16 oldVal = (thisThread->_flags & Thread::synchronous) != 0;
if (args[0])
- thisThread->flags |= Thread::synchronous;
+ thisThread->_flags |= Thread::synchronous;
else
- thisThread->flags &= ~Thread::synchronous;
+ thisThread->_flags &= ~Thread::synchronous;
return oldVal;
}
diff --git a/engines/saga2/script.h b/engines/saga2/script.h
index f857132747d..24e424860ef 100644
--- a/engines/saga2/script.h
+++ b/engines/saga2/script.h
@@ -172,21 +172,20 @@ scriptResult runMethod(
class Thread {
- friend char *STRING(int strNum);
+ friend char *STRING(int strNum);
- friend scriptResult runScript(
- uint16 exportEntryNum, scriptCallFrame &args);
+ friend scriptResult runScript(uint16 exportEntryNum, scriptCallFrame &args);
friend void wakeUpThread(ThreadID, int16);
public:
- SegmentRef programCounter; // current PC location
+ SegmentRef _programCounter; // current PC location
- uint8 *stackPtr; // current stack location
- byte *codeSeg; // base of current data segment
-// *stringBase; // base of string resource
+ uint8 *_stackPtr; // current stack location
+ byte *_codeSeg; // base of current data segment
+// *_stringBase; // base of string resource
- uint8 *stackBase; // base of module stack
+ uint8 *_stackBase; // base of module stack
enum threadFlags {
waiting = (1 << 0), // thread waiting for event
@@ -201,10 +200,10 @@ public:
asleep = (waiting | finished | aborted)
};
- int16 stackSize, // allocated size of stack
- flags, // execution flags
- framePtr, // pointer to call frame
- returnVal; // return value from ccalls
+ int16 _stackSize, // allocated size of stack
+ _flags, // execution flags
+ _framePtr, // pointer to call frame
+ _returnVal; // return value from ccalls
bool _valid;
@@ -223,19 +222,19 @@ public:
// waitRequest, // a request is up
};
- enum WaitTypes waitType; // what we're waiting for
+ WaitTypes _waitType; // what we're waiting for
union {
- Alarm waitAlarm; // for time-delay
- FrameAlarm waitFrameAlarm; // for frame count delay
- ActiveItem *waitParam; // for other waiting
+ Alarm _waitAlarm; // for time-delay
+ FrameAlarm _waitFrameAlarm; // for frame count delay
+ ActiveItem *_waitParam; // for other waiting
};
- scriptCallFrame threadArgs; // arguments from C to thread
+ scriptCallFrame _threadArgs; // arguments from C to thread
// For 'cfunc' member functions, the address of the object who's
// member function is being invoked.
- void *thisObject;
- uint16 argCount; // number of args to cfunc
+ void *_thisObject;
+ uint16 _argCount; // number of args to cfunc
// Constructor
Thread(uint16 segNum, uint16 segOff, scriptCallFrame &args);
@@ -265,9 +264,9 @@ public:
// Tells thread to wait for an event
void waitForEvent(enum WaitTypes wt, ActiveItem *param) {
- flags |= waiting;
- waitType = wt;
- waitParam = param;
+ _flags |= waiting;
+ _waitType = wt;
+ _waitParam = param;
}
// Convert to extended script, and back to synchonous script
@@ -340,7 +339,7 @@ struct ResImportTable {
EXP_spellEffect_TeleportToShrine,
EXP_spellEffect_Rejoin,
EXP_spellEffect_Timequake,
- EXP_spellEffect_CreateFood ;
+ EXP_spellEffect_CreateFood;
};
extern ResImportTable *resImports;
Commit: d7d4d1b210d9c5c429f88bf8b974b801054a8762
https://github.com/scummvm/scummvm/commit/d7d4d1b210d9c5c429f88bf8b974b801054a8762
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Rename class variables in sensor.h
Changed paths:
engines/saga2/sensor.cpp
engines/saga2/sensor.h
diff --git a/engines/saga2/sensor.cpp b/engines/saga2/sensor.cpp
index 5b17341cf25..26566db1aaa 100644
--- a/engines/saga2/sensor.cpp
+++ b/engines/saga2/sensor.cpp
@@ -59,7 +59,7 @@ void deleteSensorList(SensorList *s) {
void newSensor(Sensor *s) {
g_vm->_sensorList.push_back(s);
- s->checkCtr = sensorCheckRate;
+ s->_checkCtr = sensorCheckRate;
}
//----------------------------------------------------------------------
@@ -68,7 +68,7 @@ void newSensor(Sensor *s) {
void newSensor(Sensor *s, int16 ctr) {
newSensor(s);
- s->checkCtr = ctr;
+ s->_checkCtr = ctr;
}
//----------------------------------------------------------------------
@@ -148,8 +148,8 @@ void checkSensors() {
continue;
}
- if (--sensor->checkCtr <= 0) {
- assert(sensor->checkCtr == 0);
+ if (--sensor->_checkCtr <= 0) {
+ assert(sensor->_checkCtr == 0);
SenseInfo info;
GameObject *senseobj = sensor->getObject();
@@ -166,7 +166,7 @@ void checkSensors() {
sensor->getObject()->senseObject(sensor->thisID(), info.sensedObject->thisID());
}
- sensor->checkCtr = sensorCheckRate;
+ sensor->_checkCtr = sensorCheckRate;
}
}
@@ -260,8 +260,8 @@ void saveSensors(Common::OutSaveFile *outS) {
continue;
debugC(3, kDebugSaveload, "Saving Sensor %d", getSensorID(*it));
- out->writeSint16LE((*it)->checkCtr);
- debugC(3, kDebugSaveload, "... ctr = %d", (*it)->checkCtr);
+ out->writeSint16LE((*it)->_checkCtr);
+ debugC(3, kDebugSaveload, "... ctr = %d", (*it)->_checkCtr);
writeSensor(*it, out);
}
@@ -338,7 +338,7 @@ SensorList::SensorList(Common::InSaveFile *in) {
assert(isObject(id) || isActor(id));
- obj = GameObject::objectAddress(id);
+ _obj = GameObject::objectAddress(id);
newSensorList(this);
@@ -346,9 +346,9 @@ SensorList::SensorList(Common::InSaveFile *in) {
}
void SensorList::write(Common::MemoryWriteStreamDynamic *out) {
- out->writeUint16LE(obj->thisID());
+ out->writeUint16LE(_obj->thisID());
- debugC(4, kDebugSaveload, "... objID = %d", obj->thisID());
+ debugC(4, kDebugSaveload, "... objID = %d", _obj->thisID());
}
/* ===================================================================== *
@@ -361,21 +361,21 @@ Sensor::Sensor(Common::InSaveFile *in, int16 ctr) {
assert(isObject(objID) || isActor(objID));
// Restore the object pointer
- obj = GameObject::objectAddress(objID);
+ _obj = GameObject::objectAddress(objID);
// Restore the ID
- id = in->readSint16LE();
+ _id = in->readSint16LE();
- // Restore the range
- range = in->readSint16LE();
+ // Restore the _range
+ _range = in->readSint16LE();
_active = true;
newSensor(this, ctr);
debugC(4, kDebugSaveload, "... objID = %d", objID);
- debugC(4, kDebugSaveload, "... id = %d", id);
- debugC(4, kDebugSaveload, "... range = %d", range);
+ debugC(4, kDebugSaveload, "... id = %d", _id);
+ debugC(4, kDebugSaveload, "... range = %d", _range);
}
//----------------------------------------------------------------------
@@ -383,17 +383,17 @@ Sensor::Sensor(Common::InSaveFile *in, int16 ctr) {
void Sensor::write(Common::MemoryWriteStreamDynamic *out) {
// Store the object's ID
- out->writeUint16LE(obj->thisID());
+ out->writeUint16LE(_obj->thisID());
// Store the sensor ID
- out->writeSint16LE(id);
+ out->writeSint16LE(_id);
- // Store the range
- out->writeSint16LE(range);
+ // Store the _range
+ out->writeSint16LE(_range);
- debugC(4, kDebugSaveload, "... objID = %d", obj->thisID());
- debugC(4, kDebugSaveload, "... id = %d", id);
- debugC(4, kDebugSaveload, "... range = %d", range);
+ debugC(4, kDebugSaveload, "... objID = %d", _obj->thisID());
+ debugC(4, kDebugSaveload, "... id = %d", _id);
+ debugC(4, kDebugSaveload, "... _range = %d", _range);
}
/* ===================================================================== *
@@ -442,7 +442,7 @@ bool ProtaganistSensor::check(SenseInfo &info, uint32 senseFlags) {
continue;
}
- // Skip if out of range
+ // Skip if out of _range
if (getRange() != 0
&& !getObject()->inRange(protag->getLocation(), getRange()))
continue;
@@ -502,7 +502,7 @@ bool ObjectSensor::check(SenseInfo &info, uint32 senseFlags) {
if (!(senseFlags & actorSeeInvis) && a->hasEffect(actorInvisible))
continue;
}
- // Skip if object is out of range
+ // Skip if object is out of _range
if (getRange() != 0
&& !getObject()->inRange(objToTest->getLocation(), getRange()))
continue;
@@ -541,7 +541,7 @@ SpecificObjectSensor::SpecificObjectSensor(Common::InSaveFile *in, int16 ctr) :
debugC(3, kDebugSaveload, "Loading SpecificObjectSensor");
// Restore the sought object's ID
- soughtObjID = in->readUint16LE();
+ _soughtObjID = in->readUint16LE();
}
void SpecificObjectSensor::write(Common::MemoryWriteStreamDynamic *out) {
@@ -551,7 +551,7 @@ void SpecificObjectSensor::write(Common::MemoryWriteStreamDynamic *out) {
ObjectSensor::write(out);
// Store the sought object's ID
- out->writeUint16LE(soughtObjID);
+ out->writeUint16LE(_soughtObjID);
}
//----------------------------------------------------------------------
@@ -565,10 +565,10 @@ int16 SpecificObjectSensor::getType() {
// Determine if the object can sense what it's looking for
bool SpecificObjectSensor::check(SenseInfo &info, uint32 senseFlags) {
- assert(soughtObjID != Nothing);
- assert(isObject(soughtObjID) || isActor(soughtObjID));
+ assert(_soughtObjID != Nothing);
+ assert(isObject(_soughtObjID) || isActor(_soughtObjID));
- GameObject *soughtObject = GameObject::objectAddress(soughtObjID);
+ GameObject *soughtObject = GameObject::objectAddress(_soughtObjID);
bool objIsActor = isActor(getObject());
if (senseFlags & (1 << actorBlind))
@@ -604,10 +604,10 @@ bool SpecificObjectSensor::check(SenseInfo &info, uint32 senseFlags) {
bool SpecificObjectSensor::isObjectSought(GameObject *obj_) {
assert(isObject(obj_) || isActor(obj_));
- assert(soughtObjID != Nothing);
- assert(isObject(soughtObjID) || isActor(soughtObjID));
+ assert(_soughtObjID != Nothing);
+ assert(isObject(_soughtObjID) || isActor(_soughtObjID));
- return obj_ == GameObject::objectAddress(soughtObjID);
+ return obj_ == GameObject::objectAddress(_soughtObjID);
}
/* ===================================================================== *
@@ -619,7 +619,7 @@ ObjectPropertySensor::ObjectPropertySensor(Common::InSaveFile *in, int16 ctr) :
debugC(3, kDebugSaveload, "Loading ObjectPropertySensor");
// Restore the object property ID
- objectProperty = in->readSint16LE();;
+ _objectProperty = in->readSint16LE();;
}
void ObjectPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
@@ -629,7 +629,7 @@ void ObjectPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
ObjectSensor::write(out);
// Store the object property's ID
- out->writeSint16LE(objectProperty);
+ out->writeSint16LE(_objectProperty);
}
//----------------------------------------------------------------------
@@ -645,7 +645,7 @@ int16 ObjectPropertySensor::getType() {
bool ObjectPropertySensor::isObjectSought(GameObject *obj_) {
assert(isObject(obj_) || isActor(obj_));
- return obj_->hasProperty(*g_vm->_properties->getObjProp(objectProperty));
+ return obj_->hasProperty(*g_vm->_properties->getObjProp(_objectProperty));
}
/* ===================================================================== *
@@ -673,7 +673,7 @@ SpecificActorSensor::SpecificActorSensor(Common::InSaveFile *in, int16 ctr) : Ac
assert(isActor(actorID));
// Restore the sought actor pointer
- soughtActor = (Actor *)GameObject::objectAddress(actorID);
+ _soughtActor = (Actor *)GameObject::objectAddress(actorID);
}
void SpecificActorSensor::write(Common::MemoryWriteStreamDynamic *out) {
@@ -683,7 +683,7 @@ void SpecificActorSensor::write(Common::MemoryWriteStreamDynamic *out) {
ActorSensor::write(out);
// Store the sought actor's ID
- out->writeUint16LE(soughtActor->thisID());
+ out->writeUint16LE(_soughtActor->thisID());
}
//----------------------------------------------------------------------
@@ -697,7 +697,7 @@ int16 SpecificActorSensor::getType() {
// Determine if the object can sense what it's looking for
bool SpecificActorSensor::check(SenseInfo &info, uint32 senseFlags) {
- assert(isActor(soughtActor));
+ assert(isActor(_soughtActor));
bool objIsActor = isActor(getObject());
if (senseFlags & (1 << actorBlind))
@@ -708,21 +708,21 @@ bool SpecificActorSensor::check(SenseInfo &info, uint32 senseFlags) {
// is invisible.
if (!objIsActor
|| getObject() != getCenterActor()
- || !isPlayerActor(soughtActor)) {
- if (!(senseFlags & actorSeeInvis) && soughtActor->hasEffect(actorInvisible))
+ || !isPlayerActor(_soughtActor)) {
+ if (!(senseFlags & actorSeeInvis) && _soughtActor->hasEffect(actorInvisible))
return false;
}
if (getRange() != 0
- && !getObject()->inRange(soughtActor->getLocation(), getRange()))
+ && !getObject()->inRange(_soughtActor->getLocation(), getRange()))
return false;
if (objIsActor
- && (!underSameRoof(getObject(), soughtActor)
- || !lineOfSight(getObject(), soughtActor, terrainTransparent)))
+ && (!underSameRoof(getObject(), _soughtActor)
+ || !lineOfSight(getObject(), _soughtActor, terrainTransparent)))
return false;
- info.sensedObject = soughtActor;
+ info.sensedObject = _soughtActor;
return true;
}
@@ -730,7 +730,7 @@ bool SpecificActorSensor::check(SenseInfo &info, uint32 senseFlags) {
// Determine if an actor meets the search criteria
bool SpecificActorSensor::isActorSought(Actor *a) {
- return a == soughtActor;
+ return a == _soughtActor;
}
/* ===================================================================== *
@@ -740,7 +740,7 @@ bool SpecificActorSensor::isActorSought(Actor *a) {
ActorPropertySensor::ActorPropertySensor(Common::InSaveFile *in, int16 ctr) : ActorSensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading ActorPropertySensor");
// Restore the actor property's ID
- actorProperty = in->readSint16LE();
+ _actorProperty = in->readSint16LE();
}
void ActorPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
@@ -750,7 +750,7 @@ void ActorPropertySensor::write(Common::MemoryWriteStreamDynamic *out) {
ActorSensor::write(out);
// Store the actor property's ID
- out->writeSint16LE(actorProperty);
+ out->writeSint16LE(_actorProperty);
}
//----------------------------------------------------------------------
@@ -764,7 +764,7 @@ int16 ActorPropertySensor::getType() {
// Determine if an actor meets the search criteria
bool ActorPropertySensor::isActorSought(Actor *a) {
- return a->hasProperty(*g_vm->_properties->getActorProp(actorProperty));
+ return a->hasProperty(*g_vm->_properties->getActorProp(_actorProperty));
}
/* ===================================================================== *
@@ -780,13 +780,13 @@ EventSensor::EventSensor(
int16 rng,
int16 type) :
Sensor(o, sensorID, rng),
- eventType(type) {
+ _eventType(type) {
}
EventSensor::EventSensor(Common::InSaveFile *in, int16 ctr) : Sensor(in, ctr) {
debugC(3, kDebugSaveload, "Loading EventSensor");
// Restore the event type
- eventType = in->readSint16LE();
+ _eventType = in->readSint16LE();
}
//----------------------------------------------------------------------
@@ -799,7 +799,7 @@ void EventSensor::write(Common::MemoryWriteStreamDynamic *out) {
Sensor::write(out);
// Store the event type
- out->writeSint16LE(eventType);
+ out->writeSint16LE(_eventType);
}
//----------------------------------------------------------------------
@@ -820,7 +820,7 @@ bool EventSensor::check(SenseInfo &, uint32) {
// Evaluate an event to determine if the object is waiting for it
bool EventSensor::evaluateEvent(const GameEvent &event) {
- return event.type == eventType
+ return event.type == _eventType
&& getObject()->world() == event.directObject->world()
&& (getRange() != 0
? getObject()->inRange(
diff --git a/engines/saga2/sensor.h b/engines/saga2/sensor.h
index 0434d5c087d..0569dc7cb84 100644
--- a/engines/saga2/sensor.h
+++ b/engines/saga2/sensor.h
@@ -106,14 +106,14 @@ struct SenseInfo {
* ===================================================================== */
class SensorList {
- GameObject *obj;
+ GameObject *_obj;
public:
Common::List<Sensor *> _list;
public:
// Constructor -- initial construction
- SensorList(GameObject *o) : obj(o) {
+ SensorList(GameObject *o) : _obj(o) {
newSensorList(this);
debugC(1, kDebugSensors, "Adding SensorList %p to %d (%s) (total %d)",
(void *)this, o->thisID(), o->objName(), _list.size());
@@ -122,7 +122,7 @@ public:
~SensorList() {
deleteSensorList(this);
debugC(1, kDebugSensors, "Deleting SensorList %p of %d (%s) (total %d)",
- (void *)this, obj->thisID(), obj->objName(), _list.size());
+ (void *)this, _obj->thisID(), _obj->objName(), _list.size());
}
SensorList(Common::InSaveFile *in);
@@ -136,7 +136,7 @@ public:
void write(Common::MemoryWriteStreamDynamic *out);
GameObject *getObject() {
- return obj;
+ return _obj;
}
};
@@ -146,16 +146,16 @@ public:
class Sensor {
public:
- GameObject *obj;
- SensorID id;
- int16 range;
+ GameObject *_obj;
+ SensorID _id;
+ int16 _range;
- int16 checkCtr;
+ int16 _checkCtr;
bool _active;
public:
// Constructor -- initial construction
- Sensor(GameObject *o, SensorID sensorID, int16 rng) : obj(o), id(sensorID), range(rng), _active(true) {
+ Sensor(GameObject *o, SensorID sensorID, int16 rng) : _obj(o), _id(sensorID), _range(rng), _active(true) {
newSensor(this);
SensorList *sl = fetchSensorList(o);
debugC(1, kDebugSensors, "Adding Sensor %p to %d (%s) (list = %p, total = %d)",
@@ -167,9 +167,9 @@ public:
// Virtural destructor
virtual ~Sensor() {
deleteSensor(this);
- SensorList *sl = fetchSensorList(obj);
+ SensorList *sl = fetchSensorList(_obj);
debugC(1, kDebugSensors, "Deleting Sensor %p of %d (%s) (list = %p, total = %d)",
- (void *)this, obj->thisID(), obj->objName(), (void *)sl, (sl != nullptr) ? sl->_list.size() : -1);
+ (void *)this, _obj->thisID(), _obj->objName(), (void *)sl, (sl != nullptr) ? sl->_list.size() : -1);
}
virtual void write(Common::MemoryWriteStreamDynamic *out);
@@ -178,13 +178,13 @@ public:
virtual int16 getType() = 0;
GameObject *getObject() {
- return obj;
+ return _obj;
}
SensorID thisID() {
- return id;
+ return _id;
}
int16 getRange() {
- return range;
+ return _range;
}
// Determine if the object can sense what it's looking for
@@ -248,7 +248,7 @@ private:
* ===================================================================== */
class SpecificObjectSensor : public ObjectSensor {
- ObjectID soughtObjID;
+ ObjectID _soughtObjID;
public:
// Constructor -- initial construction
@@ -258,7 +258,7 @@ public:
int16 rng,
ObjectID objToSense) :
ObjectSensor(o, sensorID, rng),
- soughtObjID(objToSense) {
+ _soughtObjID(objToSense) {
}
SpecificObjectSensor(Common::InSaveFile *in, int16 ctr);
@@ -285,7 +285,7 @@ private:
* ===================================================================== */
class ObjectPropertySensor : public ObjectSensor {
- ObjectPropertyID objectProperty;
+ ObjectPropertyID _objectProperty;
public:
// Constructor -- initial construction
@@ -295,7 +295,7 @@ public:
int16 rng,
ObjectPropertyID propToSense) :
ObjectSensor(o, sensorID, rng),
- objectProperty(propToSense) {
+ _objectProperty(propToSense) {
}
ObjectPropertySensor(Common::InSaveFile *in, int16 ctr);
@@ -340,7 +340,7 @@ private:
* ===================================================================== */
class SpecificActorSensor : public ActorSensor {
- Actor *soughtActor;
+ Actor *_soughtActor;
public:
// Constructor -- initial construction
@@ -350,7 +350,7 @@ public:
int16 rng,
Actor *actorToSense) :
ActorSensor(o, sensorID, rng),
- soughtActor(actorToSense) {
+ _soughtActor(actorToSense) {
}
SpecificActorSensor(Common::InSaveFile *in, int16 ctr);
@@ -377,7 +377,7 @@ private:
* ===================================================================== */
class ActorPropertySensor : public ActorSensor {
- ActorPropertyID actorProperty;
+ ActorPropertyID _actorProperty;
public:
// Constructor -- initial construction
@@ -387,7 +387,7 @@ public:
int16 rng,
ActorPropertyID propToSense) :
ActorSensor(o, sensorID, rng),
- actorProperty(propToSense) {
+ _actorProperty(propToSense) {
}
ActorPropertySensor(Common::InSaveFile *in, int16 ctr);
@@ -411,7 +411,7 @@ private:
* ===================================================================== */
class EventSensor : public Sensor {
- int16 eventType;
+ int16 _eventType;
public:
// Constructor -- initial construction
Commit: 7b7603556bbf8c57cdc2605b48032ba3b4d94e46
https://github.com/scummvm/scummvm/commit/7b7603556bbf8c57cdc2605b48032ba3b4d94e46
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Rename class variables in speech.h
Changed paths:
engines/saga2/speech.cpp
engines/saga2/speech.h
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index 8fc6944e93d..3d16ef78e0c 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -128,48 +128,48 @@ inline uint32 extendID(int16 smallID) {
void Speech::read(Common::InSaveFile *in) {
// Restore the sample count and character count
- sampleCount = in->readSint16LE();
- charCount = in->readSint16LE();
+ _sampleCount = in->readSint16LE();
+ _charCount = in->readSint16LE();
// Restore the text boundaries
- bounds.read(in);
+ _bounds.read(in);
// Restore the pen color and outline color
- penColor = in->readUint16LE();
- outlineColor = in->readUint16LE();
+ _penColor = in->readUint16LE();
+ _outlineColor = in->readUint16LE();
// Restore the object ID
- objID = in->readUint16LE();
+ _objID = in->readUint16LE();
// Restore the thread ID
- thread = in->readSint16LE();
+ _thread = in->readSint16LE();
// Restore the flags
- speechFlags = in->readSint16LE();
+ _speechFlags = in->readSint16LE();
- debugC(4, kDebugSaveload, "...... sampleCount = %d", sampleCount);
- debugC(4, kDebugSaveload, "...... charCount = %d", charCount);
- debugC(4, kDebugSaveload, "...... penColor = %d", penColor);
- debugC(4, kDebugSaveload, "...... outlineColor = %d", outlineColor);
+ debugC(4, kDebugSaveload, "...... sampleCount = %d", _sampleCount);
+ debugC(4, kDebugSaveload, "...... charCount = %d", _charCount);
+ debugC(4, kDebugSaveload, "...... penColor = %d", _penColor);
+ debugC(4, kDebugSaveload, "...... outlineColor = %d", _outlineColor);
debugC(4, kDebugSaveload, "...... bounds = (%d, %d, %d, %d)",
- bounds.x, bounds.y, bounds.width, bounds.height);
- debugC(4, kDebugSaveload, "...... objID = %d", objID);
- debugC(4, kDebugSaveload, "...... thread = %d", thread);
- debugC(4, kDebugSaveload, "...... speechFlags = %d", speechFlags);
+ _bounds.x, _bounds.y, _bounds.width, _bounds.height);
+ debugC(4, kDebugSaveload, "...... objID = %d", _objID);
+ debugC(4, kDebugSaveload, "...... thread = %d", _thread);
+ debugC(4, kDebugSaveload, "...... speechFlags = %d", _speechFlags);
// Restore the sample ID's
- for (int i = 0; i < sampleCount; i++) {
- sampleID[i] = in->readUint32BE();
- debugC(4, kDebugSaveload, "...... sampleID[%d] = %d", i, sampleID[i]);
+ for (int i = 0; i < _sampleCount; i++) {
+ _sampleID[i] = in->readUint32BE();
+ debugC(4, kDebugSaveload, "...... sampleID[%d] = %d", i, _sampleID[i]);
}
// Restore the text
- in->read(speechBuffer, charCount);
- speechBuffer[charCount] = '\0';
- debugC(4, kDebugSaveload, "...... speechBuffer = %s", speechBuffer);
+ in->read(_speechBuffer, _charCount);
+ _speechBuffer[_charCount] = '\0';
+ debugC(4, kDebugSaveload, "...... _speechBuffer = %s", _speechBuffer);
// Requeue the speech if needed
- if (speechFlags & spQueued) {
+ if (_speechFlags & spQueued) {
// Add to the active list
speechList.remove(this);
speechList._list.push_back(this);
@@ -180,58 +180,58 @@ void Speech::read(Common::InSaveFile *in) {
// Return the number of bytes needed to archive this SpeechTask
int32 Speech::archiveSize() {
- return sizeof(sampleCount)
- + sizeof(charCount)
- + sizeof(bounds)
- + sizeof(penColor)
- + sizeof(outlineColor)
- + sizeof(objID)
- + sizeof(thread)
- + sizeof(speechFlags)
- + sizeof(uint32) * sampleCount
- + sizeof(char) * charCount;
+ return sizeof(_sampleCount)
+ + sizeof(_charCount)
+ + sizeof(_bounds)
+ + sizeof(_penColor)
+ + sizeof(_outlineColor)
+ + sizeof(_objID)
+ + sizeof(_thread)
+ + sizeof(_speechFlags)
+ + sizeof(uint32) * _sampleCount
+ + sizeof(char) * _charCount;
}
void Speech::write(Common::MemoryWriteStreamDynamic *out) {
// Store the sample count and character count
- out->writeSint16LE(sampleCount);
- out->writeSint16LE(charCount);
+ out->writeSint16LE(_sampleCount);
+ out->writeSint16LE(_charCount);
// Store the text boundaries
- bounds.write(out);
+ _bounds.write(out);
// Store the pen color and outline color
- out->writeUint16LE(penColor);
- out->writeUint16LE(outlineColor);
+ out->writeUint16LE(_penColor);
+ out->writeUint16LE(_outlineColor);
// Store the object's ID
- out->writeUint16LE(objID);
+ out->writeUint16LE(_objID);
// Store the thread ID
- out->writeSint16LE(thread);
+ out->writeSint16LE(_thread);
// Store the flags. NOTE: Make sure this speech is not stored
// as being active
- out->writeSint16LE(speechFlags & ~spActive);
-
- debugC(4, kDebugSaveload, "...... sampleCount = %d", sampleCount);
- debugC(4, kDebugSaveload, "...... charCount = %d", charCount);
- debugC(4, kDebugSaveload, "...... penColor = %d", penColor);
- debugC(4, kDebugSaveload, "...... outlineColor = %d", outlineColor);
- debugC(4, kDebugSaveload, "...... bounds = (%d, %d, %d, %d)",
- bounds.x, bounds.y, bounds.width, bounds.height);
- debugC(4, kDebugSaveload, "...... objID = %d", objID);
- debugC(4, kDebugSaveload, "...... thread = %d", thread);
- debugC(4, kDebugSaveload, "...... speechFlags = %d", speechFlags);
-
- for (int i = 0; i < sampleCount; i++) {
- out->writeUint32BE(sampleID[i]);
- debugC(4, kDebugSaveload, "...... sampleID[%d] = %d", i, sampleID[i]);
+ out->writeSint16LE(_speechFlags & ~spActive);
+
+ debugC(4, kDebugSaveload, "...... _sampleCount = %d", _sampleCount);
+ debugC(4, kDebugSaveload, "...... _charCount = %d", _charCount);
+ debugC(4, kDebugSaveload, "...... _penColor = %d", _penColor);
+ debugC(4, kDebugSaveload, "...... _outlineColor = %d", _outlineColor);
+ debugC(4, kDebugSaveload, "...... _bounds = (%d, %d, %d, %d)",
+ _bounds.x, _bounds.y, _bounds.width, _bounds.height);
+ debugC(4, kDebugSaveload, "...... _objID = %d", _objID);
+ debugC(4, kDebugSaveload, "...... thread = %d", _thread);
+ debugC(4, kDebugSaveload, "...... _speechFlags = %d", _speechFlags);
+
+ for (int i = 0; i < _sampleCount; i++) {
+ out->writeUint32BE(_sampleID[i]);
+ debugC(4, kDebugSaveload, "...... _sampleID[%d] = %d", i, _sampleID[i]);
}
// Store the text
- out->write(speechBuffer, charCount);
- debugC(4, kDebugSaveload, "...... speechBuffer = %s", speechBuffer);
+ out->write(_speechBuffer, _charCount);
+ debugC(4, kDebugSaveload, "...... _speechBuffer = %s", _speechBuffer);
}
//-----------------------------------------------------------------------
@@ -241,18 +241,18 @@ bool Speech::append(char *text, int32 sampID) {
int16 len = strlen(text);
// Check to see if there's enough room in the character buffer
- if (charCount + len >= (long)sizeof(speechBuffer)
- || sampleCount >= MAX_SAMPLES) return false;
+ if (_charCount + len >= (long)sizeof(_speechBuffer)
+ || _sampleCount >= MAX_SAMPLES) return false;
// Copy text to end of text in buffer, including '\0'
- memcpy(&speechBuffer[charCount], text, len + 1);
- charCount += len;
+ memcpy(&_speechBuffer[_charCount], text, len + 1);
+ _charCount += len;
// Append sample ID to list of samples.
// REM: We should translate sample ID's from index to resource
// number here.
if (sampID)
- sampleID[sampleCount++] = extendID(sampID);
+ _sampleID[_sampleCount++] = extendID(sampID);
return true;
}
@@ -268,7 +268,7 @@ bool Speech::activate() {
// Add to the active list
speechList._list.push_back(this);
- speechFlags |= spQueued;
+ _speechFlags |= spQueued;
// This routine can't fail
return true;
@@ -282,9 +282,9 @@ bool Speech::setupActive() {
int16 buttonNum = 0,
buttonChars;
- speechFlags |= spActive;
+ _speechFlags |= spActive;
- speechFinished.set((charCount * 4 / 2) + ticksPerSecond);
+ speechFinished.set((_charCount * 4 / 2) + ticksPerSecond);
//Turn Actor Towards Person They Are Talking To
// MotionTask::turnObject( *obj, GameObject::objectAddress(32794)->getLocation());
@@ -294,9 +294,9 @@ bool Speech::setupActive() {
// Set up temp gport for blitting to bitmap
_textPort.setStyle(textStyleThickOutline); // extra Thick Outline
- _textPort.setOutlineColor(outlineColor); // outline black
+ _textPort.setOutlineColor(_outlineColor); // outline black
_textPort.setFont(&Amber13Font); // speech font
- _textPort.setColor(penColor); // color of letters
+ _textPort.setColor(_penColor); // color of letters
_textPort.setMode(drawModeMatte); // insure transparency
setWidth();
@@ -304,38 +304,38 @@ bool Speech::setupActive() {
// If speech position is off-screen, then skip
if (!calcPosition(initialSpeechPosition)) return false;
- if (sampleCount) {
- GameObject *go = GameObject::objectAddress(objID);
+ if (_sampleCount) {
+ GameObject *go = GameObject::objectAddress(_objID);
Location loc = go->notGetWorldLocation();
- sampleID[sampleCount] = 0;
+ _sampleID[_sampleCount] = 0;
- //sayVoice(sampleID);
+ //sayVoice(_sampleID);
/// EO SEARCH ///
- if (sayVoiceAt(sampleID, loc))
- speechFlags |= spHasVoice;
+ if (sayVoiceAt(_sampleID, loc))
+ _speechFlags |= spHasVoice;
else
- speechFlags &= ~spHasVoice;
+ _speechFlags &= ~spHasVoice;
- } else speechFlags &= ~spHasVoice;
+ } else _speechFlags &= ~spHasVoice;
speechLineCount = buttonWrap(speechLineList,
speechButtonList,
speechButtonCount,
- speechBuffer,
- bounds.width,
- !g_vm->_speechText && (speechFlags & spHasVoice),
+ _speechBuffer,
+ _bounds.width,
+ !g_vm->_speechText && (_speechFlags & spHasVoice),
_textPort);
// Compute height of bitmap based on number of lines of text.
// Include 4 for outline width
- bounds.height =
+ _bounds.height =
(speechLineCount * (_textPort._font->height + lineLeading))
+ outlineWidth * 2;
// Blit to temp bitmap
- _speechImage._size.x = bounds.width;
- _speechImage._size.y = bounds.height;
+ _speechImage._size.x = _bounds.width;
+ _speechImage._size.y = _bounds.height;
_speechImage._data = new uint8[_speechImage.bytes()]();
_textPort.setMap(&_speechImage);
@@ -346,7 +346,7 @@ bool Speech::setupActive() {
int16 lineChars = speechLineList[i].charWidth;
char *lineText = speechLineList[i].text;
- x = (bounds.width - speechLineList[i].pixelWidth) / 2
+ x = (_bounds.width - speechLineList[i].pixelWidth) / 2
+ outlineWidth;
_textPort.moveTo(x, y);
@@ -403,11 +403,11 @@ bool Speech::setupActive() {
speechList.SetLock(false);
} else {
// If there is a lock flag on this speech, then LockUI()
- speechList.SetLock(speechFlags & spLock);
+ speechList.SetLock(_speechFlags & spLock);
}
- if (!(speechFlags & spNoAnimate) && isActor(objID)) {
- Actor *a = (Actor *)GameObject::objectAddress(objID);
+ if (!(_speechFlags & spNoAnimate) && isActor(_objID)) {
+ Actor *a = (Actor *)GameObject::objectAddress(_objID);
if (!a->isDead() && !a->isMoving()) MotionTask::talk(*a);
}
@@ -430,9 +430,9 @@ void Speech::setWidth() {
speechLineCount_ = buttonWrap(speechLineList_,
speechButtonList_,
speechButtonCount_,
- speechBuffer,
+ _speechBuffer,
defaultWidth,
- !g_vm->_speechText && (speechFlags & spHasVoice),
+ !g_vm->_speechText && (_speechFlags & spHasVoice),
_textPort);
// If it's more than 3 lines, then use the max line width.
@@ -441,27 +441,27 @@ void Speech::setWidth() {
speechLineCount_ = buttonWrap(speechLineList_,
speechButtonList_,
speechButtonCount_,
- speechBuffer,
+ _speechBuffer,
maxWidth,
- !g_vm->_speechText && (speechFlags & spHasVoice),
+ !g_vm->_speechText && (_speechFlags & spHasVoice),
_textPort);
}
- // The actual width of the bounds is the widest of the lines.
+ // The actual width of the _bounds is the widest of the lines.
- bounds.width = 0;
+ _bounds.width = 0;
for (int i = 0; i < speechLineCount_; i++) {
- bounds.width = MAX(bounds.width, speechLineList_[i].pixelWidth);
+ _bounds.width = MAX(_bounds.width, speechLineList_[i].pixelWidth);
}
- bounds.width += outlineWidth * 2 + 4; // Some padding just in case.
+ _bounds.width += outlineWidth * 2 + 4; // Some padding just in case.
}
//-----------------------------------------------------------------------
// Calculate the position of the speech, emanating from the actor.
bool Speech::calcPosition(StaticPoint16 &p) {
- GameObject *obj = GameObject::objectAddress(objID);
+ GameObject *obj = GameObject::objectAddress(_objID);
TilePoint tp = obj->getWorldLocation();
if (!isVisible(obj)) return false;
@@ -469,12 +469,12 @@ bool Speech::calcPosition(StaticPoint16 &p) {
TileToScreenCoords(tp, p);
p.x = clamp(8,
- p.x - bounds.width / 2,
- 8 + maxWidth - bounds.width);
+ p.x - _bounds.width / 2,
+ 8 + maxWidth - _bounds.width);
p.y = clamp(kTileRectY + 8,
- p.y - (bounds.height + actorHeight),
- kTileRectHeight - 50 - bounds.height);
+ p.y - (_bounds.height + actorHeight),
+ kTileRectHeight - 50 - _bounds.height);
return true;
}
@@ -499,7 +499,7 @@ bool Speech::displayText() {
0, 0,
p.x + fineScroll.x,
p.y + fineScroll.y,
- bounds.width, bounds.height);
+ _bounds.width, _bounds.height);
return true;
}
@@ -518,7 +518,7 @@ void Speech::dispose() {
playVoice(0);
// Wake up the thread, and return the # of the button
// that was selected
- wakeUpThread(thread, selectedButton);
+ wakeUpThread(_thread, _selectedButton);
// De-allocate the speech data
delete[] _speechImage._data;
@@ -528,15 +528,15 @@ void Speech::dispose() {
speechLineCount = speechButtonCount = 0;
speakButtonControls->enable(false);
- if (!(speechFlags & spNoAnimate) && isActor(objID)) {
- Actor *a = (Actor *)GameObject::objectAddress(objID);
+ if (!(_speechFlags & spNoAnimate) && isActor(_objID)) {
+ Actor *a = (Actor *)GameObject::objectAddress(_objID);
if (a->_moveTask)
a->_moveTask->finishTalking();
}
- } else wakeUpThread(thread, 0);
+ } else wakeUpThread(_thread, 0);
- GameObject *obj = GameObject::objectAddress(objID);
+ GameObject *obj = GameObject::objectAddress(_objID);
debugC(1, kDebugTasks, "Speech: Disposing %p for %p (%s) (total = %d)'", (void *)this, (void *)obj, obj->objName(), speechList.speechCount());
@@ -552,7 +552,7 @@ void updateSpeech() {
// if there is a speech object
if ((sp = speechList.currentActive()) != nullptr) {
// If there is no bitmap, then set one up.
- if (!(sp->speechFlags & Speech::spActive)) {
+ if (!(sp->_speechFlags & Speech::spActive)) {
sp->setupActive();
// If speech failed to set up, then skip it
@@ -569,16 +569,16 @@ void updateSpeech() {
if (sp->longEnough() &&
- (speechButtonCount == 0 || sp->selectedButton != 0))
+ (speechButtonCount == 0 || sp->_selectedButton != 0))
sp->dispose();
} else speechList.SetLock(false);
}
bool Speech::longEnough() {
- if (speechFlags & spHasVoice)
- return (!stillDoingVoice(sampleID));
+ if (_speechFlags & spHasVoice)
+ return (!stillDoingVoice(_sampleID));
else
- return (selectedButton != 0 || speechFinished.check());
+ return (_selectedButton != 0 || speechFinished.check());
}
// Gets rid of the current speech
@@ -586,7 +586,7 @@ bool Speech::longEnough() {
void Speech::abortSpeech() {
// Start by displaying first frame straight off, no delay
speechFinished.set(0);
- if (speechFlags & spHasVoice) {
+ if (_speechFlags & spHasVoice) {
PlayVoice(nullptr);
}
}
@@ -867,13 +867,13 @@ void SpeechTaskList::remove(Speech *p) {
// Initialize the SpeechTaskList
SpeechTaskList::SpeechTaskList() {
- lockFlag = false;
+ _lockFlag = false;
}
SpeechTaskList::SpeechTaskList(Common::InSaveFile *in) {
int16 count;
- lockFlag = false;
+ _lockFlag = false;
// Get the speech count
count = in->readSint16LE();
@@ -960,7 +960,7 @@ void SpeechTaskList::cleanup() {
Speech *SpeechTaskList::findSpeech(ObjectID id) {
for (Common::List<Speech *>::iterator it = speechList._inactiveList.begin();
it != speechList._inactiveList.end(); ++it) {
- if ((*it)->objID == id)
+ if ((*it)->_objID == id)
return *it;
}
@@ -990,12 +990,12 @@ Speech *SpeechTaskList::newTask(ObjectID id, uint16 flags) {
debugC(1, kDebugTasks, "Speech: New Task: %p for %p (%s) (flags = %d) (total = %d)", (void *)sp, (void *)obj, obj->objName(), flags, speechCount());
- sp->sampleCount = sp->charCount = 0;
- sp->objID = id;
- sp->speechFlags = flags & (Speech::spNoAnimate | Speech::spLock);
- sp->outlineColor = 15 + 9;
- sp->thread = NoThread;
- sp->selectedButton = 0;
+ sp->_sampleCount = sp->_charCount = 0;
+ sp->_objID = id;
+ sp->_speechFlags = flags & (Speech::spNoAnimate | Speech::spLock);
+ sp->_outlineColor = 15 + 9;
+ sp->_thread = NoThread;
+ sp->_selectedButton = 0;
// Set the pen color of the speech based on the actor
if (isActor(id)) {
@@ -1004,14 +1004,14 @@ Speech *SpeechTaskList::newTask(ObjectID id, uint16 flags) {
// If actor has color table loaded, then get the speech
// color for this particular color scheme; else use a
// default color.
- if (a == getCenterActor()) sp->penColor = 3 + 9 /* 1 */;
+ if (a == getCenterActor()) sp->_penColor = 3 + 9 /* 1 */;
else if (a->_appearance
&& a->_appearance->schemeList) {
- sp->penColor =
+ sp->_penColor =
a->_appearance->schemeList->_schemes[a->_colorScheme]->speechColor + 9;
- } else sp->penColor = 4 + 9;
+ } else sp->_penColor = 4 + 9;
} else {
- sp->penColor = 4 + 9;
+ sp->_penColor = 4 + 9;
}
_inactiveList.push_back(sp);
@@ -1019,13 +1019,13 @@ Speech *SpeechTaskList::newTask(ObjectID id, uint16 flags) {
}
void SpeechTaskList::SetLock(int newState) {
- if (newState && lockFlag == false) {
+ if (newState && _lockFlag == false) {
noStickyMap();
LockUI(true);
- lockFlag = true;
- } else if (lockFlag && newState == false) {
+ _lockFlag = true;
+ } else if (_lockFlag && newState == false) {
LockUI(false);
- lockFlag = false;
+ _lockFlag = false;
}
}
@@ -1065,7 +1065,7 @@ APPFUNC(cmdClickSpeech) {
case gEventMouseDown:
if ((sp = speechList.currentActive()) != nullptr) {
- sp->selectedButton = pickSpeechButton(ev.mouse, sp->_speechImage._size.x, sp->_textPort);
+ sp->_selectedButton = pickSpeechButton(ev.mouse, sp->_speechImage._size.x, sp->_textPort);
}
break;
diff --git a/engines/saga2/speech.h b/engines/saga2/speech.h
index 01ca4c705e3..2420050bfb8 100644
--- a/engines/saga2/speech.h
+++ b/engines/saga2/speech.h
@@ -81,22 +81,22 @@ private:
int flags
);
- int16 sampleCount, // number of sound samples
- charCount; // number of characters in buffer
+ int16 _sampleCount, // number of sound samples
+ _charCount; // number of characters in buffer
- Rect16 bounds; // bounds of speech.
- uint16 penColor, // penColor to draw in
- outlineColor; // pen color for outline
+ Rect16 _bounds; // bounds of speech.
+ uint16 _penColor, // penColor to draw in
+ _outlineColor; // pen color for outline
- ObjectID objID; // ID of speaking object
- ThreadID thread; // SAGA thread to wake up when done
+ ObjectID _objID; // ID of speaking object
+ ThreadID _thread; // SAGA thread to wake up when done
- int16 speechFlags; // flags from speaking
- uint32 sampleID[MAX_SAMPLES];// voice sound sample ID
- char speechBuffer[512];// longest possible speech
+ int16 _speechFlags; // flags from speaking
+ uint32 _sampleID[MAX_SAMPLES];// voice sound sample ID
+ char _speechBuffer[512];// longest possible speech
public:
- int16 selectedButton; // which button was hit
+ int16 _selectedButton; // which button was hit
gPixelMap _speechImage;
gPort _textPort;
@@ -140,7 +140,7 @@ public:
// Set speech to wake up thread when done
void setWakeUp(ThreadID th) {
- thread = th;
+ _thread = th;
}
// See if its time to kill it
@@ -166,7 +166,7 @@ class SpeechTaskList {
Common::List<Speech *> _list,
_inactiveList;
- int8 lockFlag;
+ int8 _lockFlag;
void SetLock(int newState);
Commit: a68914295d7ccadf59d837d699efb1c1bff56bab
https://github.com/scummvm/scummvm/commit/a68914295d7ccadf59d837d699efb1c1bff56bab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Rename class variables in spelshow.h
Changed paths:
engines/saga2/dispnode.cpp
engines/saga2/spelcast.cpp
engines/saga2/speldefs.h
engines/saga2/spellini.cpp
engines/saga2/spellio.cpp
engines/saga2/spellloc.cpp
engines/saga2/spellsiz.cpp
engines/saga2/spellspr.cpp
engines/saga2/spellsta.cpp
engines/saga2/spelshow.h
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index 24899c995ec..25ffa892edc 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -129,7 +129,7 @@ DisplayNode::DisplayNode() {
TilePoint DisplayNode::SpellPos() {
if (_efx)
- return _efx->current;
+ return _efx->_current;
return Nowhere;
}
@@ -909,7 +909,7 @@ void DisplayNodeList::buildEffects(bool) {
// make sure it knows it's not a real object
_displayList[i]._type = nodeTypeEffect;
- _displayList[i]._sortDepth = _displayList[i]._efx->screenCoords.y + _displayList[i]._efx->current.z / 2;
+ _displayList[i]._sortDepth = _displayList[i]._efx->_screenCoords.y + _displayList[i]._efx->_current.z / 2;
if (dn) {
int32 sd = _displayList[i]._sortDepth;
while (dn->_nextDisplayed && dn->_nextDisplayed->_sortDepth <= sd)
@@ -959,8 +959,8 @@ void Effectron::drawEffect() {
if (isHidden() || isDead())
return;
- drawPos.x = screenCoords.x + fineScroll.x;
- drawPos.y = screenCoords.y + fineScroll.y;
+ drawPos.x = _screenCoords.x + fineScroll.x;
+ drawPos.y = _screenCoords.y + fineScroll.y;
// Reject any sprites which fall off the edge of the screen.
if (drawPos.x < -32
@@ -968,19 +968,19 @@ void Effectron::drawEffect() {
|| drawPos.y < -32
|| drawPos.y > kTileRectY + kTileRectHeight + 100) {
// Disable hit-test on the object's box
- hitBox.width = -1;
- hitBox.height = -1;
+ _hitBox.width = -1;
+ _hitBox.height = -1;
return;
}
- TileToScreenCoords(objCoords, screenCoords);
+ TileToScreenCoords(objCoords, _screenCoords);
sc = &scList[0];
//sc->sp = (*spellSprites)->sprite( spriteID() );
sc->sp = spellSprites->sprite(spriteID()); //tempSpellSpriteIDs[rand()%39] );
sc->offset.x = scList->offset.y = 0;
- (*g_vm->_sdpList)[parent->spell]->
+ (*g_vm->_sdpList)[_parent->spell]->
getColorTranslation(eColors, this);
sc->colorTable = eColors;
@@ -990,7 +990,7 @@ void Effectron::drawEffect() {
sc->flipped,
sc->colorTable,
drawPos,
- current,
+ _current,
0) <= 5);
DrawCompositeMaskedSprite(
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 38438d22ce5..14ad5ab99f7 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -205,7 +205,7 @@ void SpellStuff::implement(GameObject *enactor, Location target) {
SpellTarget st = SpellTarget(target);
buildTargetList(enactor, st);
if (effects && targets) {
- for (SpellTarget *t = targets; t; t = t->next) {
+ for (SpellTarget *t = targets; t; t = t->_next) {
if (safe() &&
t->getObject() != nullptr &&
t->getObject()->thisID() == enactor->thisID() &&
@@ -371,8 +371,8 @@ void SpellStuff::addTarget(SpellTarget *trg) {
targets = trg;
else {
SpellTarget *t = targets;
- while (t->next) t = t->next;
- t->next = trg;
+ while (t->_next) t = t->_next;
+ t->_next = trg;
}
}
@@ -688,11 +688,11 @@ void SpellInstance::initEffect(TilePoint startpoint) {
for (int32 i = 0; i < eList._count; i++) {
Effectron *e = new Effectron(0, i);
eList._displayList[i]._efx = e;
- e->parent = this;
- e->start = startpoint;
- e->current = startpoint;
- e->partno = i;
- e->stepNo = 0;
+ e->_parent = this;
+ e->_start = startpoint;
+ e->_current = startpoint;
+ e->_partno = i;
+ e->_stepNo = 0;
e->initCall(i);
}
}
@@ -776,73 +776,73 @@ TilePoint collideTo(Effectron *e, TilePoint nloc) {
// default constructor
Effectron::Effectron() {
- age = 0;
- pos = 0;
- flags = effectronDead;
- parent = nullptr;
- partno = 0;
- totalSteps = stepNo = 0;
- hgt = 0;
- brd = 0;
- spr = 0;
+ _age = 0;
+ _pos = 0;
+ _flags = effectronDead;
+ _parent = nullptr;
+ _partno = 0;
+ _totalSteps = _stepNo = 0;
+ _hgt = 0;
+ _brd = 0;
+ _spr = 0;
}
//-----------------------------------------------------------------------
// constructor with starting position / velocity
Effectron::Effectron(uint16 newPos, uint16 newDir) {
- age = 0;
- pos = (newDir << 16) + newPos;
- flags = 0;
- parent = nullptr;
- partno = 0;
- totalSteps = stepNo = 0;
- hgt = 0;
- brd = 0;
- spr = 0;
+ _age = 0;
+ _pos = (newDir << 16) + newPos;
+ _flags = 0;
+ _parent = nullptr;
+ _partno = 0;
+ _totalSteps = _stepNo = 0;
+ _hgt = 0;
+ _brd = 0;
+ _spr = 0;
}
//-----------------------------------------------------------------------
// Effectron display update
void Effectron::updateEffect(int32 deltaTime) {
- age += deltaTime;
- if (age > 1) {
- age = 0;
- pos++;
- finish = parent->target->getPoint();
- stepNo++;
-
- flags = staCall();
+ _age += deltaTime;
+ if (_age > 1) {
+ _age = 0;
+ _pos++;
+ _finish = _parent->target->getPoint();
+ _stepNo++;
+
+ _flags = staCall();
if (isHidden() || isDead())
return;
- spr = sprCall();
- hgt = hgtCall();
- brd = brdCall();
+ _spr = sprCall();
+ _hgt = hgtCall();
+ _brd = brdCall();
TilePoint oLoc = posCall();
// at this point we need to detect collisions
// between current ( or start ) and oLoc
- current = collideTo(this, oLoc);
- TileToScreenCoords(oLoc, screenCoords);
+ _current = collideTo(this, oLoc);
+ TileToScreenCoords(oLoc, _screenCoords);
}
}
//-----------------------------------------------------------------------
void Effectron::bump() {
- switch (parent->dProto->elasticity) {
- case ecFlagBounce :
- velocity = -velocity;
+ switch (_parent->dProto->elasticity) {
+ case ecFlagBounce:
+ _velocity = -_velocity;
break;
- case ecFlagDie :
+ case ecFlagDie:
kill();
break;
- case ecFlagStop :
- velocity = TilePoint(0, 0, 0);
+ case ecFlagStop:
+ _velocity = TilePoint(0, 0, 0);
break;
- case ecFlagNone :
+ case ecFlagNone:
break;
}
}
diff --git a/engines/saga2/speldefs.h b/engines/saga2/speldefs.h
index 81cebb64d36..0d1df48c3b2 100644
--- a/engines/saga2/speldefs.h
+++ b/engines/saga2/speldefs.h
@@ -149,89 +149,89 @@ public :
};
private:
- spellTargetType type;
+ spellTargetType _type;
- TilePoint loc;
- GameObject *obj;
- ActiveItem *tag;
+ TilePoint _loc;
+ GameObject *_obj;
+ ActiveItem *_tag;
public:
- SpellTarget *next;
+ SpellTarget *_next;
SpellTarget() {
- type = spellTargetNone;
- obj = nullptr;
- loc.u = 0;
- loc.v = 0;
- loc.z = 0;
- next = nullptr;
- tag = nullptr;
+ _type = spellTargetNone;
+ _obj = nullptr;
+ _loc.u = 0;
+ _loc.v = 0;
+ _loc.z = 0;
+ _next = nullptr;
+ _tag = nullptr;
}
// This constructor is for non-tracking targets
SpellTarget(GameObject &object) {
- type = spellTargetObjectPoint;
- loc = object.getWorldLocation();
- loc.z += object.proto()->height / 2;
- next = nullptr;
- obj = &object;
- tag = nullptr;
+ _type = spellTargetObjectPoint;
+ _loc = object.getWorldLocation();
+ _loc.z += object.proto()->height / 2;
+ _next = nullptr;
+ _obj = &object;
+ _tag = nullptr;
}
// This constructor is for tracking targets
SpellTarget(GameObject *object) {
- type = spellTargetObject;
- obj = object;
- next = nullptr;
- tag = nullptr;
+ _type = spellTargetObject;
+ _obj = object;
+ _next = nullptr;
+ _tag = nullptr;
}
SpellTarget(TilePoint &tp) {
- type = spellTargetPoint;
- loc = tp;
- next = nullptr;
- tag = nullptr;
- obj = nullptr;
+ _type = spellTargetPoint;
+ _loc = tp;
+ _next = nullptr;
+ _tag = nullptr;
+ _obj = nullptr;
}
SpellTarget(ActiveItem *ai) {
- type = spellTargetTAG;
- tag = ai;
- next = nullptr;
- tag = nullptr;
- obj = nullptr;
+ _type = spellTargetTAG;
+ _tag = ai;
+ _next = nullptr;
+ _tag = nullptr;
+ _obj = nullptr;
}
SpellTarget(StorageSpellTarget &sst);
SpellTarget &operator=(const SpellTarget &src) {
- type = src.type;
- loc = src.loc;
- obj = src.obj;
- tag = src.tag;
- next = src.next;
+ _type = src._type;
+ _loc = src._loc;
+ _obj = src._obj;
+ _tag = src._tag;
+ _next = src._next;
return *this;
}
SpellTarget(const SpellTarget &src) {
- type = src.type;
- loc = src.loc;
- obj = src.obj;
- tag = src.tag;
- next = src.next;
+ _type = src._type;
+ _loc = src._loc;
+ _obj = src._obj;
+ _tag = src._tag;
+ _next = src._next;
}
~SpellTarget() {
- if (next)
- delete next;
- next = nullptr;
+ if (_next)
+ delete _next;
+ _next = nullptr;
};
TilePoint getPoint() {
- switch (type) {
+ switch (_type) {
case spellTargetPoint :
case spellTargetObjectPoint :
- return loc;
+ return _loc;
case spellTargetObject :
- return objPos(obj);
+ return objPos(_obj);
case spellTargetTAG :
- return TAGPos(tag);
+ return TAGPos(_tag);
case spellTargetNone :
default :
return Nowhere;
@@ -239,17 +239,17 @@ public:
}
spellTargetType getType() {
- return type;
+ return _type;
}
GameObject *getObject() {
- assert(type == spellTargetObject);
- return obj;
+ assert(_type == spellTargetObject);
+ return _obj;
}
ActiveItem *getTAG() {
- assert(type == spellTargetTAG);
- return tag;
+ assert(_type == spellTargetTAG);
+ return _tag;
}
};
@@ -277,31 +277,31 @@ typedef Extent16 EffectronSize;
class Effectron {
friend struct StorageEffectron;
- EffectronFlags flags; // this effectrons status
- EffectronSize size; // this effectrons size
- Rect16 hitBox; // hitbox for clicking this item
+ EffectronFlags _flags; // this effectrons status
+ EffectronSize _size; // this effectrons size
+ Rect16 _hitBox; // hitbox for clicking this item
// dispnode needs the latter
public:
- SpellInstance *parent; // pointer back to the spell that spawned this
+ SpellInstance *_parent; // pointer back to the spell that spawned this
- int16 partno; // Which effectron in a group this represents
- Point16 screenCoords; // screen coordinates last drawn at
+ int16 _partno; // Which effectron in a group this represents
+ Point16 _screenCoords; // screen coordinates last drawn at
- TilePoint start, // travelling from
- finish, // travelling to
- current, // current position
- velocity, // current velocity
- acceleration; // current acceleration
- uint16 totalSteps, // discrete jumps in the path
- stepNo; // current jump
+ TilePoint _start, // travelling from
+ _finish, // travelling to
+ _current, // current position
+ _velocity, // current velocity
+ _acceleration; // current acceleration
+ uint16 _totalSteps, // discrete jumps in the path
+ _stepNo; // current jump
- spellHeight hgt; // collision detection stuff
- spellBreadth brd;
+ spellHeight _hgt; // collision detection stuff
+ spellBreadth _brd;
- SpellPositionSeed pos; // These three are part of an old way of
- SpellSpritationSeed spr; // updating effectrons
- SpellAge age;
+ SpellPositionSeed _pos; // These three are part of an old way of
+ SpellSpritationSeed _spr; // updating effectrons
+ SpellAge _age;
@@ -313,30 +313,30 @@ public:
void updateEffect(int32 deltaTime);
inline TilePoint SpellPos() {
- return current;
+ return _current;
}
inline int32 spriteID() {
- return spr;
+ return _spr;
}
inline void hide() {
- flags |= effectronHidden;
+ _flags |= effectronHidden;
}
inline void unhide() {
- flags &= (~effectronHidden);
+ _flags &= (~effectronHidden);
}
inline bool isHidden() const {
- return flags & effectronHidden;
+ return _flags & effectronHidden;
}
inline void kill() {
- flags |= effectronDead;
+ _flags |= effectronDead;
}
inline int isDead() const {
- return flags & effectronDead;
+ return _flags & effectronDead;
}
inline void bump();
inline int isBumped() const {
- return flags & effectronBumped;
+ return _flags & effectronBumped;
}
inline GameWorld *world() const;
diff --git a/engines/saga2/spellini.cpp b/engines/saga2/spellini.cpp
index 3eccfc77add..af7cb606f15 100644
--- a/engines/saga2/spellini.cpp
+++ b/engines/saga2/spellini.cpp
@@ -56,234 +56,234 @@ namespace Saga2 {
// null effect
SPELLINITFUNCTION(invisibleSpellInit) {
- effectron->velocity = TilePoint(0, 0, 0);
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_velocity = TilePoint(0, 0, 0);
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// aura that tracks target
SPELLINITFUNCTION(auraSpellInit) {
- if (effectron->parent->maxAge)
- effectron->totalSteps = effectron->parent->maxAge;
+ if (effectron->_parent->maxAge)
+ effectron->_totalSteps = effectron->_parent->maxAge;
else
- effectron->totalSteps = 20;
- effectron->current = effectron->parent->target->getPoint();
- effectron->velocity = TilePoint(0, 0, 0);
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_totalSteps = 20;
+ effectron->_current = effectron->_parent->target->getPoint();
+ effectron->_velocity = TilePoint(0, 0, 0);
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// aura that tracks target (in front)
SPELLINITFUNCTION(glowSpellInit) {
- if (effectron->parent->maxAge)
- effectron->totalSteps = effectron->parent->maxAge;
+ if (effectron->_parent->maxAge)
+ effectron->_totalSteps = effectron->_parent->maxAge;
else
- effectron->totalSteps = 20;
- effectron->current = effectron->parent->target->getPoint() - TilePoint(1, 1, 0);
- effectron->finish = effectron->current;
- effectron->velocity = TilePoint(0, 0, 0);
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_totalSteps = 20;
+ effectron->_current = effectron->_parent->target->getPoint() - TilePoint(1, 1, 0);
+ effectron->_finish = effectron->_current;
+ effectron->_velocity = TilePoint(0, 0, 0);
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// sprites that surround target
SPELLINITFUNCTION(wallSpellInit) {
- if (effectron->parent->maxAge)
- effectron->totalSteps = effectron->parent->maxAge;
+ if (effectron->_parent->maxAge)
+ effectron->_totalSteps = effectron->_parent->maxAge;
else
- effectron->totalSteps = 20;
- effectron->current = effectron->parent->target->getPoint();
- effectron->velocity = WallVectors[effectron->partno] * wallSpellRadius / 3;
- effectron->current = effectron->parent->target->getPoint() + effectron->velocity;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_totalSteps = 20;
+ effectron->_current = effectron->_parent->target->getPoint();
+ effectron->_velocity = WallVectors[effectron->_partno] * wallSpellRadius / 3;
+ effectron->_current = effectron->_parent->target->getPoint() + effectron->_velocity;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// projectile from caster to target
SPELLINITFUNCTION(projectileSpellInit) {
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
- TilePoint tp = (effectron->finish - effectron->start);
- effectron->totalSteps = 1 + (tp.magnitude() / (2 * SpellJumpiness));
- effectron->velocity = tp / effectron->totalSteps;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
+ TilePoint tp = (effectron->_finish - effectron->_start);
+ effectron->_totalSteps = 1 + (tp.magnitude() / (2 * SpellJumpiness));
+ effectron->_velocity = tp / effectron->_totalSteps;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// bi-directional beams of energy
SPELLINITFUNCTION(exchangeSpellInit) {
- if (effectron->partno % 2) {
- effectron->finish = effectron->current;
- effectron->start = effectron->parent->target->getPoint();
+ if (effectron->_partno % 2) {
+ effectron->_finish = effectron->_current;
+ effectron->_start = effectron->_parent->target->getPoint();
} else {
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
}
- TilePoint tp = (effectron->finish - effectron->start);
- effectron->totalSteps = 1 + (tp.magnitude() / (SpellJumpiness));
- effectron->velocity = tp / effectron->totalSteps;
- effectron->totalSteps += (effectron->partno / 2);
- effectron->acceleration = TilePoint(0, 0, 0);
- effectron->current = effectron->start;
+ TilePoint tp = (effectron->_finish - effectron->_start);
+ effectron->_totalSteps = 1 + (tp.magnitude() / (SpellJumpiness));
+ effectron->_velocity = tp / effectron->_totalSteps;
+ effectron->_totalSteps += (effectron->_partno / 2);
+ effectron->_acceleration = TilePoint(0, 0, 0);
+ effectron->_current = effectron->_start;
}
// ------------------------------------------------------------------
// lightning bolt shaped spell
SPELLINITFUNCTION(boltSpellInit) {
- effectron->stepNo = 0;
- if (effectron->parent->maxAge)
- effectron->totalSteps = effectron->parent->maxAge;
+ effectron->_stepNo = 0;
+ if (effectron->_parent->maxAge)
+ effectron->_totalSteps = effectron->_parent->maxAge;
else
- effectron->totalSteps = 1 + (boltSpellLength / (SpellJumpiness * 3));
+ effectron->_totalSteps = 1 + (boltSpellLength / (SpellJumpiness * 3));
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
- TilePoint tVect = effectron->finish - effectron->start ;
+ TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, boltSpellLength);
TilePoint orth = rightVector(tVect, 0);
- setMagnitude(orth, boltSpellWidth * (effectron->partno % 3 - 1) / 6);
- TilePoint offVect = tVect * ((effectron->partno / 3) % 3) / (SpellJumpiness * 3);
+ setMagnitude(orth, boltSpellWidth * (effectron->_partno % 3 - 1) / 6);
+ TilePoint offVect = tVect * ((effectron->_partno / 3) % 3) / (SpellJumpiness * 3);
- effectron->start += orth;
- effectron->finish += orth + offVect;
+ effectron->_start += orth;
+ effectron->_finish += orth + offVect;
- effectron->velocity = tVect / effectron->totalSteps + randOff;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_velocity = tVect / effectron->_totalSteps + randOff;
+ effectron->_acceleration = TilePoint(0, 0, 0);
- effectron->current = effectron->start;
+ effectron->_current = effectron->_start;
}
// ------------------------------------------------------------------
// narrow bolt
SPELLINITFUNCTION(beamSpellInit) {
- effectron->stepNo = 0;
- if (effectron->parent->maxAge)
- effectron->totalSteps = effectron->parent->maxAge;
+ effectron->_stepNo = 0;
+ if (effectron->_parent->maxAge)
+ effectron->_totalSteps = effectron->_parent->maxAge;
else
- effectron->totalSteps = 1 + (beamSpellLength / (SpellJumpiness));
+ effectron->_totalSteps = 1 + (beamSpellLength / (SpellJumpiness));
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
- TilePoint tVect = effectron->finish - effectron->start ;
+ TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, beamSpellLength);
TilePoint orth = rightVector(tVect, 0);
setMagnitude(orth, beamSpellWidth / 2);
- effectron->start += (tVect * effectron->partno) / effectron->totalSteps;
- effectron->finish = effectron->start;
+ effectron->_start += (tVect * effectron->_partno) / effectron->_totalSteps;
+ effectron->_finish = effectron->_start;
- effectron->velocity = orth;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_velocity = orth;
+ effectron->_acceleration = TilePoint(0, 0, 0);
- effectron->current = effectron->start;
+ effectron->_current = effectron->_start;
}
// ------------------------------------------------------------------
// narrow cone shaped spell
SPELLINITFUNCTION(coneSpellInit) {
- effectron->stepNo = 0;
- effectron->totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 3));
+ effectron->_stepNo = 0;
+ effectron->_totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 3));
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
- TilePoint tVect = effectron->finish - effectron->start ;
+ TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, coneSpellLength);
TilePoint orth = rightVector(tVect, 0);
- setMagnitude(orth, coneSpellWidth * (effectron->partno % 9 - 4) / 8);
+ setMagnitude(orth, coneSpellWidth * (effectron->_partno % 9 - 4) / 8);
- effectron->finish = effectron->start + tVect + orth;
+ effectron->_finish = effectron->_start + tVect + orth;
- effectron->velocity = (effectron->finish - effectron->start) / effectron->totalSteps + randOff;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_velocity = (effectron->_finish - effectron->_start) / effectron->_totalSteps + randOff;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// wide cone shaped spell
SPELLINITFUNCTION(waveSpellInit) {
- effectron->stepNo = 0;
- effectron->totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 2));
+ effectron->_stepNo = 0;
+ effectron->_totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 2));
- effectron->start = effectron->current;
- effectron->finish = effectron->parent->target->getPoint();
+ effectron->_start = effectron->_current;
+ effectron->_finish = effectron->_parent->target->getPoint();
- TilePoint tVect = effectron->finish - effectron->start ;
+ TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, waveSpellLength);
TilePoint orth = rightVector(tVect, 0);
- setMagnitude(orth, waveSpellWidth * (effectron->partno % 17 - 8) / 8);
+ setMagnitude(orth, waveSpellWidth * (effectron->_partno % 17 - 8) / 8);
- effectron->finish = effectron->start + tVect + orth;
+ effectron->_finish = effectron->_start + tVect + orth;
- effectron->velocity = (effectron->finish - effectron->start) / effectron->totalSteps + randOff;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_velocity = (effectron->_finish - effectron->_start) / effectron->_totalSteps + randOff;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// small exploding ball
SPELLINITFUNCTION(ballSpellInit) {
- effectron->stepNo = 0;
- effectron->start = effectron->current;
- effectron->finish = FireballVectors[effectron->partno];
- setMagnitude(effectron->finish, ballSpellRadius);
- effectron->finish = effectron->finish + effectron->start;
- effectron->totalSteps = 1 + (ballSpellRadius / SpellJumpiness);
- effectron->acceleration = TilePoint(0, 0, 0);
-
- TilePoint tp = (effectron->finish - effectron->start);
- effectron->totalSteps = 1 + (tp.magnitude() / SpellJumpiness);
- effectron->velocity = tp / effectron->totalSteps;
- effectron->velocity.z = 0;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_stepNo = 0;
+ effectron->_start = effectron->_current;
+ effectron->_finish = FireballVectors[effectron->_partno];
+ setMagnitude(effectron->_finish, ballSpellRadius);
+ effectron->_finish = effectron->_finish + effectron->_start;
+ effectron->_totalSteps = 1 + (ballSpellRadius / SpellJumpiness);
+ effectron->_acceleration = TilePoint(0, 0, 0);
+
+ TilePoint tp = (effectron->_finish - effectron->_start);
+ effectron->_totalSteps = 1 + (tp.magnitude() / SpellJumpiness);
+ effectron->_velocity = tp / effectron->_totalSteps;
+ effectron->_velocity.z = 0;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// square exploding ball
SPELLINITFUNCTION(squareSpellInit) {
- effectron->stepNo = 0;
- effectron->start = effectron->current;
- effectron->finish = SquareSpellVectors[effectron->partno];
- setMagnitude(effectron->finish, effectron->finish.magnitude()*squareSpellSize / 4);
- effectron->finish = effectron->finish + effectron->start;
- effectron->totalSteps = 1 + (squareSpellSize / SpellJumpiness);
- effectron->acceleration = TilePoint(0, 0, 0);
-
- TilePoint tp = (effectron->finish - effectron->start);
- effectron->totalSteps = 1 + (tp.magnitude() / SpellJumpiness);
- effectron->velocity = tp / effectron->totalSteps;
- effectron->velocity.z = 0;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_stepNo = 0;
+ effectron->_start = effectron->_current;
+ effectron->_finish = SquareSpellVectors[effectron->_partno];
+ setMagnitude(effectron->_finish, effectron->_finish.magnitude()*squareSpellSize / 4);
+ effectron->_finish = effectron->_finish + effectron->_start;
+ effectron->_totalSteps = 1 + (squareSpellSize / SpellJumpiness);
+ effectron->_acceleration = TilePoint(0, 0, 0);
+
+ TilePoint tp = (effectron->_finish - effectron->_start);
+ effectron->_totalSteps = 1 + (tp.magnitude() / SpellJumpiness);
+ effectron->_velocity = tp / effectron->_totalSteps;
+ effectron->_velocity.z = 0;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
// ------------------------------------------------------------------
// large exploding ball
SPELLINITFUNCTION(stormSpellInit) {
- effectron->stepNo = 0;
- effectron->start = effectron->current;
- effectron->finish = FireballVectors[effectron->partno];
- setMagnitude(effectron->finish, ballSpellRadius);
- effectron->finish = effectron->finish + effectron->start;
- effectron->totalSteps = 1 + (ballSpellRadius / SpellJumpiness);
- effectron->acceleration = TilePoint(0, 0, 0);
-
- TilePoint tp = (effectron->finish - effectron->start);
- effectron->totalSteps = 1 + (2 * tp.magnitude() / SpellJumpiness);
- effectron->velocity = tp / effectron->totalSteps;
- effectron->velocity.z = 0;
- effectron->acceleration = TilePoint(0, 0, 0);
+ effectron->_stepNo = 0;
+ effectron->_start = effectron->_current;
+ effectron->_finish = FireballVectors[effectron->_partno];
+ setMagnitude(effectron->_finish, ballSpellRadius);
+ effectron->_finish = effectron->_finish + effectron->_start;
+ effectron->_totalSteps = 1 + (ballSpellRadius / SpellJumpiness);
+ effectron->_acceleration = TilePoint(0, 0, 0);
+
+ TilePoint tp = (effectron->_finish - effectron->_start);
+ effectron->_totalSteps = 1 + (2 * tp.magnitude() / SpellJumpiness);
+ effectron->_velocity = tp / effectron->_totalSteps;
+ effectron->_velocity.z = 0;
+ effectron->_acceleration = TilePoint(0, 0, 0);
}
} // end of namespace Saga2
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index 58447840085..d9ac57500d0 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -325,17 +325,17 @@ void StorageSpellInstance::write(Common::MemoryWriteStreamDynamic *out) {
}
SpellTarget::SpellTarget(StorageSpellTarget &sst) {
- type = (SpellTarget::spellTargetType) sst.type;
- loc = sst.loc;
- next = nullptr;
+ _type = (SpellTarget::spellTargetType) sst.type;
+ _loc = sst.loc;
+ _next = nullptr;
if (sst.obj != Nothing)
- obj = GameObject::objectAddress(sst.obj);
+ _obj = GameObject::objectAddress(sst.obj);
else
- obj = nullptr;
+ _obj = nullptr;
if (sst.tag != NoActiveItem)
- tag = ActiveItem::activeItemAddress(sst.tag);
+ _tag = ActiveItem::activeItemAddress(sst.tag);
else
- tag = nullptr;
+ _tag = nullptr;
}
SpellInstance::SpellInstance(StorageSpellInstance &ssi) {
@@ -468,23 +468,23 @@ StorageEffectron::StorageEffectron() {
}
StorageEffectron::StorageEffectron(Effectron &e) {
- flags = e.flags;
- size = e.size;
- hitBox = e.hitBox;
- screenCoords = e.screenCoords;
- partno = e.partno;
- start = e.start;
- finish = e.finish;
- current = e.current;
- velocity = e.velocity;
- acceleration = e.acceleration;
- totalSteps = e.totalSteps;
- stepNo = e.stepNo;
- hgt = e.hgt;
- brd = e.brd;
- pos = e.pos;
- spr = e.spr;
- age = e.age;
+ flags = e._flags;
+ size = e._size;
+ hitBox = e._hitBox;
+ screenCoords = e._screenCoords;
+ partno = e._partno;
+ start = e._start;
+ finish = e._finish;
+ current = e._current;
+ velocity = e._velocity;
+ acceleration = e._acceleration;
+ totalSteps = e._totalSteps;
+ stepNo = e._stepNo;
+ hgt = e._hgt;
+ brd = e._brd;
+ pos = e._pos;
+ spr = e._spr;
+ age = e._age;
}
void StorageEffectron::read(Common::InSaveFile *in) {
@@ -528,24 +528,24 @@ void StorageEffectron::write(Common::MemoryWriteStreamDynamic *out) {
}
Effectron::Effectron(StorageEffectron &se, SpellInstance *si) {
- flags = se.flags;
- size = se.size;
- hitBox = se.hitBox;
- screenCoords = se.screenCoords;
- partno = se.partno;
- start = se.start;
- finish = se.finish;
- current = se.current;
- velocity = se.velocity;
- acceleration = se.acceleration;
- totalSteps = se.totalSteps;
- stepNo = se.stepNo;
- hgt = se.hgt;
- brd = se.brd;
- pos = se.pos;
- spr = se.spr;
- age = se.age;
- parent = si;
+ _flags = se.flags;
+ _size = se.size;
+ _hitBox = se.hitBox;
+ _screenCoords = se.screenCoords;
+ _partno = se.partno;
+ _start = se.start;
+ _finish = se.finish;
+ _current = se.current;
+ _velocity = se.velocity;
+ _acceleration = se.acceleration;
+ _totalSteps = se.totalSteps;
+ _stepNo = se.stepNo;
+ _hgt = se.hgt;
+ _brd = se.brd;
+ _pos = se.pos;
+ _spr = se.spr;
+ _age = se.age;
+ _parent = si;
}
} // end of namespace Saga2
diff --git a/engines/saga2/spellloc.cpp b/engines/saga2/spellloc.cpp
index 58acdcbadb6..b783f8fdb3f 100644
--- a/engines/saga2/spellloc.cpp
+++ b/engines/saga2/spellloc.cpp
@@ -44,105 +44,105 @@ namespace Saga2 {
// null spell
SPELLLOCATIONFUNCTION(invisibleSpellPos) {
- return effectron->finish;
+ return effectron->_finish;
}
// ------------------------------------------------------------------
// aura that tracks target
SPELLLOCATIONFUNCTION(auraSpellPos) {
- return effectron->finish;
+ return effectron->_finish;
}
// ------------------------------------------------------------------
// aura that tracks target (in front)
SPELLLOCATIONFUNCTION(glowSpellPos) {
- return effectron->finish - TilePoint(8, 8, 0);
+ return effectron->_finish - TilePoint(8, 8, 0);
}
// ------------------------------------------------------------------
// sprites that surround target
SPELLLOCATIONFUNCTION(wallSpellPos) {
- return effectron->parent->target->getPoint() + effectron->velocity;
+ return effectron->_parent->target->getPoint() + effectron->_velocity;
}
// ------------------------------------------------------------------
// projectile from caster to target
SPELLLOCATIONFUNCTION(projectileSpellPos) {
- return effectron->current + effectron->velocity;
+ return effectron->_current + effectron->_velocity;
}
// ------------------------------------------------------------------
// bi-directional beams of energy
SPELLLOCATIONFUNCTION(exchangeSpellPos) {
- if (effectron->stepNo < effectron->partno / 2)
- return effectron->current;
- return effectron->current + effectron->velocity;
+ if (effectron->_stepNo < effectron->_partno / 2)
+ return effectron->_current;
+ return effectron->_current + effectron->_velocity;
}
// ------------------------------------------------------------------
// lightning bolt shaped spell
SPELLLOCATIONFUNCTION(boltSpellPos) {
- if ((effectron->partno / 9) >= effectron->stepNo)
- return effectron->current;
- return effectron->current +
- effectron->velocity;
+ if ((effectron->_partno / 9) >= effectron->_stepNo)
+ return effectron->_current;
+ return effectron->_current +
+ effectron->_velocity;
}
// ------------------------------------------------------------------
// narrow bolt
SPELLLOCATIONFUNCTION(beamSpellPos) {
- return effectron->start + randomVector(-effectron->velocity, effectron->velocity);
+ return effectron->_start + randomVector(-effectron->_velocity, effectron->_velocity);
}
// ------------------------------------------------------------------
// narrow cone shaped spell
SPELLLOCATIONFUNCTION(coneSpellPos) {
- if (effectron->partno / 9 >= effectron->stepNo)
- return effectron->current;
- return effectron->current +
- effectron->velocity;
+ if (effectron->_partno / 9 >= effectron->_stepNo)
+ return effectron->_current;
+ return effectron->_current +
+ effectron->_velocity;
}
// ------------------------------------------------------------------
// wide cone shaped spell
SPELLLOCATIONFUNCTION(waveSpellPos) {
- if (effectron->partno / 17 >= effectron->stepNo)
- return effectron->current;
- return effectron->current +
- effectron->velocity;
+ if (effectron->_partno / 17 >= effectron->_stepNo)
+ return effectron->_current;
+ return effectron->_current +
+ effectron->_velocity;
}
// ------------------------------------------------------------------
// small exploding ball
SPELLLOCATIONFUNCTION(ballSpellPos) {
- return effectron->current +
- effectron->velocity;
+ return effectron->_current +
+ effectron->_velocity;
}
// ------------------------------------------------------------------
// square exploding ball
SPELLLOCATIONFUNCTION(squareSpellPos) {
- return effectron->current +
- effectron->velocity;
+ return effectron->_current +
+ effectron->_velocity;
}
// ------------------------------------------------------------------
// large exploding ball
SPELLLOCATIONFUNCTION(stormSpellPos) {
- return effectron->current +
- effectron->velocity;
+ return effectron->_current +
+ effectron->_velocity;
}
} // end of namespace Saga2
diff --git a/engines/saga2/spellsiz.cpp b/engines/saga2/spellsiz.cpp
index ea7e7cf8002..a31112e3ec5 100644
--- a/engines/saga2/spellsiz.cpp
+++ b/engines/saga2/spellsiz.cpp
@@ -29,19 +29,19 @@
namespace Saga2 {
SPELLHEIGHTFUNCTION(ShortTillThere) {
- if (effectron->stepNo <= effectron->totalSteps) {
+ if (effectron->_stepNo <= effectron->_totalSteps) {
return 8;
- } else if (effectron->stepNo - effectron->totalSteps <= 8) {
- return 8 * (effectron->stepNo - effectron->totalSteps);
+ } else if (effectron->_stepNo - effectron->_totalSteps <= 8) {
+ return 8 * (effectron->_stepNo - effectron->_totalSteps);
}
return 0;
}
SPELLBREADTHFUNCTION(ThinTillThere) {
- if (effectron->stepNo <= effectron->totalSteps) {
+ if (effectron->_stepNo <= effectron->_totalSteps) {
return 8;
- } else if (effectron->stepNo - effectron->totalSteps <= 8) {
- return 8 * (effectron->stepNo - effectron->totalSteps);
+ } else if (effectron->_stepNo - effectron->_totalSteps <= 8) {
+ return 8 * (effectron->_stepNo - effectron->_totalSteps);
}
return 0;
}
diff --git a/engines/saga2/spellspr.cpp b/engines/saga2/spellspr.cpp
index e6638accfd3..15677800bfd 100644
--- a/engines/saga2/spellspr.cpp
+++ b/engines/saga2/spellspr.cpp
@@ -39,25 +39,25 @@ namespace Saga2 {
* ===================================================================== */
// random sprite from primary range
-#define PRIMARY (effectron->parent->dProto->primarySpriteNo?\
- (effectron->parent->dProto->primarySpriteID + g_vm->_rnd->getRandomNumber(effectron->parent->dProto->primarySpriteNo - 1)):\
- effectron->parent->dProto->primarySpriteID)
+#define PRIMARY (effectron->_parent->dProto->primarySpriteNo?\
+ (effectron->_parent->dProto->primarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->dProto->primarySpriteNo - 1)):\
+ effectron->_parent->dProto->primarySpriteID)
// random sprite from secondary range
-#define SECONDARY (effectron->parent->dProto->secondarySpriteNo?\
- (effectron->parent->dProto->secondarySpriteID + g_vm->_rnd->getRandomNumber(effectron->parent->dProto->secondarySpriteNo - 1)):\
- effectron->parent->dProto->secondarySpriteID)
+#define SECONDARY (effectron->_parent->dProto->secondarySpriteNo?\
+ (effectron->_parent->dProto->secondarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->dProto->secondarySpriteNo - 1)):\
+ effectron->_parent->dProto->secondarySpriteID)
// ordered sprite from primary range
-#define SEQUENTIAL (effectron->parent->dProto->primarySpriteNo?\
- (effectron->parent->dProto->primarySpriteID + effectron->stepNo%effectron->parent->dProto->primarySpriteNo):\
- effectron->parent->dProto->primarySpriteID)
+#define SEQUENTIAL (effectron->_parent->dProto->primarySpriteNo?\
+ (effectron->_parent->dProto->primarySpriteID + effectron->_stepNo%effectron->_parent->dProto->primarySpriteNo):\
+ effectron->_parent->dProto->primarySpriteID)
// ordered sprite from secondary range
-#define SECUENTIAL (effectron->parent->dProto->secondarySpriteNo?\
- (effectron->parent->dProto->secondarySpriteID + effectron->stepNo%effectron->parent->dProto->secondarySpriteNo):\
- effectron->parent->dProto->secondarySpriteID)
+#define SECUENTIAL (effectron->_parent->dProto->secondarySpriteNo?\
+ (effectron->_parent->dProto->secondarySpriteID + effectron->_stepNo%effectron->_parent->dProto->secondarySpriteNo):\
+ effectron->_parent->dProto->secondarySpriteID)
// ordered sprite from primary range for exchange
-#define SEMIQUENTIAL (effectron->parent->dProto->primarySpriteNo?\
- (effectron->parent->dProto->primarySpriteID + (effectron->partno/2)%effectron->parent->dProto->primarySpriteNo):\
- effectron->parent->dProto->primarySpriteID)
+#define SEMIQUENTIAL (effectron->_parent->dProto->primarySpriteNo?\
+ (effectron->_parent->dProto->primarySpriteID + (effectron->_partno/2)%effectron->_parent->dProto->primarySpriteNo):\
+ effectron->_parent->dProto->primarySpriteID)
/* ===================================================================== *
Color mapping selection
@@ -80,16 +80,16 @@ int16 whichColorMap(EffectID eid, const Effectron *const effectron) {
case eAreaSquare:
case eAreaBall:
case eAreaStorm:
- rval = (effectron->parent->effSeq == 0) ? 0 : 1;
+ rval = (effectron->_parent->effSeq == 0) ? 0 : 1;
break;
case eAreaBolt:
- rval = ((effectron->partno % 3) == 1) ? 0 : 1;
+ rval = ((effectron->_partno % 3) == 1) ? 0 : 1;
break;
case eAreaCone:
- rval = ((effectron->partno / 9) == 0) ? 0 : 1;
+ rval = ((effectron->_partno / 9) == 0) ? 0 : 1;
break;
case eAreaWave:
- rval = ((effectron->partno / 17) == 0) ? 0 : 1;
+ rval = ((effectron->_partno / 17) == 0) ? 0 : 1;
break;
}
return rval;
@@ -106,7 +106,7 @@ SPELLSPRITATIONFUNCTION(invisibleSprites) {
}
SPELLSPRITATIONFUNCTION(auraSprites) {
- if (effectron->parent->effSeq)
+ if (effectron->_parent->effSeq)
return SECUENTIAL;
return SEQUENTIAL;
}
@@ -128,37 +128,37 @@ SPELLSPRITATIONFUNCTION(beamSprites) {
}
SPELLSPRITATIONFUNCTION(boltSprites) {
- if ((effectron->partno % 3) == 1)
+ if ((effectron->_partno % 3) == 1)
return PRIMARY;
return SECONDARY;
}
SPELLSPRITATIONFUNCTION(coneSprites) {
- if ((effectron->partno / 9) == 0)
+ if ((effectron->_partno / 9) == 0)
return PRIMARY;
return SECONDARY;
}
SPELLSPRITATIONFUNCTION(ballSprites) {
- if (effectron->parent->effSeq)
+ if (effectron->_parent->effSeq)
return SECONDARY;
return PRIMARY;
}
SPELLSPRITATIONFUNCTION(squareSprites) {
- if (effectron->parent->effSeq)
+ if (effectron->_parent->effSeq)
return SECONDARY;
return PRIMARY;
}
SPELLSPRITATIONFUNCTION(waveSprites) {
- if ((effectron->partno / 17) == 0)
+ if ((effectron->_partno / 17) == 0)
return PRIMARY;
return SECONDARY;
}
SPELLSPRITATIONFUNCTION(stormSprites) {
- if (effectron->parent->effSeq)
+ if (effectron->_parent->effSeq)
return SECONDARY;
return PRIMARY;
}
diff --git a/engines/saga2/spellsta.cpp b/engines/saga2/spellsta.cpp
index dc7a93f7aa8..19c9496d8f4 100644
--- a/engines/saga2/spellsta.cpp
+++ b/engines/saga2/spellsta.cpp
@@ -52,13 +52,13 @@ SPELLSTATUSFUNCTION(invisibleSpellSta) {
// semi permanent aura
SPELLSTATUSFUNCTION(auraSpellSta) {
- if (effectron->stepNo > effectron->totalSteps)
+ if (effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(wallSpellSta) {
- if (effectron->stepNo > effectron->totalSteps)
+ if (effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
@@ -66,68 +66,68 @@ SPELLSTATUSFUNCTION(wallSpellSta) {
// projectile spell ( also used as first half of exploding spells
SPELLSTATUSFUNCTION(projectileSpellSta) {
- if (effectron->stepNo > effectron->totalSteps)
+ if (effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(exchangeSpellSta) {
- if (effectron->stepNo < effectron->partno / 2)
+ if (effectron->_stepNo < effectron->_partno / 2)
return effectronHidden;
- if (effectron->stepNo >= effectron->totalSteps)
+ if (effectron->_stepNo >= effectron->_totalSteps)
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(boltSpellSta) {
- if (effectron->stepNo - (effectron->partno / 9) > effectron->totalSteps)
+ if (effectron->_stepNo - (effectron->_partno / 9) > effectron->_totalSteps)
return effectronDead;
- if ((effectron->partno / 9) >= effectron->stepNo)
+ if ((effectron->_partno / 9) >= effectron->_stepNo)
return effectronHidden;
return 0;
}
SPELLSTATUSFUNCTION(beamSpellSta) {
- if ((effectron->partno > effectron->totalSteps) ||
- (effectron->stepNo > effectron->totalSteps))
+ if ((effectron->_partno > effectron->_totalSteps) ||
+ (effectron->_stepNo > effectron->_totalSteps))
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(coneSpellSta) {
- if (effectron->stepNo - (effectron->partno / 9) > effectron->totalSteps)
+ if (effectron->_stepNo - (effectron->_partno / 9) > effectron->_totalSteps)
return effectronDead;
- if (effectron->partno / 9 >= effectron->stepNo)
+ if (effectron->_partno / 9 >= effectron->_stepNo)
return effectronHidden;
return 0;
}
SPELLSTATUSFUNCTION(waveSpellSta) {
- if (effectron->stepNo - (effectron->partno / 17) > effectron->totalSteps)
+ if (effectron->_stepNo - (effectron->_partno / 17) > effectron->_totalSteps)
return effectronDead;
- if (effectron->partno / 17 < effectron->stepNo)
+ if (effectron->_partno / 17 < effectron->_stepNo)
return effectronHidden;
return 0;
}
SPELLSTATUSFUNCTION(ballSpellSta) {
if (effectron->isBumped() ||
- effectron->stepNo > effectron->totalSteps)
+ effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(squareSpellSta) {
if (effectron->isBumped() ||
- effectron->stepNo > effectron->totalSteps)
+ effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
SPELLSTATUSFUNCTION(stormSpellSta) {
if (effectron->isBumped() ||
- effectron->stepNo > effectron->totalSteps)
+ effectron->_stepNo > effectron->_totalSteps)
return effectronDead;
return 0;
}
diff --git a/engines/saga2/spelshow.h b/engines/saga2/spelshow.h
index 78d53534be0..52e11d2e614 100644
--- a/engines/saga2/spelshow.h
+++ b/engines/saga2/spelshow.h
@@ -363,14 +363,14 @@ public :
// Some functions that require the above definitions to work
inline GameWorld *Effectron::world() const {
- return parent->world;
+ return _parent->world;
}
inline int16 Effectron::getMapNum() const {
- return parent->world->_mapNum;
+ return _parent->world->_mapNum;
}
inline EffectID Effectron::spellID() {
- return parent->spell;
+ return _parent->spell;
}
inline SpellDisplayPrototype *Effectron::spell() {
return (*g_vm->_sdpList)[(SpellID) spellID()];
@@ -379,26 +379,26 @@ inline EffectID Effectron::effectID() {
return spell()->effect;
}
inline EffectDisplayPrototype *Effectron::effect() {
- return parent->effect;
+ return _parent->effect;
}
inline EffectronFlags Effectron::staCall() {
- return parent->effect->status(this);
+ return _parent->effect->status(this);
}
inline TilePoint Effectron::posCall() {
- return parent->effect->location(this);
+ return _parent->effect->location(this);
}
inline SpellSpritationSeed Effectron::sprCall() {
- return parent->effect->spriteno(this);
+ return _parent->effect->spriteno(this);
}
inline spellHeight Effectron::hgtCall() {
- return parent->effect->height(this);
+ return _parent->effect->height(this);
}
inline spellBreadth Effectron::brdCall() {
- return parent->effect->breadth(this);
+ return _parent->effect->breadth(this);
}
inline void Effectron::initCall(int16 eno) {
- partno = eno;
- parent->effect->init(this);
+ _partno = eno;
+ _parent->effect->init(this);
}
/* ===================================================================== *
Commit: c68a1a910c14a560ca7d60cc65bdb44a4450e060
https://github.com/scummvm/scummvm/commit/c68a1a910c14a560ca7d60cc65bdb44a4450e060
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Renamed class variables in spellbuk.h
Changed paths:
engines/saga2/spelcast.cpp
engines/saga2/spellbuk.h
engines/saga2/spellio.cpp
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 14ad5ab99f7..99ed0d6d7ca 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -61,19 +61,19 @@ int32 scatterer(int32 i, int32 m, int32 s);
// ctor
SpellStuff::SpellStuff() {
- master = nullSpell;
- display = nullSpell;
- prototype = nullptr;
- targetableTypes = spellTargNone;
- targetTypes = spellApplyNone;
- effects = nullptr;
- targets = nullptr;
- manaType = sManaIDSkill;
- manaUse = 0;
- shape = eAreaInvisible;
- size = 0;
- range = 0;
- sound = 0;
+ _master = nullSpell;
+ _display = nullSpell;
+ _prototype = nullptr;
+ _targetableTypes = spellTargNone;
+ _targetTypes = spellApplyNone;
+ _effects = nullptr;
+ _targets = nullptr;
+ _manaType = sManaIDSkill;
+ _manaUse = 0;
+ _shape = eAreaInvisible;
+ _size = 0;
+ _range = 0;
+ _sound = 0;
_debug = false;
}
@@ -90,7 +90,7 @@ bool SpellStuff::isOffensive() {
// determine whether an area spell protects the caster
bool SpellStuff::safe() {
- switch (shape) {
+ switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
@@ -115,12 +115,12 @@ bool SpellStuff::safe() {
// add an internal effect to a spell
void SpellStuff::addEffect(ProtoEffect *pe) {
- if (effects == nullptr)
- effects = pe;
+ if (_effects == nullptr)
+ _effects = pe;
else {
- ProtoEffect *tail;
- for (tail = effects; tail->_next; tail = tail->_next) ;
- tail->_next = pe;
+ ProtoEffect *_tail;
+ for (_tail = _effects; _tail->_next; _tail = _tail->_next) ;
+ _tail->_next = pe;
}
}
@@ -128,9 +128,9 @@ void SpellStuff::addEffect(ProtoEffect *pe) {
// play the sound associated with a spell
void SpellStuff::playSound(GameObject *go) {
- if (sound) {
+ if (_sound) {
Location cal = go->notGetWorldLocation(); //Location(go->getLocation(),go->IDParent());
- Saga2::playSoundAt(MKTAG('S', 'P', 'L', sound), cal);
+ Saga2::playSoundAt(MKTAG('S', 'P', 'L', _sound), cal);
}
}
@@ -138,10 +138,10 @@ void SpellStuff::playSound(GameObject *go) {
// cleanup
void SpellStuff::killEffects() {
- if (effects) {
- delete effects;
+ if (_effects) {
+ delete _effects;
}
- effects = nullptr;
+ _effects = nullptr;
}
//-----------------------------------------------------------------------
@@ -154,7 +154,7 @@ void SpellStuff::implement(GameObject *enactor, SpellTarget *target) {
implement(enactor, Location(target->getPoint(), Nothing));
break;
case SpellTarget::spellTargetObjectPoint:
- if (targetTypes == spellApplyObject)
+ if (_targetTypes == spellApplyObject)
implement(enactor, target->getObject());
else
implement(enactor, Location(target->getPoint(), Nothing));
@@ -179,8 +179,8 @@ void SpellStuff::implement(GameObject *enactor, GameObject *target) {
target->thisID() == enactor->thisID() &&
!canTarget(spellTargCaster))
return;
- if (effects) {
- for (ProtoEffect *pe = effects; pe; pe = pe->_next)
+ if (_effects) {
+ for (ProtoEffect *pe = _effects; pe; pe = pe->_next)
if (pe->applicable(st))
pe->implement(enactor, &st);
}
@@ -191,8 +191,8 @@ void SpellStuff::implement(GameObject *enactor, GameObject *target) {
void SpellStuff::implement(GameObject *enactor, ActiveItem *target) {
SpellTarget st = SpellTarget(target);
- if (effects) {
- for (ProtoEffect *pe = effects; pe; pe = pe->_next)
+ if (_effects) {
+ for (ProtoEffect *pe = _effects; pe; pe = pe->_next)
if (pe->applicable(st))
pe->implement(enactor, &st);
}
@@ -204,14 +204,14 @@ void SpellStuff::implement(GameObject *enactor, ActiveItem *target) {
void SpellStuff::implement(GameObject *enactor, Location target) {
SpellTarget st = SpellTarget(target);
buildTargetList(enactor, st);
- if (effects && targets) {
- for (SpellTarget *t = targets; t; t = t->_next) {
+ if (_effects && _targets) {
+ for (SpellTarget *t = _targets; t; t = t->_next) {
if (safe() &&
t->getObject() != nullptr &&
t->getObject()->thisID() == enactor->thisID() &&
!canTarget(spellTargCaster))
continue;
- for (ProtoEffect *pe = effects; pe; pe = pe->_next)
+ for (ProtoEffect *pe = _effects; pe; pe = pe->_next)
if (pe->applicable(*t))
pe->implement(enactor, t);
}
@@ -223,17 +223,17 @@ void SpellStuff::implement(GameObject *enactor, Location target) {
// determine target list for a spell
void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
- int16 radius = size;
+ int16 radius = _size;
TilePoint tVect, orth, tBase;
show(caster, trg);
- switch (shape) {
+ switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
- targets = &trg;
+ _targets = &trg;
break;
case eAreaSquare: {
tVect = trg.getPoint();
@@ -367,10 +367,10 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
// add a target to the target list
void SpellStuff::addTarget(SpellTarget *trg) {
- if (targets == nullptr)
- targets = trg;
+ if (_targets == nullptr)
+ _targets = trg;
else {
- SpellTarget *t = targets;
+ SpellTarget *t = _targets;
while (t->_next) t = t->_next;
t->_next = trg;
}
@@ -380,14 +380,14 @@ void SpellStuff::addTarget(SpellTarget *trg) {
// clean the target list
void SpellStuff::removeTargetList() {
- switch (shape) {
+ switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
- targets = nullptr;
+ _targets = nullptr;
break;
case eAreaWall:
case eAreaCone:
@@ -396,13 +396,13 @@ void SpellStuff::removeTargetList() {
case eAreaBall:
case eAreaStorm:
case eAreaSquare:
- if (targets) delete targets;
- targets = nullptr;
+ if (_targets) delete _targets;
+ _targets = nullptr;
break;
default:
error("bad spell");
}
- assert(targets == nullptr);
+ assert(_targets == nullptr);
}
//-----------------------------------------------------------------------
@@ -418,9 +418,9 @@ void showTarg(const TilePoint &tp) {
void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
if (!_debug) return;
- int16 radius = size;
+ int16 radius = _size;
TilePoint tVect, orth, tBase;
- switch (shape) {
+ switch (_shape) {
case eAreaInvisible:
showTarg(trg.getPoint());
break;
diff --git a/engines/saga2/spellbuk.h b/engines/saga2/spellbuk.h
index 5ce324f46ec..ffbb8ede744 100644
--- a/engines/saga2/spellbuk.h
+++ b/engines/saga2/spellbuk.h
@@ -109,19 +109,19 @@ enum effectAreas {
// parts of the code
class SpellStuff {
- SpellID master; // index in array
- SkillProto *prototype; // ponts back to object prototype
- SpellID display; // currently same as master
- SpellTargetingTypes targetableTypes; // valid targeting types
- SpellApplicationTypes targetTypes; // the targeting type to implement
- ProtoEffect *effects; // the effects of this spell
- SpellTarget *targets; // transient target list
- SpellManaID manaType; // color mana used
- int8 manaUse; // mana points used
- effectAreas shape;
- int32 size;
- int32 range;
- int16 sound;
+ SpellID _master; // index in array
+ SkillProto *_prototype; // ponts back to object prototype
+ SpellID _display; // currently same as master
+ SpellTargetingTypes _targetableTypes; // valid targeting types
+ SpellApplicationTypes _targetTypes; // the targeting type to implement
+ ProtoEffect *_effects; // the effects of this spell
+ SpellTarget *_targets; // transient target list
+ SpellManaID _manaType; // color mana used
+ int8 _manaUse; // mana points used
+ effectAreas _shape;
+ int32 _size;
+ int32 _range;
+ int16 _sound;
bool _debug;
@@ -129,11 +129,11 @@ public:
SpellStuff();
- void setProto(SkillProto *p) {
- prototype = p;
+ void setProto(SkillProto *p) {
+ _prototype = p;
}
- SkillProto *getProto() {
- return prototype;
+ SkillProto *getProto() {
+ return _prototype;
}
void setupFromResource(ResourceSpellItem *rsi);
@@ -142,17 +142,17 @@ public:
void addEffect(ResourceSpellEffect *rse);
void killEffects();
- bool canTarget(SpellTargetingTypes t) {
- return targetableTypes & t;
+ bool canTarget(SpellTargetingTypes t) {
+ return _targetableTypes & t;
}
bool shouldTarget(SpellApplicationTypes t) {
- return targetTypes & t;
+ return _targetTypes & t;
}
- bool untargetable() {
- return (targetableTypes == spellTargNone);
+ bool untargetable() {
+ return (_targetableTypes == spellTargNone);
}
- bool untargeted() {
+ bool untargeted() {
return false; //(targetableTypes == spellTargWorld ) ||
}
//(targetableTypes == spellTargCaster ) ||
@@ -164,20 +164,20 @@ public:
void implement(GameObject *enactor, ActiveItem *target);
void implement(GameObject *enactor, Location target);
- SpellID getDisplayID() {
- return display;
+ SpellID getDisplayID() {
+ return _display;
}
- SpellManaID getManaType() {
- return manaType;
+ SpellManaID getManaType() {
+ return _manaType;
}
- void setManaType(SpellManaID smid) {
- manaType = smid;
+ void setManaType(SpellManaID smid) {
+ _manaType = smid;
}
- int8 getManaAmt() {
- return manaUse;
+ int8 getManaAmt() {
+ return _manaUse;
}
- int32 getRange() {
- return range;
+ int32 getRange() {
+ return _range;
}
void buildTargetList(GameObject *, SpellTarget &);
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index d9ac57500d0..ab9489489b6 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -73,15 +73,15 @@ SpellDisplayPrototype::SpellDisplayPrototype(ResourceSpellItem *rsi) {
// init from res file
void SpellStuff::setupFromResource(ResourceSpellItem *rsi) {
- master = (SpellID) rsi->spell;
- display = (SpellID) rsi->spell;
- targetableTypes = (SpellTargetingTypes) rsi->targs;
- targetTypes = (SpellApplicationTypes) rsi->applys;
- manaType = (SpellManaID) rsi->manaType;
- manaUse = rsi->manaAmount;
- shape = (effectAreas) rsi->effect;
- size = 0;
- sound = rsi->soundID;
+ _master = (SpellID) rsi->spell;
+ _display = (SpellID) rsi->spell;
+ _targetableTypes = (SpellTargetingTypes) rsi->targs;
+ _targetTypes = (SpellApplicationTypes) rsi->applys;
+ _manaType = (SpellManaID) rsi->manaType;
+ _manaUse = rsi->manaAmount;
+ _shape = (effectAreas) rsi->effect;
+ _size = 0;
+ _sound = rsi->soundID;
}
// ------------------------------------------------------------------
@@ -89,7 +89,7 @@ void SpellStuff::setupFromResource(ResourceSpellItem *rsi) {
void SpellStuff::addEffect(ResourceSpellEffect *rse) {
ProtoEffect *pe = nullptr;
- assert(rse && rse->spell == master);
+ assert(rse && rse->spell == _master);
switch (rse->effectGroup) {
case effectNone :
return;
@@ -190,11 +190,11 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
if (pe == nullptr)
error("failed to alloc protoEffect");
- if (effects == nullptr)
- effects = pe;
+ if (_effects == nullptr)
+ _effects = pe;
else {
ProtoEffect *tail;
- for (tail = effects; tail->_next; tail = tail->_next) ;
+ for (tail = _effects; tail->_next; tail = tail->_next) ;
tail->_next = pe;
}
}
Commit: 6ccffbfbf83d0d274e0400dd1b05d9c0c5662543
https://github.com/scummvm/scummvm/commit/6ccffbfbf83d0d274e0400dd1b05d9c0c5662543
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:55+02:00
Commit Message:
SAGA2: Rename class variables in spelshow.h
Changed paths:
engines/saga2/dispnode.cpp
engines/saga2/spelcast.cpp
engines/saga2/speldraw.cpp
engines/saga2/spellini.cpp
engines/saga2/spellio.cpp
engines/saga2/spellloc.cpp
engines/saga2/spellspr.cpp
engines/saga2/spelshow.h
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index 25ffa892edc..7442f530853 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -980,8 +980,7 @@ void Effectron::drawEffect() {
sc->sp = spellSprites->sprite(spriteID()); //tempSpellSpriteIDs[rand()%39] );
sc->offset.x = scList->offset.y = 0;
- (*g_vm->_sdpList)[_parent->spell]->
- getColorTranslation(eColors, this);
+ (*g_vm->_sdpList)[_parent->_spell]->getColorTranslation(eColors, this);
sc->colorTable = eColors;
sc->flipped = false;
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 99ed0d6d7ca..f905bc3cfab 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -582,10 +582,10 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
SpellInstance::SpellInstance(SpellCaster *newCaster, SpellTarget *newTarget, SpellID spellNo) {
assert(newCaster);
assert(newTarget);
- caster = newCaster;
- target = new SpellTarget(*newTarget);
- world = newCaster->world();
- spell = spellNo;
+ _caster = newCaster;
+ _target = new SpellTarget(*newTarget);
+ _world = newCaster->world();
+ _spell = spellNo;
init();
}
@@ -594,10 +594,10 @@ SpellInstance::SpellInstance(SpellCaster *newCaster, SpellTarget *newTarget, Spe
SpellInstance::SpellInstance(SpellCaster *newCaster, GameObject &newTarget, SpellID spellNo) {
assert(newCaster);
- target = new SpellTarget(newTarget);
- caster = newCaster;
- world = newCaster->world();
- spell = spellNo;
+ _target = new SpellTarget(newTarget);
+ _caster = newCaster;
+ _world = newCaster->world();
+ _spell = spellNo;
init();
}
@@ -607,10 +607,10 @@ SpellInstance::SpellInstance(SpellCaster *newCaster, GameObject &newTarget, Spel
SpellInstance::SpellInstance(SpellCaster *newCaster, GameObject *newTarget, SpellID spellNo) {
assert(newCaster);
assert(newTarget);
- target = new SpellTarget(newTarget);
- caster = newCaster;
- world = newCaster->world();
- spell = spellNo;
+ _target = new SpellTarget(newTarget);
+ _caster = newCaster;
+ _world = newCaster->world();
+ _spell = spellNo;
init();
}
@@ -619,10 +619,10 @@ SpellInstance::SpellInstance(SpellCaster *newCaster, GameObject *newTarget, Spel
SpellInstance::SpellInstance(SpellCaster *newCaster, TilePoint &newTarget, SpellID spellNo) {
assert(newCaster);
- target = new SpellTarget(newTarget);
- caster = newCaster;
- world = newCaster->world();
- spell = spellNo;
+ _target = new SpellTarget(newTarget);
+ _caster = newCaster;
+ _world = newCaster->world();
+ _spell = spellNo;
init();
}
@@ -631,38 +631,41 @@ SpellInstance::SpellInstance(SpellCaster *newCaster, TilePoint &newTarget, Spell
SpellInstance::~SpellInstance() {
- if (age < implementAge && g_vm->_gameRunning)
- spellBook[spell].implement(caster, target);
- for (int32 i = 0; i < eList._count; i++) {
- if (eList._displayList[i]._efx)
- delete eList._displayList[i]._efx;
- eList._displayList[i]._efx = nullptr;
+ if (_age < _implementAge && g_vm->_gameRunning)
+ spellBook[_spell].implement(_caster, _target);
+ for (int32 i = 0; i < _eList._count; i++) {
+ if (_eList._displayList[i]._efx)
+ delete _eList._displayList[i]._efx;
+ _eList._displayList[i]._efx = nullptr;
}
- if (target)
- delete target;
- target = nullptr;
+ if (_target)
+ delete _target;
+ _target = nullptr;
}
// ------------------------------------------------------------------
// common initialization code
void SpellInstance::init() {
- dProto = (*g_vm->_sdpList)[spell];
- ProtoObj *proto = caster->proto();
- TilePoint sPoint = caster->getWorldLocation();
+ _dProto = (*g_vm->_sdpList)[_spell];
+ ProtoObj *proto = _caster->proto();
+ TilePoint sPoint = _caster->getWorldLocation();
sPoint.z += proto->height / 2;
- age = 0;
- implementAge = 0;
- effSeq = 0;
- assert(dProto);
- if (!dProto) return;
- effect = (*g_vm->_edpList)[dProto->effect];
- implementAge = dProto->implementAge;
- maxAge = dProto->maxAge;
+ _age = 0;
+ _implementAge = 0;
+ _effSeq = 0;
+
+ assert(_dProto);
+ if (!_dProto)
+ return;
+
+ _effect = (*g_vm->_edpList)[_dProto->_effect];
+ _implementAge = _dProto->_implementAge;
+ _maxAge = _dProto->_maxAge;
initEffect(sPoint);
- if (implementAge == 0)
- spellBook[spell].implement(caster, target);
+ if (_implementAge == 0)
+ spellBook[_spell].implement(_caster, _target);
}
@@ -670,11 +673,11 @@ void SpellInstance::init() {
// common cleanup
void SpellInstance::termEffect() {
- if (eList._count)
- for (int32 i = 0; i < eList._count; i++) {
- if (eList._displayList[i]._efx) {
- delete eList._displayList[i]._efx;
- eList._displayList[i]._efx = nullptr;
+ if (_eList._count)
+ for (int32 i = 0; i < _eList._count; i++) {
+ if (_eList._displayList[i]._efx) {
+ delete _eList._displayList[i]._efx;
+ _eList._displayList[i]._efx = nullptr;
}
}
}
@@ -683,11 +686,11 @@ void SpellInstance::termEffect() {
// visual init
void SpellInstance::initEffect(TilePoint startpoint) {
- eList._count = effect->nodeCount; //sdp->effCount;
- if (eList._count)
- for (int32 i = 0; i < eList._count; i++) {
+ _eList._count = _effect->_nodeCount; //sdp->effCount;
+ if (_eList._count)
+ for (int32 i = 0; i < _eList._count; i++) {
Effectron *e = new Effectron(0, i);
- eList._displayList[i]._efx = e;
+ _eList._displayList[i]._efx = e;
e->_parent = this;
e->_start = startpoint;
e->_current = startpoint;
@@ -701,16 +704,16 @@ void SpellInstance::initEffect(TilePoint startpoint) {
// visual update
bool SpellInstance::buildList() {
- if (eList.dissipated()) {
+ if (_eList.dissipated()) {
termEffect();
- if (effect->next == nullptr)
+ if (_effect->_next == nullptr)
return false;
- effect = effect->next;
- effSeq++;
+ _effect = _effect->_next;
+ _effSeq++;
//
- initEffect(target->getPoint());
+ initEffect(_target->getPoint());
}
- eList.buildEffects(false);
+ _eList.buildEffects(false);
return true;
}
@@ -719,13 +722,13 @@ bool SpellInstance::buildList() {
bool SpellInstance::updateStates(int32 deltaTime) {
- spellBook[spell].show(caster, *target);
- age++;
- if (age == implementAge || implementAge == continuouslyImplemented)
- spellBook[spell].implement(caster, target);
- if (maxAge > 0 && age > maxAge)
+ spellBook[_spell].show(_caster, *_target);
+ _age++;
+ if (_age == _implementAge || _implementAge == continuouslyImplemented)
+ spellBook[_spell].implement(_caster, _target);
+ if (_maxAge > 0 && _age > _maxAge)
termEffect();
- eList.updateEStates(deltaTime);
+ _eList.updateEStates(deltaTime);
return true;
}
@@ -810,7 +813,7 @@ void Effectron::updateEffect(int32 deltaTime) {
if (_age > 1) {
_age = 0;
_pos++;
- _finish = _parent->target->getPoint();
+ _finish = _parent->_target->getPoint();
_stepNo++;
_flags = staCall();
@@ -832,7 +835,7 @@ void Effectron::updateEffect(int32 deltaTime) {
//-----------------------------------------------------------------------
void Effectron::bump() {
- switch (_parent->dProto->elasticity) {
+ switch (_parent->_dProto->_elasticity) {
case ecFlagBounce:
_velocity = -_velocity;
break;
diff --git a/engines/saga2/speldraw.cpp b/engines/saga2/speldraw.cpp
index 082d7fea219..313f378e7ad 100644
--- a/engines/saga2/speldraw.cpp
+++ b/engines/saga2/speldraw.cpp
@@ -57,15 +57,15 @@ EffectDisplayPrototype::EffectDisplayPrototype(
SpellHeightFunction *newHeight,
SpellBreadthFunction *newBreadth,
SpellInitFunction *newInit) {
- nodeCount = nodes;
- location = newLocation;
- spriteno = newSpriteno;
- status = newStatus;
- height = newHeight;
- breadth = newBreadth;
- init = newInit;
- next = nullptr;
- ID = spellNone;
+ _nodeCount = nodes;
+ _location = newLocation;
+ _spriteno = newSpriteno;
+ _status = newStatus;
+ _height = newHeight;
+ _breadth = newBreadth;
+ _init = newInit;
+ _next = nullptr;
+ _ID = spellNone;
}
/* ===================================================================== *
@@ -73,49 +73,49 @@ EffectDisplayPrototype::EffectDisplayPrototype(
* ===================================================================== */
EffectDisplayPrototypeList::EffectDisplayPrototypeList(int32 c) {
- count = 0;
- maxCount = 0;
- effects = new pEffectDisplayPrototype[c]();
+ _count = 0;
+ _maxCount = 0;
+ _effects = new pEffectDisplayPrototype[c]();
for (int i = 0; i < c; i++)
- effects[i] = nullptr;
- assert(effects);
- if (effects) maxCount = c;
+ _effects[i] = nullptr;
+ assert(_effects);
+ if (_effects) _maxCount = c;
}
EffectDisplayPrototypeList::~EffectDisplayPrototypeList() {
- if (maxCount && effects)
- delete[] effects;
- maxCount = 0;
- effects = nullptr;
+ if (_maxCount && _effects)
+ delete[] _effects;
+ _maxCount = 0;
+ _effects = nullptr;
}
int32 EffectDisplayPrototypeList::add(EffectDisplayPrototype *edp) {
- assert(count < maxCount);
- edp->setID(count);
- effects[count++] = edp;
- return count - 1;
+ assert(_count < _maxCount);
+ edp->setID(_count);
+ _effects[_count++] = edp;
+ return _count - 1;
}
void EffectDisplayPrototypeList::cleanup() {
- if (maxCount && effects)
- for (int i = 0; i < maxCount; i++)
- if (effects[i]) {
- delete effects[i];
- effects[i] = nullptr;
+ if (_maxCount && _effects)
+ for (int i = 0; i < _maxCount; i++)
+ if (_effects[i]) {
+ delete _effects[i];
+ _effects[i] = nullptr;
}
- maxCount = 0;
+ _maxCount = 0;
}
void EffectDisplayPrototypeList::append(EffectDisplayPrototype *nedp, int32 acount) {
- assert(acount < maxCount);
- EffectDisplayPrototype *edp = effects[acount];
- while (edp->next) edp = edp->next;
- edp->next = nedp;
+ assert(acount < _maxCount);
+ EffectDisplayPrototype *edp = _effects[acount];
+ while (edp->_next) edp = edp->_next;
+ edp->_next = nedp;
}
EffectDisplayPrototype *EffectDisplayPrototypeList::operator[](EffectID e) {
- assert(e < maxCount);
- return effects[e];
+ assert(e < _maxCount);
+ return _effects[e];
}
/* ===================================================================== *
@@ -126,33 +126,33 @@ SpellDisplayPrototype::SpellDisplayPrototype(
EffectID e, int32 e1, int32 e2, int32 e3, int32 e4,
effectDirectionInit sc, effectCollisionCont cc, SpellAge sa,
uint32 spID, uint8 sco, uint8) {
- effect = e; // Effect ID
- effParm1 = e1; // effect setting 1
- effParm2 = e2; // effect setting 1
- effParm3 = e3; // effect setting 1
- effParm4 = e4; // effect setting 1
-
- scatter = sc; // direction init mode
- elasticity = cc; // collision flags
-
- maxAge = sa; // auto self-destruct age
- primarySpriteID = spID; // RES_ID( x, y, z, 0 ) to get sprites
- primarySpriteNo = sco; // sprites available
- secondarySpriteID = spID; // RES_ID( x, y, z, 0 ) to get sprites
- secondarySpriteNo = sco; // sprites available
- //effCount=eco; // effectrons to allocate
-
- ID = spellNone;
- implementAge = 0;
+ _effect = e; // Effect ID
+ _effParm1 = e1; // effect setting 1
+ _effParm2 = e2; // effect setting 1
+ _effParm3 = e3; // effect setting 1
+ _effParm4 = e4; // effect setting 1
+
+ _scatter = sc; // direction init mode
+ _elasticity = cc; // collision flags
+
+ _maxAge = sa; // auto self-destruct age
+ _primarySpriteID = spID; // RES_ID( x, y, z, 0 ) to get sprites
+ _primarySpriteNo = sco; // sprites available
+ _secondarySpriteID = spID; // RES_ID( x, y, z, 0 ) to get sprites
+ _secondarySpriteNo = sco; // sprites available
+ //_effCount=eco; // effectrons to allocate
+
+ _ID = spellNone;
+ _implementAge = 0;
}
SpellDisplayPrototype *SpellDisplayPrototypeList::operator[](SpellID s) {
- assert(s >= 0 && s < count);
- return spells[s];
+ assert(s >= 0 && s < _count);
+ return _spells[s];
}
void SpellDisplayPrototype::getColorTranslation(ColorTable map, Effectron *e) {
- int32 i = colorMap[whichColorMap(effect, e)];
+ int32 i = _colorMap[whichColorMap(_effect, e)];
i = MAX<int32>(0, MIN(loadedColorMaps, i));
buildColorTable(map, spellSchemes->_schemes[i]->bank, 11);
}
@@ -167,39 +167,39 @@ void SpellDisplayPrototypeList::init() {
}
void SpellDisplayPrototypeList::cleanup() {
- if (spells) {
- for (int i = 0; i < maxCount; i++)
- if (spells[i]) {
- delete spells[i];
- spells[i] = nullptr;
+ if (_spells) {
+ for (int i = 0; i < _maxCount; i++)
+ if (_spells[i]) {
+ delete _spells[i];
+ _spells[i] = nullptr;
}
- delete[] spells;
- spells = nullptr;
- maxCount = 0;
+ delete[] _spells;
+ _spells = nullptr;
+ _maxCount = 0;
}
}
SpellDisplayPrototypeList::SpellDisplayPrototypeList(uint16 s) {
- count = 0;
- maxCount = 0;
- spells = new pSpellDisplayPrototype[s]();
+ _count = 0;
+ _maxCount = 0;
+ _spells = new pSpellDisplayPrototype[s]();
for (int i = 0; i < s; i++)
- spells[i] = nullptr;
- assert(spells);
- if (spells) maxCount = s;
+ _spells[i] = nullptr;
+ assert(_spells);
+ if (_spells) _maxCount = s;
}
SpellDisplayPrototypeList::~SpellDisplayPrototypeList() {
- if (maxCount && spells)
- delete[] spells;
- spells = nullptr;
+ if (_maxCount && _spells)
+ delete[] _spells;
+ _spells = nullptr;
}
int32 SpellDisplayPrototypeList::add(SpellDisplayPrototype *sdp) {
- assert(count < maxCount);
- sdp->setID((SpellID) count);
- spells[count++] = sdp;
- return count;
+ assert(_count < _maxCount);
+ sdp->setID((SpellID) _count);
+ _spells[_count++] = sdp;
+ return _count;
}
/* ===================================================================== *
@@ -207,12 +207,12 @@ int32 SpellDisplayPrototypeList::add(SpellDisplayPrototype *sdp) {
* ===================================================================== */
SpellDisplayList::SpellDisplayList(uint16 s) {
- count = 0;
- maxCount = 0;
- spells = new pSpellInstance[s]();
+ _count = 0;
+ _maxCount = 0;
+ _spells = new pSpellInstance[s]();
for (int i = 0; i < s; i++)
- spells[i] = nullptr;
- if (spells) maxCount = s;
+ _spells[i] = nullptr;
+ if (_spells) _maxCount = s;
init();
}
@@ -221,45 +221,45 @@ SpellDisplayList::~SpellDisplayList() {
}
void SpellDisplayList::init() {
- count = 0;
+ _count = 0;
}
void SpellDisplayList::cleanup() {
- if (maxCount && spells)
- delete[] spells;
- spells = nullptr;
+ if (_maxCount && _spells)
+ delete[] _spells;
+ _spells = nullptr;
}
void SpellDisplayList::add(SpellInstance *newSpell) {
assert(newSpell);
- if (count < maxCount)
- spells[count++] = newSpell;
+ if (_count < _maxCount)
+ _spells[_count++] = newSpell;
}
void SpellDisplayList::buildList() {
- if (count)
- for (int16 i = 0; i < count; i++) // check all active spells
- if (!spells[i]->buildList()) { // update
+ if (_count)
+ for (int16 i = 0; i < _count; i++) // check all active _spells
+ if (!_spells[i]->buildList()) { // update
tidyKill(i--); // that spell is done
}
}
void SpellDisplayList::updateStates(int32 deltaTime) {
- if (count)
- for (int16 i = 0; i < count; i++)
- spells[i]->updateStates(deltaTime);
+ if (_count)
+ for (int16 i = 0; i < _count; i++)
+ _spells[i]->updateStates(deltaTime);
}
void SpellDisplayList::tidyKill(uint16 spellNo) {
- assert(count);
- if (spells[spellNo]) {
- delete spells[spellNo];
- spells[spellNo] = nullptr;
+ assert(_count);
+ if (_spells[spellNo]) {
+ delete _spells[spellNo];
+ _spells[spellNo] = nullptr;
}
- if (spellNo < count--) {
- for (uint16 i = spellNo; i <= count; i++)
- spells[i] = spells[i + 1];
- spells[count + 1] = nullptr;
+ if (spellNo < _count--) {
+ for (uint16 i = spellNo; i <= _count; i++)
+ _spells[i] = _spells[i + 1];
+ _spells[_count + 1] = nullptr;
}
}
diff --git a/engines/saga2/spellini.cpp b/engines/saga2/spellini.cpp
index af7cb606f15..2fcbd79f3e5 100644
--- a/engines/saga2/spellini.cpp
+++ b/engines/saga2/spellini.cpp
@@ -64,11 +64,11 @@ SPELLINITFUNCTION(invisibleSpellInit) {
// aura that tracks target
SPELLINITFUNCTION(auraSpellInit) {
- if (effectron->_parent->maxAge)
- effectron->_totalSteps = effectron->_parent->maxAge;
+ if (effectron->_parent->_maxAge)
+ effectron->_totalSteps = effectron->_parent->_maxAge;
else
effectron->_totalSteps = 20;
- effectron->_current = effectron->_parent->target->getPoint();
+ effectron->_current = effectron->_parent->_target->getPoint();
effectron->_velocity = TilePoint(0, 0, 0);
effectron->_acceleration = TilePoint(0, 0, 0);
}
@@ -77,11 +77,11 @@ SPELLINITFUNCTION(auraSpellInit) {
// aura that tracks target (in front)
SPELLINITFUNCTION(glowSpellInit) {
- if (effectron->_parent->maxAge)
- effectron->_totalSteps = effectron->_parent->maxAge;
+ if (effectron->_parent->_maxAge)
+ effectron->_totalSteps = effectron->_parent->_maxAge;
else
effectron->_totalSteps = 20;
- effectron->_current = effectron->_parent->target->getPoint() - TilePoint(1, 1, 0);
+ effectron->_current = effectron->_parent->_target->getPoint() - TilePoint(1, 1, 0);
effectron->_finish = effectron->_current;
effectron->_velocity = TilePoint(0, 0, 0);
effectron->_acceleration = TilePoint(0, 0, 0);
@@ -91,13 +91,13 @@ SPELLINITFUNCTION(glowSpellInit) {
// sprites that surround target
SPELLINITFUNCTION(wallSpellInit) {
- if (effectron->_parent->maxAge)
- effectron->_totalSteps = effectron->_parent->maxAge;
+ if (effectron->_parent->_maxAge)
+ effectron->_totalSteps = effectron->_parent->_maxAge;
else
effectron->_totalSteps = 20;
- effectron->_current = effectron->_parent->target->getPoint();
+ effectron->_current = effectron->_parent->_target->getPoint();
effectron->_velocity = WallVectors[effectron->_partno] * wallSpellRadius / 3;
- effectron->_current = effectron->_parent->target->getPoint() + effectron->_velocity;
+ effectron->_current = effectron->_parent->_target->getPoint() + effectron->_velocity;
effectron->_acceleration = TilePoint(0, 0, 0);
}
@@ -106,7 +106,7 @@ SPELLINITFUNCTION(wallSpellInit) {
SPELLINITFUNCTION(projectileSpellInit) {
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
TilePoint tp = (effectron->_finish - effectron->_start);
effectron->_totalSteps = 1 + (tp.magnitude() / (2 * SpellJumpiness));
effectron->_velocity = tp / effectron->_totalSteps;
@@ -119,10 +119,10 @@ SPELLINITFUNCTION(projectileSpellInit) {
SPELLINITFUNCTION(exchangeSpellInit) {
if (effectron->_partno % 2) {
effectron->_finish = effectron->_current;
- effectron->_start = effectron->_parent->target->getPoint();
+ effectron->_start = effectron->_parent->_target->getPoint();
} else {
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
}
TilePoint tp = (effectron->_finish - effectron->_start);
effectron->_totalSteps = 1 + (tp.magnitude() / (SpellJumpiness));
@@ -137,13 +137,13 @@ SPELLINITFUNCTION(exchangeSpellInit) {
SPELLINITFUNCTION(boltSpellInit) {
effectron->_stepNo = 0;
- if (effectron->_parent->maxAge)
- effectron->_totalSteps = effectron->_parent->maxAge;
+ if (effectron->_parent->_maxAge)
+ effectron->_totalSteps = effectron->_parent->_maxAge;
else
effectron->_totalSteps = 1 + (boltSpellLength / (SpellJumpiness * 3));
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, boltSpellLength);
@@ -165,13 +165,13 @@ SPELLINITFUNCTION(boltSpellInit) {
SPELLINITFUNCTION(beamSpellInit) {
effectron->_stepNo = 0;
- if (effectron->_parent->maxAge)
- effectron->_totalSteps = effectron->_parent->maxAge;
+ if (effectron->_parent->_maxAge)
+ effectron->_totalSteps = effectron->_parent->_maxAge;
else
effectron->_totalSteps = 1 + (beamSpellLength / (SpellJumpiness));
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, beamSpellLength);
@@ -195,7 +195,7 @@ SPELLINITFUNCTION(coneSpellInit) {
effectron->_totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 3));
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, coneSpellLength);
@@ -216,7 +216,7 @@ SPELLINITFUNCTION(waveSpellInit) {
effectron->_totalSteps = 1 + (coneSpellLength / (SpellJumpiness * 2));
effectron->_start = effectron->_current;
- effectron->_finish = effectron->_parent->target->getPoint();
+ effectron->_finish = effectron->_parent->_target->getPoint();
TilePoint tVect = effectron->_finish - effectron->_start ;
setMagnitude(tVect, waveSpellLength);
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index ab9489489b6..48adf4a50b9 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -44,25 +44,25 @@ namespace Saga2 {
// ctor
SpellDisplayPrototype::SpellDisplayPrototype(ResourceSpellItem *rsi) {
- effect = rsi->effect; // Effect ID
- effParm1 = 0; // effect setting 1
- effParm2 = 0; // effect setting 1
- effParm3 = 0; // effect setting 1
- effParm4 = 0; // effect setting 1
- scatter = diFlagZero; // direction init mode
- elasticity = (effectCollisionCont) rsi->effectronElasticity; // collision flags
- maxAge = rsi->maxAge; // auto self-destruct age
- implementAge = rsi->implAge; // auto self-destruct age
- primarySpriteID = rsi->baseSprite; // RES_ID(x, y, z, 0) to get sprites
- primarySpriteNo = rsi->spriteCount; // sprites available
- secondarySpriteID = rsi->baseSprite2; // RES_ID(x, y, z, 0) to get sprites
- secondarySpriteNo = rsi->spriteCount2; // sprites available
- //effCount=0; // effectrons to allocate
- colorMap[0] = rsi->cm0;
- colorMap[1] = rsi->cm1;
- colorMap[2] = 0;
- colorMap[3] = 0;
- ID = spellNone;
+ _effect = rsi->effect; // Effect ID
+ _effParm1 = 0; // effect setting 1
+ _effParm2 = 0; // effect setting 1
+ _effParm3 = 0; // effect setting 1
+ _effParm4 = 0; // effect setting 1
+ _scatter = diFlagZero; // direction init mode
+ _elasticity = (effectCollisionCont) rsi->effectronElasticity; // collision flags
+ _maxAge = rsi->maxAge; // auto self-destruct age
+ _implementAge = rsi->implAge; // auto self-destruct age
+ _primarySpriteID = rsi->baseSprite; // RES_ID(x, y, z, 0) to get sprites
+ _primarySpriteNo = rsi->spriteCount; // sprites available
+ _secondarySpriteID = rsi->baseSprite2; // RES_ID(x, y, z, 0) to get sprites
+ _secondarySpriteNo = rsi->spriteCount2; // sprites available
+ //_effCount=0; // effectrons to allocate
+ _colorMap[0] = rsi->cm0;
+ _colorMap[1] = rsi->cm1;
+ _colorMap[2] = 0;
+ _colorMap[3] = 0;
+ _ID = spellNone;
}
/* ===================================================================== *
@@ -224,7 +224,7 @@ void cleanupSpellState() {
}
// ------------------------------------------------------------------
-// cleanup active spells
+// cleanup active _spells
StorageSpellTarget::StorageSpellTarget(SpellTarget &st) {
GameObject *go = nullptr;
@@ -255,17 +255,17 @@ StorageSpellTarget::StorageSpellTarget(SpellTarget &st) {
}
StorageSpellInstance::StorageSpellInstance(SpellInstance &si) {
- implementAge = si.implementAge; // age at which to implement the spell effects
- effect = si.effect->thisID(); // effect prototype of the current effect
- dProto = si.dProto->thisID(); // effect prototype of the current effect
- caster = si.caster->thisID();
- target = StorageSpellTarget(*si.target);
- world = si.world->thisID();
- age = si.age;
- spell = si.spell;
- maxAge = si.maxAge;
- effSeq = si.effSeq; // which effect in a sequence is being played
- eListSize = si.eList._count;
+ implementAge = si._implementAge; // age at which to implement the spell effects
+ effect = si._effect->thisID(); // effect prototype of the current effect
+ dProto = si._dProto->thisID(); // effect prototype of the current effect
+ caster = si._caster->thisID();
+ target = StorageSpellTarget(*si._target);
+ world = si._world->thisID();
+ age = si._age;
+ spell = si._spell;
+ maxAge = si._maxAge;
+ effSeq = si._effSeq; // which effect in a sequence is being played
+ eListSize = si._eList._count;
}
StorageSpellTarget::StorageSpellTarget() {
@@ -339,29 +339,29 @@ SpellTarget::SpellTarget(StorageSpellTarget &sst) {
}
SpellInstance::SpellInstance(StorageSpellInstance &ssi) {
- implementAge = ssi.implementAge; // age at which to implement the spell effects
- dProto = (*g_vm->_sdpList)[ssi.dProto];
- caster = GameObject::objectAddress(ssi.caster);
- target = new SpellTarget(ssi.target);
+ _implementAge = ssi.implementAge; // age at which to implement the spell effects
+ _dProto = (*g_vm->_sdpList)[ssi.dProto];
+ _caster = GameObject::objectAddress(ssi.caster);
+ _target = new SpellTarget(ssi.target);
GameObject *go = GameObject::objectAddress(ssi.world);
assert(isWorld(go));
- world = (GameWorld *) go;
- age = ssi.age;
- spell = ssi.spell;
- maxAge = ssi.maxAge;
- effSeq = 0;
- effect = (*g_vm->_edpList)[ssi.effect];
- while (effSeq < ssi.effSeq) // which effect in a sequence is being played
- effect = effect->next;
+ _world = (GameWorld *) go;
+ _age = ssi.age;
+ _spell = ssi.spell;
+ _maxAge = ssi.maxAge;
+ _effSeq = 0;
+ _effect = (*g_vm->_edpList)[ssi.effect];
+ while (_effSeq < ssi.effSeq) // which effect in a sequence is being played
+ _effect = _effect->_next;
}
size_t SpellDisplayList::saveSize() {
size_t total = 0;
- total += sizeof(count);
- if (count) {
- for (int i = 0; i < count; i++)
- total += spells[i]->saveSize();
+ total += sizeof(_count);
+ if (_count) {
+ for (int i = 0; i < _count; i++)
+ total += _spells[i]->saveSize();
}
return total;
}
@@ -369,16 +369,16 @@ size_t SpellDisplayList::saveSize() {
void SpellDisplayList::write(Common::OutSaveFile *outS) {
outS->write("SPEL", 4);
CHUNK_BEGIN;
- out->writeUint16LE(count);
+ out->writeUint16LE(_count);
- debugC(3, kDebugSaveload, "... count = %d", count);
+ debugC(3, kDebugSaveload, "... count = %d", _count);
- if (count) {
- for (int i = 0; i < count; i++) {
+ if (_count) {
+ for (int i = 0; i < _count; i++) {
debugC(3, kDebugSaveload, "Saving Spell Instance %d", i);
- StorageSpellInstance ssi = StorageSpellInstance(*spells[i]);
+ StorageSpellInstance ssi = StorageSpellInstance(*_spells[i]);
ssi.write(out);
- spells[i]->writeEffect(out);
+ _spells[i]->writeEffect(out);
}
}
CHUNK_END;
@@ -391,7 +391,7 @@ void SpellDisplayList::read(Common::InSaveFile *in) {
debugC(3, kDebugSaveload, "... count = %d", tCount);
- assert(tCount < maxCount);
+ assert(tCount < _maxCount);
if (tCount) {
for (int i = 0; i < tCount; i++) {
debugC(3, kDebugSaveload, "Loading Spell Instance %d", i);
@@ -403,47 +403,47 @@ void SpellDisplayList::read(Common::InSaveFile *in) {
si->readEffect(in, ssi.eListSize);
}
}
- assert(tCount == count);
+ assert(tCount == _count);
}
void SpellDisplayList::wipe() {
- for (int i = 0; i < maxCount; i++)
- if (spells[i]) {
- delete spells[i];
- spells[i] = nullptr;
- count--;
+ for (int i = 0; i < _maxCount; i++)
+ if (_spells[i]) {
+ delete _spells[i];
+ _spells[i] = nullptr;
+ _count--;
}
- assert(count == 0);
+ assert(_count == 0);
}
size_t SpellInstance::saveSize() {
size_t total = 0;
total += sizeof(StorageSpellInstance);
- if (eList._count)
- for (int32 i = 0; i < eList._count; i++) {
+ if (_eList._count)
+ for (int32 i = 0; i < _eList._count; i++) {
total += sizeof(StorageEffectron);
}
return total;
}
void SpellInstance::writeEffect(Common::MemoryWriteStreamDynamic *out) {
- if (eList._count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
- for (int32 i = 0; i < eList._count; i++) {
- StorageEffectron se = StorageEffectron(*eList._displayList[i]._efx);
+ if (_eList._count > 0 && !(_maxAge > 0 && (_age + 1) > _maxAge))
+ for (int32 i = 0; i < _eList._count; i++) {
+ StorageEffectron se = StorageEffectron(*_eList._displayList[i]._efx);
se.write(out);
}
}
void SpellInstance::readEffect(Common::InSaveFile *in, uint16 eListSize) {
- assert(eListSize == effect->nodeCount);
- eList._count = effect->nodeCount; //sdp->effCount;
- if (eList._count)
- for (int32 i = 0; i < eList._count; i++) {
+ assert(eListSize == _effect->_nodeCount);
+ _eList._count = _effect->_nodeCount; //sdp->effCount;
+ if (_eList._count)
+ for (int32 i = 0; i < _eList._count; i++) {
StorageEffectron se;
se.read(in);
Effectron *e = new Effectron(se, this);
- eList._displayList[i]._efx = e;
+ _eList._displayList[i]._efx = e;
}
}
diff --git a/engines/saga2/spellloc.cpp b/engines/saga2/spellloc.cpp
index b783f8fdb3f..ea88e85b74e 100644
--- a/engines/saga2/spellloc.cpp
+++ b/engines/saga2/spellloc.cpp
@@ -65,7 +65,7 @@ SPELLLOCATIONFUNCTION(glowSpellPos) {
// sprites that surround target
SPELLLOCATIONFUNCTION(wallSpellPos) {
- return effectron->_parent->target->getPoint() + effectron->_velocity;
+ return effectron->_parent->_target->getPoint() + effectron->_velocity;
}
// ------------------------------------------------------------------
diff --git a/engines/saga2/spellspr.cpp b/engines/saga2/spellspr.cpp
index 15677800bfd..ef23bbf6246 100644
--- a/engines/saga2/spellspr.cpp
+++ b/engines/saga2/spellspr.cpp
@@ -39,25 +39,25 @@ namespace Saga2 {
* ===================================================================== */
// random sprite from primary range
-#define PRIMARY (effectron->_parent->dProto->primarySpriteNo?\
- (effectron->_parent->dProto->primarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->dProto->primarySpriteNo - 1)):\
- effectron->_parent->dProto->primarySpriteID)
+#define PRIMARY (effectron->_parent->_dProto->_primarySpriteNo?\
+ (effectron->_parent->_dProto->_primarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->_dProto->_primarySpriteNo - 1)):\
+ effectron->_parent->_dProto->_primarySpriteID)
// random sprite from secondary range
-#define SECONDARY (effectron->_parent->dProto->secondarySpriteNo?\
- (effectron->_parent->dProto->secondarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->dProto->secondarySpriteNo - 1)):\
- effectron->_parent->dProto->secondarySpriteID)
+#define SECONDARY (effectron->_parent->_dProto->_secondarySpriteNo?\
+ (effectron->_parent->_dProto->_secondarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->_dProto->_secondarySpriteNo - 1)):\
+ effectron->_parent->_dProto->_secondarySpriteID)
// ordered sprite from primary range
-#define SEQUENTIAL (effectron->_parent->dProto->primarySpriteNo?\
- (effectron->_parent->dProto->primarySpriteID + effectron->_stepNo%effectron->_parent->dProto->primarySpriteNo):\
- effectron->_parent->dProto->primarySpriteID)
+#define SEQUENTIAL (effectron->_parent->_dProto->_primarySpriteNo?\
+ (effectron->_parent->_dProto->_primarySpriteID + effectron->_stepNo%effectron->_parent->_dProto->_primarySpriteNo):\
+ effectron->_parent->_dProto->_primarySpriteID)
// ordered sprite from secondary range
-#define SECUENTIAL (effectron->_parent->dProto->secondarySpriteNo?\
- (effectron->_parent->dProto->secondarySpriteID + effectron->_stepNo%effectron->_parent->dProto->secondarySpriteNo):\
- effectron->_parent->dProto->secondarySpriteID)
+#define SECUENTIAL (effectron->_parent->_dProto->_secondarySpriteNo?\
+ (effectron->_parent->_dProto->_secondarySpriteID + effectron->_stepNo%effectron->_parent->_dProto->_secondarySpriteNo):\
+ effectron->_parent->_dProto->_secondarySpriteID)
// ordered sprite from primary range for exchange
-#define SEMIQUENTIAL (effectron->_parent->dProto->primarySpriteNo?\
- (effectron->_parent->dProto->primarySpriteID + (effectron->_partno/2)%effectron->_parent->dProto->primarySpriteNo):\
- effectron->_parent->dProto->primarySpriteID)
+#define SEMIQUENTIAL (effectron->_parent->_dProto->_primarySpriteNo?\
+ (effectron->_parent->_dProto->_primarySpriteID + (effectron->_partno/2)%effectron->_parent->_dProto->_primarySpriteNo):\
+ effectron->_parent->_dProto->_primarySpriteID)
/* ===================================================================== *
Color mapping selection
@@ -80,7 +80,7 @@ int16 whichColorMap(EffectID eid, const Effectron *const effectron) {
case eAreaSquare:
case eAreaBall:
case eAreaStorm:
- rval = (effectron->_parent->effSeq == 0) ? 0 : 1;
+ rval = (effectron->_parent->_effSeq == 0) ? 0 : 1;
break;
case eAreaBolt:
rval = ((effectron->_partno % 3) == 1) ? 0 : 1;
@@ -106,7 +106,7 @@ SPELLSPRITATIONFUNCTION(invisibleSprites) {
}
SPELLSPRITATIONFUNCTION(auraSprites) {
- if (effectron->_parent->effSeq)
+ if (effectron->_parent->_effSeq)
return SECUENTIAL;
return SEQUENTIAL;
}
@@ -140,13 +140,13 @@ SPELLSPRITATIONFUNCTION(coneSprites) {
}
SPELLSPRITATIONFUNCTION(ballSprites) {
- if (effectron->_parent->effSeq)
+ if (effectron->_parent->_effSeq)
return SECONDARY;
return PRIMARY;
}
SPELLSPRITATIONFUNCTION(squareSprites) {
- if (effectron->_parent->effSeq)
+ if (effectron->_parent->_effSeq)
return SECONDARY;
return PRIMARY;
}
@@ -158,7 +158,7 @@ SPELLSPRITATIONFUNCTION(waveSprites) {
}
SPELLSPRITATIONFUNCTION(stormSprites) {
- if (effectron->_parent->effSeq)
+ if (effectron->_parent->_effSeq)
return SECONDARY;
return PRIMARY;
}
diff --git a/engines/saga2/spelshow.h b/engines/saga2/spelshow.h
index 52e11d2e614..6b89f594d34 100644
--- a/engines/saga2/spelshow.h
+++ b/engines/saga2/spelshow.h
@@ -128,27 +128,27 @@ class EffectDisplayPrototype {
static SPELLINITFUNCTION(nullInit) {
}
- EffectID ID;
+ EffectID _ID;
public:
- int16 nodeCount;
- EffectDisplayPrototype *next;
+ int16 _nodeCount;
+ EffectDisplayPrototype *_next;
- SpellLocationFunction *location;
- SpellSpritationFunction *spriteno;
- SpellStatusFunction *status;
- SpellHeightFunction *height;
- SpellBreadthFunction *breadth;
- SpellInitFunction *init;
+ SpellLocationFunction *_location;
+ SpellSpritationFunction *_spriteno;
+ SpellStatusFunction *_status;
+ SpellHeightFunction *_height;
+ SpellBreadthFunction *_breadth;
+ SpellInitFunction *_init;
EffectDisplayPrototype() {
- nodeCount = 0;
- next = NULL;
- location = &nullLocation;
- spriteno = &nullSpritation;
- status = &nullStatus;
- height = &nullHeight;
- breadth = &nullBreadth;
- init = &nullInit;
+ _nodeCount = 0;
+ _next = NULL;
+ _location = &nullLocation;
+ _spriteno = &nullSpritation;
+ _status = &nullStatus;
+ _height = &nullHeight;
+ _breadth = &nullBreadth;
+ _init = &nullInit;
}
EffectDisplayPrototype(
@@ -160,14 +160,14 @@ public:
SpellBreadthFunction *newBreadth,
SpellInitFunction *newInit);
~EffectDisplayPrototype() {
- if (next) delete next;
- next = NULL;
+ if (_next) delete _next;
+ _next = NULL;
}
void setID(EffectID i) {
- ID = i;
+ _ID = i;
}
EffectID thisID() {
- return ID;
+ return _ID;
}
};
@@ -181,9 +181,9 @@ typedef EffectDisplayPrototype *pEffectDisplayPrototype;
class EffectDisplayPrototypeList {
- pEffectDisplayPrototype *effects;
- uint16 count;
- uint16 maxCount;
+ pEffectDisplayPrototype *_effects;
+ uint16 _count;
+ uint16 _maxCount;
public:
EffectDisplayPrototypeList(int32 c);
@@ -227,26 +227,26 @@ enum effectDirectionInit {
// Combines a SpellEffectPrototype with the appropriate sprites
class SpellDisplayPrototype {
- SpellID ID;
+ SpellID _ID;
public:
- EffectID effect; // Effect ID
- int32 effParm1; // effect setting 1
- int32 effParm2; // effect setting 1
- int32 effParm3; // effect setting 1
- int32 effParm4; // effect setting 1
-
- effectDirectionInit scatter; // direction init mode
- effectCollisionCont elasticity; // collision flags
-
- SpellAge maxAge; // auto self-destruct age
- SpellAge implementAge; // auto self-destruct age
- uint32 primarySpriteID; // RES_ID(x, y, z, 0) to get sprites
- uint8 primarySpriteNo; // sprites available
- uint32 secondarySpriteID; // RES_ID(x, y, z, 0) to get sprites
- uint8 secondarySpriteNo; // sprites available
- //uint8 effCount; // effectrons to allocate
-
- uint8 colorMap[4]; // indirect color map
+ EffectID _effect; // Effect ID
+ int32 _effParm1; // effect setting 1
+ int32 _effParm2; // effect setting 1
+ int32 _effParm3; // effect setting 1
+ int32 _effParm4; // effect setting 1
+
+ effectDirectionInit _scatter; // direction init mode
+ effectCollisionCont _elasticity; // collision flags
+
+ SpellAge _maxAge; // auto self-destruct age
+ SpellAge _implementAge; // auto self-destruct age
+ uint32 _primarySpriteID; // RES_ID(x, y, z, 0) to get sprites
+ uint8 _primarySpriteNo; // sprites available
+ uint32 _secondarySpriteID; // RES_ID(x, y, z, 0) to get sprites
+ uint8 _secondarySpriteNo; // sprites available
+ //uint8 _effCount; // effectrons to allocate
+
+ uint8 _colorMap[4]; // indirect color map
// full init
SpellDisplayPrototype(
EffectID, int32, int32, int32, int32, effectDirectionInit,
@@ -256,10 +256,10 @@ public:
void getColorTranslation(ColorTable mainColors, Effectron *); // colors for effectrons
void setID(SpellID i) {
- ID = i;
+ _ID = i;
}
SpellID thisID() {
- return ID;
+ return _ID;
}
};
@@ -270,9 +270,9 @@ public:
typedef SpellDisplayPrototype *pSpellDisplayPrototype;
class SpellDisplayPrototypeList {
- pSpellDisplayPrototype *spells;
- uint16 count;
- uint16 maxCount;
+ pSpellDisplayPrototype *_spells;
+ uint16 _count;
+ uint16 _maxCount;
public:
SpellDisplayPrototypeList(uint16 s);
@@ -292,18 +292,18 @@ public:
class SpellInstance {
friend struct StorageSpellInstance;
- SpellAge implementAge; // age at which to implement the spell effects
+ SpellAge _implementAge; // age at which to implement the spell effects
public:
- EffectDisplayPrototype *effect; // effect prototype of the current effect
- SpellDisplayPrototype *dProto; // effect prototype of the current effect
- SpellCaster *caster;
- SpellTarget *target;
- GameWorld *world;
- SpellAge age;
- EffectronList eList;
- SpellID spell;
- SpellAge maxAge;
- int16 effSeq; // which effect in a sequence is being played
+ EffectDisplayPrototype *_effect; // effect prototype of the current effect
+ SpellDisplayPrototype *_dProto; // effect prototype of the current effect
+ SpellCaster *_caster;
+ SpellTarget *_target;
+ GameWorld *_world;
+ SpellAge _age;
+ EffectronList _eList;
+ SpellID _spell;
+ SpellAge _maxAge;
+ int16 _effSeq; // which effect in a sequence is being played
SpellInstance(SpellCaster *newCaster, SpellTarget *newTarget, SpellID);
SpellInstance(SpellCaster *newCaster, GameObject &newTarget, SpellID);
@@ -331,10 +331,10 @@ public:
typedef SpellInstance *pSpellInstance;
class SpellDisplayList {
- uint16 count;
- uint16 maxCount;
+ uint16 _count;
+ uint16 _maxCount;
public :
- pSpellInstance *spells;
+ pSpellInstance *_spells;
void init();
void cleanup();
@@ -363,42 +363,42 @@ public :
// Some functions that require the above definitions to work
inline GameWorld *Effectron::world() const {
- return _parent->world;
+ return _parent->_world;
}
inline int16 Effectron::getMapNum() const {
- return _parent->world->_mapNum;
+ return _parent->_world->_mapNum;
}
inline EffectID Effectron::spellID() {
- return _parent->spell;
+ return _parent->_spell;
}
inline SpellDisplayPrototype *Effectron::spell() {
- return (*g_vm->_sdpList)[(SpellID) spellID()];
+ return (*g_vm->_sdpList)[(SpellID)spellID()];
}
inline EffectID Effectron::effectID() {
- return spell()->effect;
+ return spell()->_effect;
}
inline EffectDisplayPrototype *Effectron::effect() {
- return _parent->effect;
+ return _parent->_effect;
}
inline EffectronFlags Effectron::staCall() {
- return _parent->effect->status(this);
+ return _parent->_effect->_status(this);
}
inline TilePoint Effectron::posCall() {
- return _parent->effect->location(this);
+ return _parent->_effect->_location(this);
}
inline SpellSpritationSeed Effectron::sprCall() {
- return _parent->effect->spriteno(this);
+ return _parent->_effect->_spriteno(this);
}
inline spellHeight Effectron::hgtCall() {
- return _parent->effect->height(this);
+ return _parent->_effect->_height(this);
}
inline spellBreadth Effectron::brdCall() {
- return _parent->effect->breadth(this);
+ return _parent->_effect->_breadth(this);
}
inline void Effectron::initCall(int16 eno) {
_partno = eno;
- _parent->effect->init(this);
+ _parent->_effect->_init(this);
}
/* ===================================================================== *
Commit: 7bcf7224e21d670916fd9b66a24a08b06abdb060
https://github.com/scummvm/scummvm/commit/7bcf7224e21d670916fd9b66a24a08b06abdb060
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in sprite.h
Changed paths:
engines/saga2/actor.cpp
engines/saga2/dispnode.cpp
engines/saga2/speech.cpp
engines/saga2/sprite.cpp
engines/saga2/sprite.h
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 3bc62ce8bc2..a03d8e3d29a 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -2022,9 +2022,9 @@ void Actor::getColorTranslation(ColorTable map) {
// If actor has color table loaded, then calculate the
// translation table.
if (_appearance
- && _appearance->schemeList) {
+ && _appearance->_schemeList) {
buildColorTable(map,
- _appearance->schemeList->_schemes[_colorScheme]->bank,
+ _appearance->_schemeList->_schemes[_colorScheme]->bank,
11);
} else memcpy(map, identityColors, 256);
}
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index 7442f530853..c3a99d25b71 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -680,7 +680,7 @@ void DisplayNode::drawObject() {
// REM: Locking bug...
// ss = (SpriteSet *)RLockHandle( aa->sprites );
- sprPtr = aa->spriteBanks[a->_poseInfo.actorFrameBank];
+ sprPtr = aa->_spriteBanks[a->_poseInfo.actorFrameBank];
ss = sprPtr;
if (ss == nullptr)
return;
@@ -847,7 +847,7 @@ ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
if (aa == nullptr) continue;
- sprPtr = aa->spriteBanks[a->_poseInfo.actorFrameBank];
+ sprPtr = aa->_spriteBanks[a->_poseInfo.actorFrameBank];
ss = sprPtr;
if (ss == nullptr)
continue;
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index 3d16ef78e0c..a50386a8cdb 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -1006,9 +1006,9 @@ Speech *SpeechTaskList::newTask(ObjectID id, uint16 flags) {
// default color.
if (a == getCenterActor()) sp->_penColor = 3 + 9 /* 1 */;
else if (a->_appearance
- && a->_appearance->schemeList) {
+ && a->_appearance->_schemeList) {
sp->_penColor =
- a->_appearance->schemeList->_schemes[a->_colorScheme]->speechColor + 9;
+ a->_appearance->_schemeList->_schemes[a->_colorScheme]->speechColor + 9;
} else sp->_penColor = 4 + 9;
} else {
sp->_penColor = 4 + 9;
diff --git a/engines/saga2/sprite.cpp b/engines/saga2/sprite.cpp
index 2e4a1b89da0..a421f27c967 100644
--- a/engines/saga2/sprite.cpp
+++ b/engines/saga2/sprite.cpp
@@ -219,7 +219,7 @@ void DrawCompositeMaskedSprite(
// Unpack the sprite into the temp map
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
// Blit the temp map onto the composite map
@@ -329,7 +329,7 @@ void DrawSprite(
sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
// Blit to the port
port.setMode(drawModeMatte);
@@ -359,7 +359,7 @@ void DrawColorMappedSprite(
sprReMap._data = (uint8 *)getQuickMem(sprReMap.bytes());
// Unpack the sprite into the temp map
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
memset(sprReMap._data, 0, sprReMap.bytes());
@@ -397,7 +397,7 @@ void ExpandColorMappedSprite(
sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
// remap the sprite to the color table given
compositePixels(
@@ -426,7 +426,7 @@ uint8 GetSpritePixel(
sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
// Map the coords to the bitmap and return the pixel
if (flipped) {
@@ -481,7 +481,7 @@ uint16 visiblePixelsInSprite(
sprMap._size = sp->size;
sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
- unpackSprite(&sprMap, sp->_data, sp->_dataSize);
+ unpackSprite(&sprMap, sp->data, sp->dataSize);
org.x = drawPos.x - xMin;
org.y = drawPos.y - yMin;
@@ -560,12 +560,12 @@ void ActorAppearance::loadSpriteBanks(int16 banksNeeded) {
g_vm->_appearanceLRU.push_back(this);
// Load in additional sprite banks if requested...
- for (bank = 0; bank < (long)ARRAYSIZE(spriteBanks); bank++) {
+ for (bank = 0; bank < (long)ARRAYSIZE(_spriteBanks); bank++) {
// Load the sprite handle...
- if (spriteBanks[bank] == nullptr && (banksNeeded & (1 << bank))) {
- Common::SeekableReadStream *stream = loadResourceToStream(spriteRes, id + MKTAG(0, 0, 0, bank), "sprite bank");
+ if (_spriteBanks[bank] == nullptr && (banksNeeded & (1 << bank))) {
+ Common::SeekableReadStream *stream = loadResourceToStream(spriteRes, _id + MKTAG(0, 0, 0, bank), "sprite bank");
if (stream) {
- spriteBanks[bank] = new SpriteSet(stream);
+ _spriteBanks[bank] = new SpriteSet(stream);
delete stream;
}
}
@@ -652,10 +652,10 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
// Search the table for either a matching appearance,
// or for an empty one.
for (Common::List<ActorAppearance *>::iterator it = g_vm->_appearanceLRU.begin(); it != g_vm->_appearanceLRU.end(); ++it) {
- if ((*it)->id == id // If has same ID
- && (*it)->poseList != nullptr) { // and frames not dumped
+ if ((*it)->_id == id // If has same ID
+ && (*it)->_poseList != nullptr) { // and frames not dumped
// then use this one!
- (*it)->useCount++;
+ (*it)->_useCount++;
(*it)->loadSpriteBanks(banksNeeded);
return *it;
}
@@ -666,7 +666,7 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
ActorAppearance *aa = nullptr;
// Search from LRU end of list.
for (Common::List<ActorAppearance *>::iterator it = g_vm->_appearanceLRU.begin(); it != g_vm->_appearanceLRU.end(); ++it) {
- if ((*it)->useCount == 0) { // If not in use
+ if ((*it)->_useCount == 0) { // If not in use
aa = *it; // then use this one!
break;
}
@@ -678,35 +678,35 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
}
// Dump the sprites being stored
- for (bank = 0; bank < (long)ARRAYSIZE(aa->spriteBanks); bank++) {
- if (aa->spriteBanks[bank])
- delete aa->spriteBanks[bank];
- aa->spriteBanks[bank] = nullptr;
+ for (bank = 0; bank < (long)ARRAYSIZE(aa->_spriteBanks); bank++) {
+ if (aa->_spriteBanks[bank])
+ delete aa->_spriteBanks[bank];
+ aa->_spriteBanks[bank] = nullptr;
}
- if (aa->poseList) {
- for (uint i = 0; i < aa->poseList->numPoses; i++)
- delete aa->poseList->poses[i];
+ if (aa->_poseList) {
+ for (uint i = 0; i < aa->_poseList->numPoses; i++)
+ delete aa->_poseList->poses[i];
- free(aa->poseList->poses);
+ free(aa->_poseList->poses);
- for (uint i = 0; i < aa->poseList->numAnimations; i++)
- delete aa->poseList->animations[i];
+ for (uint i = 0; i < aa->_poseList->numAnimations; i++)
+ delete aa->_poseList->animations[i];
- free(aa->poseList->animations);
+ free(aa->_poseList->animations);
- delete aa->poseList;
+ delete aa->_poseList;
}
- aa->poseList = nullptr;
+ aa->_poseList = nullptr;
- if (aa->schemeList) {
- delete aa->schemeList;
+ if (aa->_schemeList) {
+ delete aa->_schemeList;
}
- aa->schemeList = nullptr;
+ aa->_schemeList = nullptr;
// Set ID and use count
- aa->id = id;
- aa->useCount = 1;
+ aa->_id = id;
+ aa->_useCount = 1;
// Load in new frame lists and sprite banks
aa->loadSpriteBanks(banksNeeded);
@@ -717,7 +717,7 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
warning("LoadActorAppearance: Could not load pose list");
} else {
ActorAnimSet *as = new ActorAnimSet;
- aa->poseList = as;
+ aa->_poseList = as;
as->numAnimations = poseStream->readUint32LE();
as->poseOffset = poseStream->readUint32LE();
@@ -756,7 +756,7 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
schemeListSize = schemeRes->size(id) / colorSchemeSize;
stream = loadResourceToStream(schemeRes, id, "scheme list");
- aa->schemeList = new ColorSchemeList(schemeListSize, stream);
+ aa->_schemeList = new ColorSchemeList(schemeListSize, stream);
delete stream;
}
@@ -765,7 +765,7 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
}
void ReleaseActorAppearance(ActorAppearance *aa) {
- aa->useCount--;
+ aa->_useCount--;
}
/* ===================================================================== *
@@ -776,34 +776,34 @@ Sprite::Sprite(Common::SeekableReadStream *stream) {
size.load(stream);
offset.load(stream);
- _dataSize = size.x * size.y;
- _data = (byte *)malloc(_dataSize);
- stream->read(_data, _dataSize);
+ dataSize = size.x * size.y;
+ data = (byte *)malloc(dataSize);
+ stream->read(data, dataSize);
}
Sprite::~Sprite() {
- free(_data);
+ free(data);
}
SpriteSet::SpriteSet(Common::SeekableReadStream *stream) {
count = stream->readUint32LE();
- _sprites = (Sprite **)malloc(count * sizeof(Sprite *));
+ sprites = (Sprite **)malloc(count * sizeof(Sprite *));
for (uint i = 0; i < count; ++i) {
stream->seek(4 + i * 4);
uint32 offset = stream->readUint32LE();
stream->seek(offset);
- _sprites[i] = new Sprite(stream);
+ sprites[i] = new Sprite(stream);
}
}
SpriteSet::~SpriteSet() {
for (uint i = 0; i < count; ++i) {
- if (_sprites[i])
- delete _sprites[i];
+ if (sprites[i])
+ delete sprites[i];
}
- free(_sprites);
+ free(sprites);
}
void initSprites() {
@@ -862,7 +862,7 @@ void initSprites() {
for (i = 0; i < ARRAYSIZE(appearanceTable); i++) {
ActorAppearance *aa = &appearanceTable[i];
- aa->useCount = 0;
+ aa->_useCount = 0;
g_vm->_appearanceLRU.push_front(aa);
}
}
diff --git a/engines/saga2/sprite.h b/engines/saga2/sprite.h
index ec931e7ef01..dadbe09d0d5 100644
--- a/engines/saga2/sprite.h
+++ b/engines/saga2/sprite.h
@@ -42,8 +42,8 @@ class gPixelMap;
struct Sprite {
Extent16 size; // size of sprite
Point16 offset; // sprite origin point
- byte *_data;
- uint32 _dataSize;
+ byte *data;
+ uint32 dataSize;
Sprite(Common::SeekableReadStream *stream);
~Sprite();
@@ -55,7 +55,7 @@ struct Sprite {
struct SpriteSet {
uint32 count; // number of images in the range
- Sprite **_sprites;
+ Sprite **sprites;
// (variable-length array)
// sprite structures follow table
@@ -64,7 +64,7 @@ struct SpriteSet {
// Member function to return a sprite from the set
Sprite *sprite(int16 index) {
- return _sprites[index];
+ return sprites[index];
}
// Sprite &operator[]( int32 index )
@@ -270,19 +270,19 @@ enum spriteBankBits {
class ActorAppearance {
public:
- int16 useCount; // how many actors using this
- uint32 id;
+ int16 _useCount; // how many actors using this
+ uint32 _id;
- ActorAnimSet *poseList; // list of action sequences
- ColorSchemeList *schemeList; // color remapping info
+ ActorAnimSet *_poseList; // list of action sequences
+ ColorSchemeList *_schemeList; // color remapping info
- SpriteSet *spriteBanks[sprBankCount];
+ SpriteSet *_spriteBanks[sprBankCount];
void loadSpriteBanks(int16 banksNeeded);
// Determine if this bank is loaded
bool isBankLoaded(int16 bank) {
- return spriteBanks[bank] != nullptr;
+ return _spriteBanks[bank] != nullptr;
}
// A request to load a bank.
@@ -293,22 +293,22 @@ public:
}
ActorAnimation *animation(int num) {
- if (poseList == nullptr)
+ if (_poseList == nullptr)
return nullptr;
- if (num >= (int)poseList->numAnimations) {
- warning("ActorPose:animation(), animation number is too high, %d >= %d", num, poseList->numAnimations);
+ if (num >= (int)_poseList->numAnimations) {
+ warning("ActorPose:animation(), animation number is too high, %d >= %d", num, _poseList->numAnimations);
return nullptr;
}
- if (poseList)
- return poseList->animations[num];
+ if (_poseList)
+ return _poseList->animations[num];
return nullptr;
}
ActorPose *pose(ActorAnimation *anim, int dir, int num) {
- if (poseList == nullptr)
+ if (_poseList == nullptr)
return nullptr;
if (num < 0 || num >= anim->count[dir])
@@ -316,12 +316,12 @@ public:
num += anim->start[dir];
- if (num >= (int)poseList->numPoses) {
- warning("ActorPose::pose(), pose number is too high, %d >= %d", num, poseList->numPoses);
+ if (num >= (int)_poseList->numPoses) {
+ warning("ActorPose::pose(), pose number is too high, %d >= %d", num, _poseList->numPoses);
return nullptr;
}
- return poseList->poses[num];
+ return _poseList->poses[num];
}
};
Commit: 90c4c7e547bea4d3b445fce03459e00c0e0f73e7
https://github.com/scummvm/scummvm/commit/90c4c7e547bea4d3b445fce03459e00c0e0f73e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in target.h
Changed paths:
engines/saga2/target.cpp
engines/saga2/target.h
diff --git a/engines/saga2/target.cpp b/engines/saga2/target.cpp
index 6d29457bb35..8a6be6ccd09 100644
--- a/engines/saga2/target.cpp
+++ b/engines/saga2/target.cpp
@@ -152,7 +152,7 @@ LocationTarget::LocationTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... LocationTarget");
// Restore the targe location
- loc.load(stream);
+ _loc.load(stream);
}
//----------------------------------------------------------------------
@@ -160,12 +160,12 @@ LocationTarget::LocationTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 LocationTarget::archiveSize() const {
- return sizeof(loc);
+ return sizeof(_loc);
}
void LocationTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the target location
- loc.write(out);
+ _loc.write(out);
}
//----------------------------------------------------------------------
@@ -201,7 +201,7 @@ bool LocationTarget::operator == (const Target &t) const {
}
TilePoint LocationTarget::where(GameWorld *, const TilePoint &) const {
- return loc;
+ return _loc;
}
int16 LocationTarget::where(
@@ -210,8 +210,8 @@ int16 LocationTarget::where(
TargetLocationArray &tla) const {
// Place the target location in the first element of the
// array
- tla.locArray[0] = loc;
- tla.distArray[0] = (tp - loc).quickHDistance();
+ tla.locArray[0] = _loc;
+ tla.distArray[0] = (tp - _loc).quickHDistance();
tla.locs = 1;
return 1;
}
@@ -336,7 +336,7 @@ SpecificTileTarget::SpecificTileTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificTileTarget");
// Restore the tile ID
- tile = stream->readUint16LE();
+ _tile = stream->readUint16LE();
}
//----------------------------------------------------------------------
@@ -344,12 +344,12 @@ SpecificTileTarget::SpecificTileTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 SpecificTileTarget::archiveSize() const {
- return sizeof(tile);
+ return sizeof(_tile);
}
void SpecificTileTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the tile ID
- out->writeUint16LE(tile);
+ out->writeUint16LE(_tile);
}
//----------------------------------------------------------------------
@@ -381,11 +381,11 @@ bool SpecificTileTarget::operator == (const Target &t) const {
const SpecificTileTarget *targetPtr = (const SpecificTileTarget *)&t;
- return tile == targetPtr->tile;
+ return _tile == targetPtr->_tile;
}
bool SpecificTileTarget::isTarget(StandingTileInfo &sti) const {
- return sti.surfaceRef.tile == tile;
+ return sti.surfaceRef.tile == _tile;
}
/* ===================================================================== *
@@ -396,7 +396,7 @@ TilePropertyTarget::TilePropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... TilePropertyTarget");
// Restore the TilePropertyID
- tileProp = stream->readSint16LE();
+ _tileProp = stream->readSint16LE();
}
//----------------------------------------------------------------------
@@ -404,11 +404,11 @@ TilePropertyTarget::TilePropertyTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 TilePropertyTarget::archiveSize() const {
- return sizeof(tileProp);
+ return sizeof(_tileProp);
}
void TilePropertyTarget::write(Common::MemoryWriteStreamDynamic *out) const {
- out->writeSint16LE(tileProp);
+ out->writeSint16LE(_tileProp);
}
//----------------------------------------------------------------------
@@ -440,11 +440,11 @@ bool TilePropertyTarget::operator == (const Target &t) const {
const TilePropertyTarget *targetPtr = (const TilePropertyTarget *)&t;
- return tileProp == targetPtr->tileProp;
+ return _tileProp == targetPtr->_tileProp;
}
bool TilePropertyTarget::isTarget(StandingTileInfo &sti) const {
- return sti.surfaceTile->hasProperty(*g_vm->_properties->getTileProp(tileProp));
+ return sti.surfaceTile->hasProperty(*g_vm->_properties->getTileProp(_tileProp));
}
/* ===================================================================== *
@@ -564,8 +564,8 @@ SpecificMetaTileTarget::SpecificMetaTileTarget(Common::SeekableReadStream *strea
debugC(5, kDebugSaveload, "...... SpecificMetaTileTarget");
// Restore the MetaTileID
- meta.map = stream->readSint16LE();
- meta.index = stream->readSint16LE();
+ _meta.map = stream->readSint16LE();
+ _meta.index = stream->readSint16LE();
}
//----------------------------------------------------------------------
@@ -578,8 +578,8 @@ inline int32 SpecificMetaTileTarget::archiveSize() const {
void SpecificMetaTileTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the MetaTileID
- out->writeSint16LE(meta.map);
- out->writeSint16LE(meta.index);
+ out->writeSint16LE(_meta.map);
+ out->writeSint16LE(_meta.index);
}
//----------------------------------------------------------------------
@@ -611,14 +611,14 @@ bool SpecificMetaTileTarget::operator == (const Target &t) const {
const SpecificMetaTileTarget *targetPtr = (const SpecificMetaTileTarget *)&t;
- return meta == targetPtr->meta;
+ return _meta == targetPtr->_meta;
}
bool SpecificMetaTileTarget::isTarget(
MetaTile *mt,
int16 mapNum,
const TilePoint &) const {
- return mt->thisID(mapNum) == meta;
+ return mt->thisID(mapNum) == _meta;
}
/* ===================================================================== *
@@ -629,7 +629,7 @@ MetaTilePropertyTarget::MetaTilePropertyTarget(Common::SeekableReadStream *strea
debugC(5, kDebugSaveload, "...... MetaTilePropertyTarget");
// Restore the MetaTilePropertyID
- metaProp = stream->readSint16LE();
+ _metaProp = stream->readSint16LE();
}
//----------------------------------------------------------------------
@@ -637,12 +637,12 @@ MetaTilePropertyTarget::MetaTilePropertyTarget(Common::SeekableReadStream *strea
// a buffer
inline int32 MetaTilePropertyTarget::archiveSize() const {
- return sizeof(metaProp);
+ return sizeof(_metaProp);
}
void MetaTilePropertyTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the MetaTilePropertyID
- out->writeSint16LE(metaProp);
+ out->writeSint16LE(_metaProp);
}
//----------------------------------------------------------------------
@@ -674,14 +674,14 @@ bool MetaTilePropertyTarget::operator == (const Target &t) const {
const MetaTilePropertyTarget *targetPtr = (const MetaTilePropertyTarget *)&t;
- return metaProp == targetPtr->metaProp;
+ return _metaProp == targetPtr->_metaProp;
}
bool MetaTilePropertyTarget::isTarget(
MetaTile *mt,
int16 mapNum,
const TilePoint &tp) const {
- return mt->hasProperty(*g_vm->_properties->getMetaTileProp(metaProp), mapNum, tp);
+ return mt->hasProperty(*g_vm->_properties->getMetaTileProp(_metaProp), mapNum, tp);
}
/* ===================================================================== *
@@ -904,7 +904,7 @@ SpecificObjectTarget::SpecificObjectTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... SpecificObjectTarget");
// Restore the ObjectID
- obj = stream->readUint16LE();
+ _obj = stream->readUint16LE();
}
//----------------------------------------------------------------------
@@ -912,12 +912,12 @@ SpecificObjectTarget::SpecificObjectTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 SpecificObjectTarget::archiveSize() const {
- return sizeof(obj);
+ return sizeof(_obj);
}
void SpecificObjectTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the ObjectID
- out->writeUint16LE(obj);
+ out->writeUint16LE(_obj);
}
//----------------------------------------------------------------------
@@ -949,7 +949,7 @@ bool SpecificObjectTarget::operator == (const Target &t) const {
const SpecificObjectTarget *targetPtr = (const SpecificObjectTarget *)&t;
- return obj == targetPtr->obj;
+ return _obj == targetPtr->_obj;
}
//----------------------------------------------------------------------
@@ -957,7 +957,7 @@ bool SpecificObjectTarget::operator == (const Target &t) const {
// for
bool SpecificObjectTarget::isTarget(GameObject *testObj) const {
- return testObj->thisID() == obj;
+ return testObj->thisID() == _obj;
}
//----------------------------------------------------------------------
@@ -967,7 +967,7 @@ bool SpecificObjectTarget::isTarget(GameObject *testObj) const {
TilePoint SpecificObjectTarget::where(
GameWorld *world,
const TilePoint &tp) const {
- GameObject *o = GameObject::objectAddress(obj);
+ GameObject *o = GameObject::objectAddress(_obj);
if (o->world() == world) {
TilePoint objLoc = o->getLocation();
@@ -987,7 +987,7 @@ int16 SpecificObjectTarget::where(
GameWorld *world,
const TilePoint &tp,
TargetLocationArray &tla) const {
- GameObject *o = GameObject::objectAddress(obj);
+ GameObject *o = GameObject::objectAddress(_obj);
if (tla.size > 0 && o->world() == world) {
TilePoint objLoc = o->getLocation();
@@ -1012,7 +1012,7 @@ int16 SpecificObjectTarget::where(
GameObject *SpecificObjectTarget::object(
GameWorld *world,
const TilePoint &tp) const {
- GameObject *o = GameObject::objectAddress(obj);
+ GameObject *o = GameObject::objectAddress(_obj);
if (o->world() == world) {
if ((tp - o->getLocation()).quickHDistance() < maxObjDist)
@@ -1030,7 +1030,7 @@ int16 SpecificObjectTarget::object(
GameWorld *world,
const TilePoint &tp,
TargetObjectArray &toa) const {
- GameObject *o = GameObject::objectAddress(obj);
+ GameObject *o = GameObject::objectAddress(_obj);
if (toa.size > 0 && o->world() == world) {
int16 dist = (tp - o->getLocation()).quickHDistance();
@@ -1055,7 +1055,7 @@ ObjectPropertyTarget::ObjectPropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... ObjectPropertyTarget");
// Restore the ObjectPropertyID
- objProp = stream->readSint16LE();
+ _objProp = stream->readSint16LE();
}
//----------------------------------------------------------------------
@@ -1063,12 +1063,12 @@ ObjectPropertyTarget::ObjectPropertyTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 ObjectPropertyTarget::archiveSize() const {
- return sizeof(objProp);
+ return sizeof(_objProp);
}
void ObjectPropertyTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the ObjectPropertyID
- out->writeSint16LE(objProp);
+ out->writeSint16LE(_objProp);
}
//----------------------------------------------------------------------
@@ -1100,11 +1100,11 @@ bool ObjectPropertyTarget::operator == (const Target &t) const {
const ObjectPropertyTarget *targetPtr = (const ObjectPropertyTarget *)&t;
- return objProp == targetPtr->objProp;
+ return _objProp == targetPtr->_objProp;
}
bool ObjectPropertyTarget::isTarget(GameObject *testObj) const {
- return testObj->hasProperty(*g_vm->_properties->getObjProp(objProp));
+ return testObj->hasProperty(*g_vm->_properties->getObjProp(_objProp));
}
/* ===================================================================== *
@@ -1152,7 +1152,7 @@ SpecificActorTarget::SpecificActorTarget(Common::SeekableReadStream *stream) {
actorID = stream->readUint16LE();
// Convert the actor ID into an Actor pointer
- a = actorID != Nothing
+ _a = actorID != Nothing
? (Actor *)GameObject::objectAddress(actorID)
: nullptr;
}
@@ -1167,7 +1167,7 @@ inline int32 SpecificActorTarget::archiveSize() const {
void SpecificActorTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Convert the actor pointer to an actor ID;
- ObjectID actorID = a != nullptr ? a->thisID() : Nothing;
+ ObjectID actorID = _a != nullptr ? _a->thisID() : Nothing;
// Store the actor ID
out->writeUint16LE(actorID);
@@ -1202,7 +1202,7 @@ bool SpecificActorTarget::operator == (const Target &t) const {
const SpecificActorTarget *targetPtr = (const SpecificActorTarget *)&t;
- return a == targetPtr->a;
+ return _a == targetPtr->_a;
}
//----------------------------------------------------------------------
@@ -1210,18 +1210,16 @@ bool SpecificActorTarget::operator == (const Target &t) const {
// for
bool SpecificActorTarget::isTarget(Actor *testActor) const {
- return testActor == a;
+ return testActor == _a;
}
//----------------------------------------------------------------------
// Return the location of the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-TilePoint SpecificActorTarget::where(
- GameWorld *world,
- const TilePoint &tp) const {
- if (a->world() == world) {
- TilePoint actorLoc = a->getLocation();
+TilePoint SpecificActorTarget::where(GameWorld *world, const TilePoint &tp) const {
+ if (_a->world() == world) {
+ TilePoint actorLoc = _a->getLocation();
if ((tp - actorLoc).quickHDistance() < maxObjDist)
return actorLoc;
@@ -1234,12 +1232,9 @@ TilePoint SpecificActorTarget::where(
// Return the location of the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-int16 SpecificActorTarget::where(
- GameWorld *world,
- const TilePoint &tp,
- TargetLocationArray &tla) const {
- if (tla.size > 0 && a->world() == world) {
- TilePoint actorLoc = a->getLocation();
+int16 SpecificActorTarget::where(GameWorld *world, const TilePoint &tp, TargetLocationArray &tla) const {
+ if (tla.size > 0 && _a->world() == world) {
+ TilePoint actorLoc = _a->getLocation();
int16 dist = (tp - actorLoc).quickHDistance();
if (dist < maxObjDist) {
@@ -1258,12 +1253,10 @@ int16 SpecificActorTarget::where(
// Return an object pointer to the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-GameObject *SpecificActorTarget::object(
- GameWorld *world,
- const TilePoint &tp) const {
- if (a->world() == world) {
- if ((tp - a->getLocation()).quickHDistance() < maxObjDist)
- return a;
+GameObject *SpecificActorTarget::object(GameWorld *world, const TilePoint &tp) const {
+ if (_a->world() == world) {
+ if ((tp - _a->getLocation()).quickHDistance() < maxObjDist)
+ return _a;
}
return nullptr;
@@ -1273,16 +1266,13 @@ GameObject *SpecificActorTarget::object(
// Return an object pointer to the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-int16 SpecificActorTarget::object(
- GameWorld *world,
- const TilePoint &tp,
- TargetObjectArray &toa) const {
- if (toa.size > 0 && a->world() == world) {
- int16 dist = (tp - a->getLocation()).quickHDistance();
+int16 SpecificActorTarget::object(GameWorld *world, const TilePoint &tp, TargetObjectArray &toa) const {
+ if (toa.size > 0 && _a->world() == world) {
+ int16 dist = (tp - _a->getLocation()).quickHDistance();
if (dist < maxObjDist) {
toa.objs = 1;
- toa.objArray[0] = a;
+ toa.objArray[0] = _a;
toa.distArray[0] = dist;
return 1;
@@ -1296,12 +1286,10 @@ int16 SpecificActorTarget::object(
// Return a pointer to the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-Actor *SpecificActorTarget::actor(
- GameWorld *world,
- const TilePoint &tp) const {
- if (a->world() == world) {
- if ((tp - a->getLocation()).quickHDistance() < maxObjDist)
- return a;
+Actor *SpecificActorTarget::actor(GameWorld *world, const TilePoint &tp) const {
+ if (_a->world() == world) {
+ if ((tp - _a->getLocation()).quickHDistance() < maxObjDist)
+ return _a;
}
return nullptr;
@@ -1311,16 +1299,13 @@ Actor *SpecificActorTarget::actor(
// Return a pointer to the specific actor if it is in the specified
// world and within the maximum distance of the specified point
-int16 SpecificActorTarget::actor(
- GameWorld *world,
- const TilePoint &tp,
- TargetActorArray &taa) const {
- if (taa.size > 0 && a->world() == world) {
- int16 dist = (tp - a->getLocation()).quickHDistance();
+int16 SpecificActorTarget::actor(GameWorld *world, const TilePoint &tp, TargetActorArray &taa) const {
+ if (taa.size > 0 && _a->world() == world) {
+ int16 dist = (tp - _a->getLocation()).quickHDistance();
if (dist < maxObjDist) {
taa.actors = 1;
- taa.actorArray[0] = a;
+ taa.actorArray[0] = _a;
taa.distArray[0] = dist;
return 1;
@@ -1338,7 +1323,7 @@ ActorPropertyTarget::ActorPropertyTarget(Common::SeekableReadStream *stream) {
debugC(5, kDebugSaveload, "...... ActorPropertyTarget");
// Restore the ActorPropertyID
- actorProp = stream->readSint16LE();
+ _actorProp = stream->readSint16LE();
}
//----------------------------------------------------------------------
@@ -1346,12 +1331,12 @@ ActorPropertyTarget::ActorPropertyTarget(Common::SeekableReadStream *stream) {
// a buffer
inline int32 ActorPropertyTarget::archiveSize() const {
- return sizeof(actorProp);
+ return sizeof(_actorProp);
}
void ActorPropertyTarget::write(Common::MemoryWriteStreamDynamic *out) const {
// Store the ActorPropertyID
- out->writeSint16LE(actorProp);
+ out->writeSint16LE(_actorProp);
}
//----------------------------------------------------------------------
@@ -1383,11 +1368,11 @@ bool ActorPropertyTarget::operator == (const Target &t) const {
const ActorPropertyTarget *targetPtr = (const ActorPropertyTarget *)&t;
- return actorProp == targetPtr->actorProp;
+ return _actorProp == targetPtr->_actorProp;
}
bool ActorPropertyTarget::isTarget(Actor *testActor) const {
- return testActor->hasProperty(*g_vm->_properties->getActorProp(actorProp));
+ return testActor->hasProperty(*g_vm->_properties->getActorProp(_actorProp));
}
} // end of namespace Saga2
diff --git a/engines/saga2/target.h b/engines/saga2/target.h
index fb4e1922387..273d464064b 100644
--- a/engines/saga2/target.h
+++ b/engines/saga2/target.h
@@ -181,11 +181,11 @@ public:
* ===================================================================== */
class LocationTarget : public Target {
- TilePoint loc;
+ TilePoint _loc;
public:
// Constructor -- initial construction
- LocationTarget(const TilePoint &tp) : loc(tp) {}
+ LocationTarget(const TilePoint &tp) : _loc(tp) {}
LocationTarget(Common::SeekableReadStream *stream);
@@ -210,10 +210,10 @@ public:
// Determine if the specified location target is equivalent to this
// location target
bool operator == (const LocationTarget <) const {
- return loc == lt.loc;
+ return _loc == lt._loc;
}
bool operator != (const LocationTarget <) const {
- return loc != lt.loc;
+ return _loc != lt._loc;
}
TilePoint where(GameWorld *world, const TilePoint &tp) const;
@@ -243,11 +243,11 @@ public:
* ===================================================================== */
class SpecificTileTarget : public TileTarget {
- TileID tile;
+ TileID _tile;
public:
// Constructor -- initial construction
- SpecificTileTarget(TileID t) : tile(t) {}
+ SpecificTileTarget(TileID t) : _tile(t) {}
SpecificTileTarget(Common::SeekableReadStream *stream);
@@ -277,11 +277,11 @@ public:
* ===================================================================== */
class TilePropertyTarget : public TileTarget {
- TilePropertyID tileProp;
+ TilePropertyID _tileProp;
public:
// Constructor -- initial construction
- TilePropertyTarget(TilePropertyID tProp) : tileProp(tProp) {}
+ TilePropertyTarget(TilePropertyID tProp) : _tileProp(tProp) {}
TilePropertyTarget(Common::SeekableReadStream *stream);
@@ -329,11 +329,11 @@ public:
* ===================================================================== */
class SpecificMetaTileTarget : public MetaTileTarget {
- MetaTileID meta;
+ MetaTileID _meta;
public:
// Constructor -- initial construction
- SpecificMetaTileTarget(MetaTileID mt) : meta(mt) {}
+ SpecificMetaTileTarget(MetaTileID mt) : _meta(mt) {}
SpecificMetaTileTarget(Common::SeekableReadStream *stream);
@@ -363,12 +363,12 @@ public:
* ===================================================================== */
class MetaTilePropertyTarget : public MetaTileTarget {
- MetaTilePropertyID metaProp;
+ MetaTilePropertyID _metaProp;
public:
// Constructor -- initial construction
MetaTilePropertyTarget(MetaTilePropertyID mtProp) :
- metaProp(mtProp) {
+ _metaProp(mtProp) {
}
MetaTilePropertyTarget(Common::SeekableReadStream *stream);
@@ -439,17 +439,15 @@ public:
* ===================================================================== */
class SpecificObjectTarget : public ObjectTarget {
- ObjectID obj;
+ ObjectID _obj;
public:
// Constructors -- initial construction
SpecificObjectTarget(ObjectID id) :
- obj(id) {
- assert(isObject(obj));
- }
- SpecificObjectTarget(GameObject *ptr) :
- obj((assert(isObject(ptr)), ptr->thisID())) {
+ _obj(id) {
+ assert(isObject(_obj));
}
+ SpecificObjectTarget(GameObject *ptr) : _obj((assert(isObject(ptr)), ptr->thisID())) {}
SpecificObjectTarget(Common::SeekableReadStream *stream);
@@ -487,7 +485,7 @@ public:
// Return a pointer to the target object, unconditionally
GameObject *getTargetObject() const {
- return GameObject::objectAddress(obj);
+ return GameObject::objectAddress(_obj);
}
};
@@ -496,11 +494,11 @@ public:
* ===================================================================== */
class ObjectPropertyTarget : public ObjectTarget {
- ObjectPropertyID objProp;
+ ObjectPropertyID _objProp;
public:
// Constructor -- initial construction
- ObjectPropertyTarget(ObjectPropertyID prop) : objProp(prop) {}
+ ObjectPropertyTarget(ObjectPropertyID prop) : _objProp(prop) {}
ObjectPropertyTarget(Common::SeekableReadStream *stream);
@@ -549,13 +547,11 @@ public:
* ===================================================================== */
class SpecificActorTarget : public ActorTarget {
- Actor *a;
+ Actor *_a;
public:
// Constructor -- initial construction
- SpecificActorTarget(Actor *actor_) :
- a(actor_) {
- }
+ SpecificActorTarget(Actor *actor_) : _a(actor_) {}
SpecificActorTarget(Common::SeekableReadStream *stream);
@@ -599,7 +595,7 @@ public:
// Return a pointer to the target actor, unconditionally
Actor *getTargetActor() const {
- return a;
+ return _a;
}
};
@@ -608,13 +604,11 @@ public:
* ===================================================================== */
class ActorPropertyTarget : public ActorTarget {
- ActorPropertyID actorProp;
+ ActorPropertyID _actorProp;
public:
// Constructor -- initial construction
- ActorPropertyTarget(ActorPropertyID aProp) :
- actorProp(aProp) {
- }
+ ActorPropertyTarget(ActorPropertyID aProp) : _actorProp(aProp) {}
ActorPropertyTarget(Common::SeekableReadStream *stream);
Commit: 9d393ffc619d8c275b093ef4d61107a9b20b2e9f
https://github.com/scummvm/scummvm/commit/9d393ffc619d8c275b093ef4d61107a9b20b2e9f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in task.h
Changed paths:
engines/saga2/task.cpp
engines/saga2/task.h
diff --git a/engines/saga2/task.cpp b/engines/saga2/task.cpp
index d7e6c8c0764..7c2bd7c4978 100644
--- a/engines/saga2/task.cpp
+++ b/engines/saga2/task.cpp
@@ -749,7 +749,7 @@ void writeTask(Task *t, Common::MemoryWriteStreamDynamic *out) {
Task::Task(Common::InSaveFile *in, TaskID id) {
// Place the stack ID into the stack pointer field
_stackID = in->readSint16LE();
- stack = nullptr;
+ _stack = nullptr;
newTask(this, id);
}
@@ -758,7 +758,7 @@ Task::Task(Common::InSaveFile *in, TaskID id) {
void Task::fixup() {
// Convert the stack ID to a stack pointer
- stack = getTaskStackAddress(_stackID);
+ _stack = getTaskStackAddress(_stackID);
}
//----------------------------------------------------------------------
@@ -770,7 +770,7 @@ inline int32 Task::archiveSize() const {
}
void Task::write(Common::MemoryWriteStreamDynamic *out) const {
- out->writeSint16LE(getTaskStackID(stack));
+ out->writeSint16LE(getTaskStackID(_stack));
}
/* ===================================================================== *
@@ -778,11 +778,11 @@ void Task::write(Common::MemoryWriteStreamDynamic *out) const {
* ===================================================================== */
WanderTask::WanderTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
- // Restore the paused flag
- paused = in->readUint16LE();
+ // Restore the _paused flag
+ _paused = in->readUint16LE();
- // Restore the counter
- counter = in->readSint16LE();
+ // Restore the _counter
+ _counter = in->readSint16LE();
}
//----------------------------------------------------------------------
@@ -791,19 +791,19 @@ WanderTask::WanderTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
int32 WanderTask::archiveSize() const {
return Task::archiveSize()
- + sizeof(paused)
- + sizeof(counter);
+ + sizeof(_paused)
+ + sizeof(_counter);
}
void WanderTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
Task::write(out);
- // Store the paused flag
- out->writeUint16LE(paused);
+ // Store the _paused flag
+ out->writeUint16LE(_paused);
- // Store the counter
- out->writeSint16LE(counter);
+ // Store the _counter
+ out->writeSint16LE(_counter);
}
//----------------------------------------------------------------------
@@ -817,9 +817,10 @@ int16 WanderTask::getType() const {
void WanderTask::abortTask() {
// if the actor has a wander motion, abort it
- MotionTask *actorMotion = stack->getActor()->_moveTask;
+ MotionTask *actorMotion = _stack->getActor()->_moveTask;
- if (actorMotion && actorMotion->isWander()) actorMotion->finishWalk();
+ if (actorMotion && actorMotion->isWander())
+ actorMotion->finishWalk();
}
//----------------------------------------------------------------------
@@ -832,15 +833,15 @@ TaskResult WanderTask::evaluate() {
//----------------------------------------------------------------------
TaskResult WanderTask::update() {
- if (counter == 0) {
- if (!paused)
+ if (_counter == 0) {
+ if (!_paused)
pause();
else
wander();
} else
- counter--;
+ _counter--;
- return !paused ? handleWander() : handlePaused();
+ return !_paused ? handleWander() : handlePaused();
}
//----------------------------------------------------------------------
@@ -851,37 +852,37 @@ bool WanderTask::operator == (const Task &t) const {
}
//----------------------------------------------------------------------
-// Update function used when task is not paused
+// Update function used when task is not _paused
TaskResult WanderTask::handleWander() {
- MotionTask *actorMotion = stack->getActor()->_moveTask;
+ MotionTask *actorMotion = _stack->getActor()->_moveTask;
// If the actor is not already wandering, start a wander motion
// task
if (!actorMotion
|| !actorMotion->isWander())
- MotionTask::wander(*stack->getActor());
+ MotionTask::wander(*_stack->getActor());
return taskNotDone;
}
//----------------------------------------------------------------------
-// Set this task into the paused state
+// Set this task into the _paused state
void WanderTask::pause() {
// Call abort to stop the wandering motion
abortTask();
- paused = true;
- counter = (g_vm->_rnd->getRandomNumber(63) + g_vm->_rnd->getRandomNumber(63)) / 2;
+ _paused = true;
+ _counter = (g_vm->_rnd->getRandomNumber(63) + g_vm->_rnd->getRandomNumber(63)) / 2;
}
//----------------------------------------------------------------------
// Set this task into the wander state
void WanderTask::wander() {
- paused = false;
- counter = (g_vm->_rnd->getRandomNumber(255) + g_vm->_rnd->getRandomNumber(255)) / 2;
+ _paused = false;
+ _counter = (g_vm->_rnd->getRandomNumber(255) + g_vm->_rnd->getRandomNumber(255)) / 2;
}
/* ===================================================================== *
@@ -892,14 +893,14 @@ TetheredWanderTask::TetheredWanderTask(Common::InSaveFile *in, TaskID id) : Wand
debugC(3, kDebugSaveload, "... Loading TetheredWanderTask");
// Restore the tether coordinates
- minU = in->readSint16LE();
- minV = in->readSint16LE();
- maxU = in->readSint16LE();
- maxV = in->readSint16LE();
+ _minU = in->readSint16LE();
+ _minV = in->readSint16LE();
+ _maxU = in->readSint16LE();
+ _maxV = in->readSint16LE();
- // Put the gotoTether ID into the gotoTether pointer field
+ // Put the _gotoTether ID into the _gotoTether pointer field
_gotoTetherID = in->readSint16LE();
- gotoTether = nullptr;
+ _gotoTether = nullptr;
}
//----------------------------------------------------------------------
@@ -909,8 +910,8 @@ void TetheredWanderTask::fixup() {
// Let the base class fixup it's pointers
WanderTask::fixup();
- // Restore the gotoTether pointer
- gotoTether = _gotoTetherID != NoTask
+ // Restore the _gotoTether pointer
+ _gotoTether = _gotoTetherID != NoTask
? (GotoRegionTask *)getTaskAddress(_gotoTetherID)
: nullptr;
}
@@ -920,11 +921,11 @@ void TetheredWanderTask::fixup() {
inline int32 TetheredWanderTask::archiveSize() const {
return WanderTask::archiveSize()
- + sizeof(minU)
- + sizeof(minU)
- + sizeof(minU)
- + sizeof(minU)
- + sizeof(TaskID); // gotoTether ID
+ + sizeof(_minU)
+ + sizeof(_minU)
+ + sizeof(_minU)
+ + sizeof(_minU)
+ + sizeof(TaskID); // _gotoTether ID
}
void TetheredWanderTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -934,14 +935,14 @@ void TetheredWanderTask::write(Common::MemoryWriteStreamDynamic *out) const {
WanderTask::write(out);
// Archive tether coordinates
- out->writeSint16LE(minU);
- out->writeSint16LE(minV);
- out->writeSint16LE(maxU);
- out->writeSint16LE(maxV);
-
- // Archive gotoTether ID
- if (gotoTether != nullptr)
- out->writeSint16LE(getTaskID(gotoTether));
+ out->writeSint16LE(_minU);
+ out->writeSint16LE(_minV);
+ out->writeSint16LE(_maxU);
+ out->writeSint16LE(_maxV);
+
+ // Archive _gotoTether ID
+ if (_gotoTether != nullptr)
+ out->writeSint16LE(getTaskID(_gotoTether));
else
out->writeSint16LE(NoTask);
}
@@ -956,12 +957,12 @@ int16 TetheredWanderTask::getType() const {
//----------------------------------------------------------------------
void TetheredWanderTask::abortTask() {
- if (gotoTether != nullptr) {
- gotoTether->abortTask();
- delete gotoTether;
- gotoTether = nullptr;
+ if (_gotoTether != nullptr) {
+ _gotoTether->abortTask();
+ delete _gotoTether;
+ _gotoTether = nullptr;
} else {
- MotionTask *actorMotion = stack->getActor()->_moveTask;
+ MotionTask *actorMotion = _stack->getActor()->_moveTask;
// if the actor has a tethered wander motion, abort it
if (actorMotion && actorMotion->isTethered())
@@ -977,30 +978,31 @@ bool TetheredWanderTask::operator == (const Task &t) const {
const TetheredWanderTask *taskPtr = (const TetheredWanderTask *)&t;
- return minU == taskPtr->minU && minV == taskPtr->minV
- && maxU == taskPtr->maxU && maxV == taskPtr->maxV;
+ return _minU == taskPtr->_minU && _minV == taskPtr->_minV
+ && _maxU == taskPtr->_maxU && _maxV == taskPtr->_maxV;
}
//----------------------------------------------------------------------
-// Update function used when task is not paused
+// Update function used when task is not _paused
TaskResult TetheredWanderTask::handleWander() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
TilePoint actorLoc = a->getLocation();
- if (actorLoc.u < minU || actorLoc.u >= maxU
- || actorLoc.v < minV || actorLoc.v >= maxV) {
- if (gotoTether != nullptr)
- gotoTether->update();
+ if (actorLoc.u < _minU || actorLoc.u >= _maxU
+ || actorLoc.v < _minV || actorLoc.v >= _maxV) {
+ if (_gotoTether != nullptr)
+ _gotoTether->update();
else {
- gotoTether = new GotoRegionTask(stack, minU, minV, maxU, maxV);
- if (gotoTether != nullptr) gotoTether->update();
+ _gotoTether = new GotoRegionTask(_stack, _minU, _minV, _maxU, _maxV);
+ if (_gotoTether != nullptr)
+ _gotoTether->update();
}
} else {
- if (gotoTether != nullptr) {
- gotoTether->abortTask();
- delete gotoTether;
- gotoTether = nullptr;
+ if (_gotoTether != nullptr) {
+ _gotoTether->abortTask();
+ delete _gotoTether;
+ _gotoTether = nullptr;
}
bool startWander = false;
@@ -1011,10 +1013,10 @@ TaskResult TetheredWanderTask::handleWander() {
if (actorMotion) {
TileRegion motionTeth = actorMotion->getTether();
startWander = ((!actorMotion->isWander())
- || motionTeth.min.u != minU
- || motionTeth.min.v != minV
- || motionTeth.max.u != maxU
- || motionTeth.max.v != maxV);
+ || motionTeth.min.u != _minU
+ || motionTeth.min.v != _minV
+ || motionTeth.max.u != _maxU
+ || motionTeth.max.v != _maxV);
} else
startWander = true;
@@ -1026,17 +1028,17 @@ TaskResult TetheredWanderTask::handleWander() {
/*
if ( !actorMotion
|| !actorMotion->isWander()
- || motionTether.min.u != minU
- || motionTether.min.v != minV
- || motionTether.max.u != maxU
- || motionTether.max.v != maxV )
+ || motionTether.min.u != _minU
+ || motionTether.min.v != _minV
+ || motionTether.max.u != _maxU
+ || motionTether.max.v != _maxV )
*/
if (startWander) {
TileRegion reg;
- reg.min = TilePoint(minU, minV, 0);
- reg.max = TilePoint(maxU, maxV, 0);
- MotionTask::tetheredWander(*stack->getActor(), reg);
+ reg.min = TilePoint(_minU, _minV, 0);
+ reg.max = TilePoint(_maxU, _maxV, 0);
+ MotionTask::tetheredWander(*_stack->getActor(), reg);
}
}
@@ -1050,10 +1052,10 @@ TaskResult TetheredWanderTask::handleWander() {
GotoTask::GotoTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Get the wander TaskID
_wanderID = in->readSint16LE();
- wander = nullptr;
+ _wander = nullptr;
// Restore prevRunState
- prevRunState = in->readUint16LE();
+ _prevRunState = in->readUint16LE();
}
//----------------------------------------------------------------------
@@ -1064,7 +1066,7 @@ void GotoTask::fixup() {
Task::fixup();
// Convert wanderID to a Task pointer
- wander = _wanderID != NoTask
+ _wander = _wanderID != NoTask
? (WanderTask *)getTaskAddress(_wanderID)
: nullptr;
}
@@ -1076,7 +1078,7 @@ void GotoTask::fixup() {
inline int32 GotoTask::archiveSize() const {
return Task::archiveSize()
+ sizeof(TaskID) // wander ID
- + sizeof(prevRunState);
+ + sizeof(_prevRunState);
}
void GotoTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -1085,25 +1087,25 @@ void GotoTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Convert the wander Task pointer to a TaskID and store it
// in the buffer
- if (wander != nullptr)
- out->writeSint16LE(getTaskID(wander));
+ if (_wander != nullptr)
+ out->writeSint16LE(getTaskID( _wander));
else
out->writeSint16LE(NoTask);
- // Store prevRunState
- out->writeUint16LE(prevRunState);
+ // Store _prevRunState
+ out->writeUint16LE(_prevRunState);
}
//----------------------------------------------------------------------
void GotoTask::abortTask() {
// If there is a wander subtask, delete it.
- if (wander) {
- wander->abortTask();
- delete wander;
- wander = nullptr;
+ if ( _wander) {
+ _wander->abortTask();
+ delete _wander;
+ _wander = nullptr;
} else {
- MotionTask *actorMotion = stack->getActor()->_moveTask;
+ MotionTask *actorMotion = _stack->getActor()->_moveTask;
if (actorMotion && actorMotion->isWalk()) actorMotion->finishWalk();
}
@@ -1113,7 +1115,7 @@ void GotoTask::abortTask() {
TaskResult GotoTask::evaluate() {
// Determine if we have reach the target.
- if (stack->getActor()->getLocation() == destination()) {
+ if (_stack->getActor()->getLocation() == destination()) {
abortTask();
return taskSucceeded;
}
@@ -1130,7 +1132,7 @@ TaskResult GotoTask::update() {
if (result != taskNotDone) return result;
}
- Actor *const a = stack->getActor();
+ Actor *const a = _stack->getActor();
// Compute the immediate destination based upon wether or not the
// actor has a line of sight to the target.
TilePoint immediateDest = lineOfSight()
@@ -1140,9 +1142,9 @@ TaskResult GotoTask::update() {
// If we have a destination, walk there, else wander
if (immediateDest != Nowhere) {
// If wandering, cut it out
- if (wander != nullptr) {
- delete wander;
- wander = nullptr;
+ if (_wander != nullptr) {
+ delete _wander;
+ _wander = nullptr;
}
// Determine if there is aready a motion task, and if so,
@@ -1159,20 +1161,20 @@ TaskResult GotoTask::update() {
&& (actorLoc.v >> kTileUVShift)
== (immediateDest.v >> kTileUVShift)) {
if (motionTarget != immediateDest
- || runState != prevRunState)
+ || runState != _prevRunState)
actorMotion->changeDirectTarget(
immediateDest,
- prevRunState = runState);
+ _prevRunState = runState);
} else {
if ((motionTarget.u >> kTileUVShift)
!= (immediateDest.u >> kTileUVShift)
|| (motionTarget.v >> kTileUVShift)
!= (immediateDest.v >> kTileUVShift)
|| ABS(motionTarget.z - immediateDest.z) > 16
- || runState != prevRunState)
+ || runState != _prevRunState)
actorMotion->changeTarget(
immediateDest,
- prevRunState = runState);
+ _prevRunState = runState);
}
} else {
if ((actorLoc.u >> kTileUVShift)
@@ -1182,18 +1184,18 @@ TaskResult GotoTask::update() {
MotionTask::walkToDirect(
*a,
immediateDest,
- prevRunState = run());
+ _prevRunState = run());
} else
- MotionTask::walkTo(*a, immediateDest, prevRunState = run());
+ MotionTask::walkTo(*a, immediateDest, _prevRunState = run());
}
} else {
// If wandering, update the wander task else set up a new
// wander task
- if (wander != nullptr)
- wander->update();
+ if (_wander != nullptr)
+ _wander->update();
else {
- wander = new WanderTask(stack);
- if (wander != nullptr) wander->update();
+ _wander = new WanderTask(_stack);
+ if (_wander != nullptr) _wander->update();
}
return taskNotDone;
@@ -1210,10 +1212,10 @@ GotoLocationTask::GotoLocationTask(Common::InSaveFile *in, TaskID id) : GotoTask
debugC(3, kDebugSaveload, "... Loading GotoLocationTask");
// Restore the target location
- targetLoc.load(in);
+ _targetLoc.load(in);
- // Restore the runThreshold
- runThreshold = in->readByte();
+ // Restore the _runThreshold
+ _runThreshold = in->readByte();
}
//----------------------------------------------------------------------
@@ -1222,8 +1224,8 @@ GotoLocationTask::GotoLocationTask(Common::InSaveFile *in, TaskID id) : GotoTask
inline int32 GotoLocationTask::archiveSize() const {
return GotoTask::archiveSize()
- + sizeof(targetLoc)
- + sizeof(runThreshold);
+ + sizeof(_targetLoc)
+ + sizeof(_runThreshold);
}
void GotoLocationTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -1233,10 +1235,10 @@ void GotoLocationTask::write(Common::MemoryWriteStreamDynamic *out) const {
GotoTask::write(out);
// Archive the target location
- targetLoc.write(out);
+ _targetLoc.write(out);
// Archive the run threshold
- out->writeByte(runThreshold);
+ out->writeByte(_runThreshold);
}
//----------------------------------------------------------------------
@@ -1254,22 +1256,22 @@ bool GotoLocationTask::operator == (const Task &t) const {
const GotoLocationTask *taskPtr = (const GotoLocationTask *)&t;
- return targetLoc == taskPtr->targetLoc
- && runThreshold == taskPtr->runThreshold;
+ return _targetLoc == taskPtr->_targetLoc
+ && _runThreshold == taskPtr->_runThreshold;
}
//----------------------------------------------------------------------
TilePoint GotoLocationTask::destination() {
// Simply return the target location
- return targetLoc;
+ return _targetLoc;
}
//----------------------------------------------------------------------
TilePoint GotoLocationTask::intermediateDest() {
// GotoLocationTask's never have an intermediate destination
- return targetLoc;
+ return _targetLoc;
}
//----------------------------------------------------------------------
@@ -1283,11 +1285,11 @@ bool GotoLocationTask::lineOfSight() {
//----------------------------------------------------------------------
bool GotoLocationTask::run() {
- TilePoint actorLoc = stack->getActor()->getLocation();
+ TilePoint actorLoc = _stack->getActor()->getLocation();
- return runThreshold != maxuint8
- ? (targetLoc - actorLoc).quickHDistance() > runThreshold
- || ABS(targetLoc.z - actorLoc.z) > runThreshold
+ return _runThreshold != maxuint8
+ ? (_targetLoc - actorLoc).quickHDistance() > _runThreshold
+ || ABS(_targetLoc.z - actorLoc.z) > _runThreshold
: false;
}
@@ -1299,10 +1301,10 @@ GotoRegionTask::GotoRegionTask(Common::InSaveFile *in, TaskID id) : GotoTask(in,
debugC(3, kDebugSaveload, "... Loading GotoRegionTask");
// Restore the region coordinates
- regionMinU = in->readSint16LE();
- regionMinV = in->readSint16LE();
- regionMaxU = in->readSint16LE();
- regionMaxV = in->readSint16LE();
+ _regionMinU = in->readSint16LE();
+ _regionMinV = in->readSint16LE();
+ _regionMaxU = in->readSint16LE();
+ _regionMaxV = in->readSint16LE();
}
//----------------------------------------------------------------------
@@ -1311,10 +1313,10 @@ GotoRegionTask::GotoRegionTask(Common::InSaveFile *in, TaskID id) : GotoTask(in,
inline int32 GotoRegionTask::archiveSize() const {
return GotoTask::archiveSize()
- + sizeof(regionMinU)
- + sizeof(regionMinV)
- + sizeof(regionMaxU)
- + sizeof(regionMaxV);
+ + sizeof(_regionMinU)
+ + sizeof(_regionMinV)
+ + sizeof(_regionMaxU)
+ + sizeof(_regionMaxV);
}
void GotoRegionTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -1323,10 +1325,10 @@ void GotoRegionTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
GotoTask::write(out);
// Archive the region coordinates
- out->writeSint16LE(regionMinU);
- out->writeSint16LE(regionMinV);
- out->writeSint16LE(regionMaxU);
- out->writeSint16LE(regionMaxV);
+ out->writeSint16LE(_regionMinU);
+ out->writeSint16LE(_regionMinV);
+ out->writeSint16LE(_regionMaxU);
+ out->writeSint16LE(_regionMaxV);
}
//----------------------------------------------------------------------
@@ -1344,18 +1346,18 @@ bool GotoRegionTask::operator == (const Task &t) const {
const GotoRegionTask *taskPtr = (const GotoRegionTask *)&t;
- return regionMinU == taskPtr->regionMinU
- && regionMinV == taskPtr->regionMinV
- && regionMaxU == taskPtr->regionMaxU
- && regionMaxV == taskPtr->regionMaxV;
+ return _regionMinU == taskPtr->_regionMinU
+ && _regionMinV == taskPtr->_regionMinV
+ && _regionMaxU == taskPtr->_regionMaxU
+ && _regionMaxV == taskPtr->_regionMaxV;
}
TilePoint GotoRegionTask::destination() {
- TilePoint actorLoc = stack->getActor()->getLocation();
+ TilePoint actorLoc = _stack->getActor()->getLocation();
return TilePoint(
- clamp(regionMinU, actorLoc.u, regionMaxU - 1),
- clamp(regionMinV, actorLoc.v, regionMaxV - 1),
+ clamp(_regionMinU, actorLoc.u, _regionMaxU - 1),
+ clamp(_regionMinV, actorLoc.v, _regionMaxV - 1),
actorLoc.z);
}
@@ -1382,17 +1384,17 @@ bool GotoRegionTask::run() {
* ===================================================================== */
GotoObjectTargetTask::GotoObjectTargetTask(Common::InSaveFile *in, TaskID id) : GotoTask(in, id) {
- // Restore lastTestedLoc and increment pointer
- lastTestedLoc.load(in);
+ // Restore _lastTestedLoc and increment pointer
+ _lastTestedLoc.load(in);
- // Restore sightCtr and increment pointer
- sightCtr = in->readSint16LE();
+ // Restore _sightCtr and increment pointer
+ _sightCtr = in->readSint16LE();
// Restore the flags and increment pointer
- flags = in->readByte();
+ _flags = in->readByte();
- // Restore lastKnownLoc
- lastKnownLoc.load(in);
+ // Restore _lastKnownLoc
+ _lastKnownLoc.load(in);
}
//----------------------------------------------------------------------
@@ -1401,27 +1403,27 @@ GotoObjectTargetTask::GotoObjectTargetTask(Common::InSaveFile *in, TaskID id) :
inline int32 GotoObjectTargetTask::archiveSize() const {
return GotoTask::archiveSize()
- + sizeof(lastTestedLoc)
- + sizeof(sightCtr)
- + sizeof(flags)
- + sizeof(lastKnownLoc);
+ + sizeof(_lastTestedLoc)
+ + sizeof(_sightCtr)
+ + sizeof(_flags)
+ + sizeof(_lastKnownLoc);
}
void GotoObjectTargetTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
GotoTask::write(out);
- // Archive lastTestedLoc and increment pointer
- lastTestedLoc.write(out);
+ // Archive _lastTestedLoc and increment pointer
+ _lastTestedLoc.write(out);
- // Archive sightCtr and increment pointer
- out->writeSint16LE(sightCtr);
+ // Archive _sightCtr and increment pointer
+ out->writeSint16LE(_sightCtr);
// Archive the flags and increment pointer
- out->writeByte(flags);
+ out->writeByte(_flags);
- // Archive lastKnownLoc
- lastKnownLoc.write(out);
+ // Archive _lastKnownLoc
+ _lastKnownLoc.write(out);
}
//----------------------------------------------------------------------
@@ -1435,29 +1437,29 @@ TilePoint GotoObjectTargetTask::destination() {
TilePoint GotoObjectTargetTask::intermediateDest() {
// Return the last known location
- return lastKnownLoc;
+ return _lastKnownLoc;
}
//----------------------------------------------------------------------
bool GotoObjectTargetTask::lineOfSight() {
- if (flags & track) {
- flags |= inSight;
- lastKnownLoc = getObject()->getLocation();
+ if (_flags & track) {
+ _flags |= inSight;
+ _lastKnownLoc = getObject()->getLocation();
} else {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
GameObject *target = getObject();
ObjectID targetID = target->thisID();
- TilePoint targetLoc = target->getLocation();
+ TilePoint _targetLoc = target->getLocation();
SenseInfo info;
// Determine if we need to retest the line of sight
- if (flags & inSight) {
+ if (_flags & inSight) {
// If the object was previously in sight, retest the line of
// sight if the target has moved beyond a certain range from
// the last location it was tested at.
- if ((targetLoc - lastTestedLoc).quickHDistance() > 25
- || ABS(targetLoc.z - lastTestedLoc.z) > 25) {
+ if ((_targetLoc - _lastTestedLoc).quickHDistance() > 25
+ || ABS(_targetLoc.z - _lastTestedLoc.z) > 25) {
if (a->canSenseSpecificObject(
info,
maxSenseRange,
@@ -1466,16 +1468,16 @@ bool GotoObjectTargetTask::lineOfSight() {
info,
maxSenseRange,
targetID))
- flags |= inSight;
+ _flags |= inSight;
else
- flags &= ~inSight;
- lastTestedLoc = targetLoc;
+ _flags &= ~inSight;
+ _lastTestedLoc = _targetLoc;
}
} else {
// If the object was not privously in sight, retest the line
// of sight periodically
- if (sightCtr == 0) {
- sightCtr = sightRate;
+ if (_sightCtr == 0) {
+ _sightCtr = sightRate;
if (a->canSenseSpecificObject(
info,
maxSenseRange,
@@ -1484,29 +1486,29 @@ bool GotoObjectTargetTask::lineOfSight() {
info,
maxSenseRange,
targetID))
- flags |= inSight;
+ _flags |= inSight;
else
- flags &= ~inSight;
- lastTestedLoc = targetLoc;
+ _flags &= ~inSight;
+ _lastTestedLoc = _targetLoc;
}
- sightCtr--;
+ _sightCtr--;
}
- if (flags & inSight) {
+ if (_flags & inSight) {
// If the target is in sight, the last known location is the
// objects current location.
- lastKnownLoc = targetLoc;
+ _lastKnownLoc = _targetLoc;
} else {
// If the target is not in sight, determine if we've already
// reached the last know location and if so set the last
// known location to Nowhere
- if (lastKnownLoc != Nowhere
- && (lastKnownLoc - a->getLocation()).quickHDistance() <= 4)
- lastKnownLoc = Nowhere;
+ if (_lastKnownLoc != Nowhere
+ && (_lastKnownLoc - a->getLocation()).quickHDistance() <= 4)
+ _lastKnownLoc = Nowhere;
}
}
- return flags & inSight;
+ return _flags & inSight;
}
/* ===================================================================== *
@@ -1519,8 +1521,8 @@ GotoObjectTask::GotoObjectTask(Common::InSaveFile *in, TaskID id) :
ObjectID targetID = in->readUint16LE();
- // Restore the targetObj pointer
- targetObj = targetID != Nothing
+ // Restore the _targetObj pointer
+ _targetObj = targetID != Nothing
? GameObject::objectAddress(targetID)
: nullptr;
}
@@ -1539,8 +1541,8 @@ void GotoObjectTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
GotoObjectTargetTask::write(out);
- if (targetObj != nullptr)
- out->writeUint16LE(targetObj->thisID());
+ if (_targetObj != nullptr)
+ out->writeUint16LE(_targetObj->thisID());
else
out->writeUint16LE(Nothing);
}
@@ -1561,14 +1563,14 @@ bool GotoObjectTask::operator == (const Task &t) const {
const GotoObjectTask *taskPtr = (const GotoObjectTask *)&t;
return tracking() == taskPtr->tracking()
- && targetObj == taskPtr->targetObj;
+ && _targetObj == taskPtr->_targetObj;
}
//----------------------------------------------------------------------
GameObject *GotoObjectTask::getObject() {
// Simply return the pointer to the target object
- return targetObj;
+ return _targetObj;
}
//----------------------------------------------------------------------
@@ -1585,9 +1587,9 @@ bool GotoObjectTask::run() {
GotoActorTask::GotoActorTask(Common::InSaveFile *in, TaskID id) :
GotoObjectTargetTask(in, id) {
debugC(3, kDebugSaveload, "... Loading GotoActorTask");
- // Restore the targetObj pointer
+ // Restore the _targetObj pointer
ObjectID targetID = in->readUint16LE();
- targetActor = targetID != Nothing
+ _targetActor = targetID != Nothing
? (Actor *)GameObject::objectAddress(targetID)
: nullptr;
}
@@ -1606,8 +1608,8 @@ void GotoActorTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
GotoObjectTargetTask::write(out);
- if (targetActor != nullptr)
- out->writeUint16LE(targetActor->thisID());
+ if (_targetActor != nullptr)
+ out->writeUint16LE(_targetActor->thisID());
else
out->writeUint16LE(Nothing);
}
@@ -1628,35 +1630,35 @@ bool GotoActorTask::operator == (const Task &t) const {
const GotoActorTask *taskPtr = (const GotoActorTask *)&t;
return tracking() == taskPtr->tracking()
- && targetActor == taskPtr->targetActor;
+ && _targetActor == taskPtr->_targetActor;
}
//----------------------------------------------------------------------
GameObject *GotoActorTask::getObject() {
// Simply return the pointer to the target actor
- return (GameObject *)targetActor;
+ return (GameObject *)_targetActor;
}
//----------------------------------------------------------------------
bool GotoActorTask::run() {
if (isInSight()) {
- TilePoint actorLoc = stack->getActor()->getLocation(),
- targetLoc = getTarget()->getLocation();
+ TilePoint actorLoc = _stack->getActor()->getLocation(),
+ _targetLoc = getTarget()->getLocation();
- return (actorLoc - targetLoc).quickHDistance() >= kTileUVSize * 4;
+ return (actorLoc - _targetLoc).quickHDistance() >= kTileUVSize * 4;
} else
- return lastKnownLoc != Nowhere;
+ return _lastKnownLoc != Nowhere;
}
GoAwayFromTask::GoAwayFromTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Get the subtask ID
_goTaskID = in->readSint16LE();
- goTask = nullptr;
+ _goTask = nullptr;
// Restore the flags
- flags = in->readByte();
+ _flags = in->readByte();
}
//----------------------------------------------------------------------
@@ -1666,7 +1668,7 @@ void GoAwayFromTask::fixup() {
// Let the base class fixup its pointers
Task::fixup();
- goTask = _goTaskID != NoTask
+ _goTask = _goTaskID != NoTask
? (GotoLocationTask *)getTaskAddress(_goTaskID)
: nullptr;
}
@@ -1676,31 +1678,31 @@ void GoAwayFromTask::fixup() {
// a buffer
inline int32 GoAwayFromTask::archiveSize() const {
- return Task::archiveSize() + sizeof(TaskID) + sizeof(flags);
+ return Task::archiveSize() + sizeof(TaskID) + sizeof(_flags);
}
void GoAwayFromTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
Task::write(out);
- // Store the subTask's ID
- if (goTask != nullptr)
- out->writeSint16LE(getTaskID(goTask));
+ // Store the _subTask's ID
+ if (_goTask != nullptr)
+ out->writeSint16LE(getTaskID(_goTask));
else
out->writeSint16LE(NoTask);
// Store the flags
- out->writeByte(flags);
+ out->writeByte(_flags);
}
//----------------------------------------------------------------------
// Abort this task
void GoAwayFromTask::abortTask() {
- if (goTask != nullptr) {
- goTask->abortTask();
- delete goTask;
- goTask = nullptr;
+ if (_goTask != nullptr) {
+ _goTask->abortTask();
+ delete _goTask;
+ _goTask = nullptr;
}
}
@@ -1727,7 +1729,7 @@ TaskResult GoAwayFromTask::update() {
TilePoint(64, 0, 0),
};
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
TilePoint actorLoc = a->getLocation(),
repulsionVector = getRepulsionVector(),
dest;
@@ -1741,17 +1743,17 @@ TaskResult GoAwayFromTask::update() {
} else
dest = actorLoc + dirTable_[a->_currentFacing];
- if (goTask != nullptr) {
- if (goTask->getTarget() != dest)
- goTask->changeTarget(dest);
+ if (_goTask != nullptr) {
+ if (_goTask->getTarget() != dest)
+ _goTask->changeTarget(dest);
- goTask->update();
+ _goTask->update();
} else {
- if ((goTask = flags & run
- ? new GotoLocationTask(stack, dest, 0)
- : new GotoLocationTask(stack, dest))
+ if ((_goTask = _flags & run
+ ? new GotoLocationTask(_stack, dest, 0)
+ : new GotoLocationTask(_stack, dest))
!= nullptr)
- goTask->update();
+ _goTask->update();
}
return taskNotDone;
@@ -1769,7 +1771,7 @@ GoAwayFromObjectTask::GoAwayFromObjectTask(Common::InSaveFile *in, TaskID id) :
ObjectID objectID = in->readUint16LE();
// Convert the ID to an object pointer
- obj = objectID != Nothing
+ _obj = objectID != Nothing
? GameObject::objectAddress(objectID)
: nullptr;
}
@@ -1789,8 +1791,8 @@ void GoAwayFromObjectTask::write(Common::MemoryWriteStreamDynamic *out) const {
GoAwayFromTask::write(out);
// Store the object's ID
- if (obj != nullptr)
- out->writeUint16LE(obj->thisID());
+ if (_obj != nullptr)
+ out->writeUint16LE(_obj->thisID());
else
out->writeUint16LE(Nothing);
}
@@ -1810,14 +1812,14 @@ bool GoAwayFromObjectTask::operator == (const Task &t) const {
const GoAwayFromObjectTask *taskPtr = (const GoAwayFromObjectTask *)&t;
- return obj == taskPtr->obj;
+ return _obj == taskPtr->_obj;
}
//----------------------------------------------------------------------
// Simply return the object's location
TilePoint GoAwayFromObjectTask::getRepulsionVector() {
- return stack->getActor()->getLocation() - obj->getLocation();
+ return _stack->getActor()->getLocation() - _obj->getLocation();
}
/* ===================================================================== *
@@ -1833,7 +1835,7 @@ GoAwayFromActorTask::GoAwayFromActorTask(
bool runFlag) :
GoAwayFromTask(ts, runFlag) {
debugC(2, kDebugTasks, " - GoAwayFromActorTask1");
- SpecificActorTarget(a).clone(targetMem);
+ SpecificActorTarget(a).clone(_targetMem);
}
GoAwayFromActorTask::GoAwayFromActorTask(
@@ -1841,10 +1843,10 @@ GoAwayFromActorTask::GoAwayFromActorTask(
const ActorTarget &at,
bool runFlag) :
GoAwayFromTask(ts, runFlag) {
- assert(at.size() <= sizeof(targetMem));
+ assert(at.size() <= sizeof(_targetMem));
debugC(2, kDebugTasks, " - GoAwayFromActorTask2");
// Copy the target to the target buffer
- at.clone(targetMem);
+ at.clone(_targetMem);
}
@@ -1852,7 +1854,7 @@ GoAwayFromActorTask::GoAwayFromActorTask(Common::InSaveFile *in, TaskID id) : Go
debugC(3, kDebugSaveload, "... Loading GoAwayFromActorTask");
// Restore the target
- readTarget(targetMem, in);
+ readTarget(_targetMem, in);
}
//----------------------------------------------------------------------
@@ -1894,7 +1896,7 @@ bool GoAwayFromActorTask::operator == (const Task &t) const {
//----------------------------------------------------------------------
TilePoint GoAwayFromActorTask::getRepulsionVector() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
TilePoint actorLoc = a->getLocation(),
repulsionVector;
int16 i;
@@ -1927,11 +1929,11 @@ TilePoint GoAwayFromActorTask::getRepulsionVector() {
HuntTask::HuntTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
// Restore the flags
- huntFlags = in->readByte();
- subTask = nullptr;
+ _huntFlags = in->readByte();
+ _subTask = nullptr;
// If the flags say we have a sub task, restore it too
- if (huntFlags & (huntGoto | huntWander))
+ if (_huntFlags & (huntGoto | huntWander))
_subTaskID = in->readSint16LE();
else
_subTaskID = NoTask;
@@ -1944,10 +1946,10 @@ void HuntTask::fixup( void ) {
// Let the base class fixup its pointers
Task::fixup();
- if (huntFlags & (huntGoto | huntWander))
- subTask = getTaskAddress(_subTaskID);
+ if (_huntFlags & (huntGoto | huntWander))
+ _subTask = getTaskAddress(_subTaskID);
else
- subTask = nullptr;
+ _subTask = nullptr;
}
//----------------------------------------------------------------------
@@ -1957,8 +1959,8 @@ void HuntTask::fixup( void ) {
inline int32 HuntTask::archiveSize() const {
int32 size = 0;
- size += Task::archiveSize() + sizeof(huntFlags);
- if (huntFlags & (huntGoto | huntWander)) size += sizeof(TaskID);
+ size += Task::archiveSize() + sizeof(_huntFlags);
+ if (_huntFlags & (huntGoto | huntWander)) size += sizeof(TaskID);
return size;
}
@@ -1968,19 +1970,19 @@ void HuntTask::write(Common::MemoryWriteStreamDynamic *out) const {
Task::write(out);
// Store the flags
- out->writeByte(huntFlags);
+ out->writeByte(_huntFlags);
// If the flags say we have a sub task, store it too
- if (huntFlags & (huntGoto | huntWander))
- out->writeSint16LE(getTaskID(subTask));
+ if (_huntFlags & (huntGoto | huntWander))
+ out->writeSint16LE(getTaskID(_subTask));
}
//----------------------------------------------------------------------
void HuntTask::abortTask() {
- if (huntFlags & (huntWander | huntGoto)) {
- subTask->abortTask();
- delete subTask;
+ if (_huntFlags & (huntWander | huntGoto)) {
+ _subTask->abortTask();
+ delete _subTask;
}
// If we've reached the target call the atTargetabortTask() function
@@ -1992,9 +1994,9 @@ void HuntTask::abortTask() {
TaskResult HuntTask::evaluate() {
if (atTarget()) {
// If we've reached the target abort any sub tasks
- if (huntFlags & huntWander)
+ if (_huntFlags & huntWander)
removeWanderTask();
- else if (huntFlags & huntGoto)
+ else if (_huntFlags & huntGoto)
removeGotoTask();
return atTargetEvaluate();
@@ -2006,7 +2008,7 @@ TaskResult HuntTask::evaluate() {
//----------------------------------------------------------------------
TaskResult HuntTask::update() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
if (a->_moveTask && a->_moveTask->isPrivledged()) return taskNotDone;
@@ -2016,41 +2018,41 @@ TaskResult HuntTask::update() {
// Determine if we have reached the target
if (atTarget()) {
// If we've reached the target abort any sub tasks
- if (huntFlags & huntWander)
+ if (_huntFlags & huntWander)
removeWanderTask();
- else if (huntFlags & huntGoto)
+ else if (_huntFlags & huntGoto)
removeGotoTask();
return atTargetUpdate();
} else {
// If we are going to a target, determine if the goto task
// is still valid. If not, abort it.
- if ((huntFlags & huntGoto)
- && targetHasChanged((GotoTask *)subTask))
+ if ((_huntFlags & huntGoto)
+ && targetHasChanged((GotoTask *)_subTask))
removeGotoTask();
// Determine if there is a goto subtask
- if (!(huntFlags & huntGoto)) {
+ if (!(_huntFlags & huntGoto)) {
GotoTask *gotoResult;
// Try to set up a goto subtask
if ((gotoResult = setupGoto()) != nullptr) {
- if (huntFlags & huntWander) removeWanderTask();
+ if (_huntFlags & huntWander) removeWanderTask();
- subTask = gotoResult;
- huntFlags |= huntGoto;
+ _subTask = gotoResult;
+ _huntFlags |= huntGoto;
} else {
// If we couldn't setup a goto task, setup a wander task
- if (!(huntFlags & huntWander)) {
- if ((subTask = new WanderTask(stack)) != nullptr)
- huntFlags |= huntWander;
+ if (!(_huntFlags & huntWander)) {
+ if ((_subTask = new WanderTask(_stack)) != nullptr)
+ _huntFlags |= huntWander;
}
}
}
// If there is a subtask, update it
- if ((huntFlags & (huntGoto | huntWander)) && subTask)
- subTask->update();
+ if ((_huntFlags & (huntGoto | huntWander)) && _subTask)
+ _subTask->update();
// If we're not at the target, we know the hunt task is not
// done
@@ -2061,18 +2063,18 @@ TaskResult HuntTask::update() {
//----------------------------------------------------------------------
void HuntTask::removeWanderTask() {
- subTask->abortTask();
- delete subTask;
- huntFlags &= ~huntWander;
+ _subTask->abortTask();
+ delete _subTask;
+ _huntFlags &= ~huntWander;
}
//----------------------------------------------------------------------
void HuntTask::removeGotoTask() {
- subTask->abortTask();
- delete subTask;
- subTask = nullptr;
- huntFlags &= ~huntGoto;
+ _subTask->abortTask();
+ delete _subTask;
+ _subTask = nullptr;
+ _huntFlags &= ~huntGoto;
}
/* ===================================================================== *
@@ -2084,19 +2086,19 @@ void HuntTask::removeGotoTask() {
HuntLocationTask::HuntLocationTask(TaskStack *ts, const Target &t) :
HuntTask(ts),
- currentTarget(Nowhere) {
- assert(t.size() <= sizeof(targetMem));
+ _currentTarget(Nowhere) {
+ assert(t.size() <= sizeof(_targetMem));
debugC(2, kDebugTasks, " - HuntLocationTask");
// Copy the target to the target buffer
- t.clone(targetMem);
+ t.clone(_targetMem);
}
HuntLocationTask::HuntLocationTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
- // Restore the currentTarget location
- currentTarget.load(in);
+ // Restore the _currentTarget location
+ _currentTarget.load(in);
// Restore the target
- readTarget(targetMem, in);
+ readTarget(_targetMem, in);
}
//----------------------------------------------------------------------
@@ -2105,7 +2107,7 @@ HuntLocationTask::HuntLocationTask(Common::InSaveFile *in, TaskID id) : HuntTask
inline int32 HuntLocationTask::archiveSize() const {
return HuntTask::archiveSize()
- + sizeof(currentTarget)
+ + sizeof(_currentTarget)
+ targetArchiveSize(getTarget());
}
@@ -2114,7 +2116,7 @@ void HuntLocationTask::write(Common::MemoryWriteStreamDynamic *out) const {
HuntTask::write(out);
// Store the current target location
- currentTarget.write(out);
+ _currentTarget.write(out);
// Store the target
writeTarget(getTarget(), out);
@@ -2126,22 +2128,22 @@ bool HuntLocationTask::targetHasChanged(GotoTask *gotoTarget) {
// Determine if the specified goto task is going to the current
// target.
GotoLocationTask *gotoLoc = (GotoLocationTask *)gotoTarget;
- return gotoLoc->getTarget() != currentTarget;
+ return gotoLoc->getTarget() != _currentTarget;
}
//----------------------------------------------------------------------
GotoTask *HuntLocationTask::setupGoto() {
// If there is somewhere to go, setup a goto task, else return NULL
- return currentTarget != Nowhere
- ? new GotoLocationTask(stack, currentTarget)
+ return _currentTarget != Nowhere
+ ? new GotoLocationTask(_stack, _currentTarget)
: nullptr;
}
//----------------------------------------------------------------------
TilePoint HuntLocationTask::currentTargetLoc() {
- return currentTarget;
+ return _currentTarget;
}
/* ===================================================================== *
@@ -2153,10 +2155,10 @@ HuntToBeNearLocationTask::HuntToBeNearLocationTask(Common::InSaveFile *in, TaskI
debugC(3, kDebugSaveload, "... Loading HuntToBeNearLocationTask");
// Restore the range
- range = in->readUint16LE();
+ _range = in->readUint16LE();
- // Restore the evaluation counter
- targetEvaluateCtr = in->readByte();
+ // Restore the evaluation _counter
+ _targetEvaluateCtr = in->readByte();
}
//----------------------------------------------------------------------
@@ -2165,8 +2167,8 @@ HuntToBeNearLocationTask::HuntToBeNearLocationTask(Common::InSaveFile *in, TaskI
inline int32 HuntToBeNearLocationTask::archiveSize() const {
return HuntLocationTask::archiveSize()
- + sizeof(range)
- + sizeof(targetEvaluateCtr);
+ + sizeof(_range)
+ + sizeof(_targetEvaluateCtr);
}
void HuntToBeNearLocationTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -2176,10 +2178,10 @@ void HuntToBeNearLocationTask::write(Common::MemoryWriteStreamDynamic *out) cons
HuntLocationTask::write(out);
// Store the range
- out->writeUint16LE(range);
+ out->writeUint16LE(_range);
- // Store the evaluation counter
- out->writeByte(targetEvaluateCtr);
+ // Store the evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
}
//----------------------------------------------------------------------
@@ -2198,7 +2200,7 @@ bool HuntToBeNearLocationTask::operator == (const Task &t) const {
const HuntToBeNearLocationTask *taskPtr = (const HuntToBeNearLocationTask *)&t;
return *getTarget() == *taskPtr->getTarget()
- && range == taskPtr->range;
+ && _range == taskPtr->_range;
}
//----------------------------------------------------------------------
@@ -2206,25 +2208,25 @@ bool HuntToBeNearLocationTask::operator == (const Task &t) const {
void HuntToBeNearLocationTask::evaluateTarget() {
// If its time to reevaluate the target, simply get the nearest
// target location from the LocationTarget
- if (targetEvaluateCtr == 0) {
- Actor *a = stack->getActor();
+ if (_targetEvaluateCtr == 0) {
+ Actor *a = _stack->getActor();
- currentTarget =
+ _currentTarget =
getTarget()->where(a->world(), a->getLocation());
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- targetEvaluateCtr--;
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
bool HuntToBeNearLocationTask::atTarget() {
- TilePoint targetLoc = currentTargetLoc();
+ TilePoint _targetLoc = currentTargetLoc();
// Determine if we are within the specified range of the target
- return targetLoc != Nowhere
- && stack->getActor()->inRange(targetLoc, range);
+ return _targetLoc != Nowhere
+ && _stack->getActor()->inRange(_targetLoc, _range);
}
//----------------------------------------------------------------------
@@ -2254,24 +2256,24 @@ TaskResult HuntToBeNearLocationTask::atTargetUpdate() {
HuntObjectTask::HuntObjectTask(TaskStack *ts, const ObjectTarget &ot) :
HuntTask(ts),
- currentTarget(nullptr) {
- assert(ot.size() <= sizeof(targetMem));
+ _currentTarget(nullptr) {
+ assert(ot.size() <= sizeof(_targetMem));
debugC(2, kDebugTasks, " - HuntObjectTask");
// Copy the target to the target buffer
- ot.clone(targetMem);
+ ot.clone(_targetMem);
}
HuntObjectTask::HuntObjectTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
// Restore the current target ID
- ObjectID currentTargetID = in->readUint16LE();
+ ObjectID _currentTargetID = in->readUint16LE();
// Convert the ID to a GameObject pointer
- currentTarget = currentTargetID != Nothing
- ? GameObject::objectAddress(currentTargetID)
+ _currentTarget = _currentTargetID != Nothing
+ ? GameObject::objectAddress(_currentTargetID)
: nullptr;
// Reconstruct the object target
- readTarget(targetMem, in);
+ readTarget(_targetMem, in);
}
//----------------------------------------------------------------------
@@ -2289,8 +2291,8 @@ void HuntObjectTask::write(Common::MemoryWriteStreamDynamic *out) const {
HuntTask::write(out);
// Store the ID
- if (currentTarget != nullptr)
- out->writeByte(currentTarget->thisID());
+ if (_currentTarget != nullptr)
+ out->writeByte(_currentTarget->thisID());
else
out->writeByte(Nothing);
@@ -2304,7 +2306,7 @@ bool HuntObjectTask::targetHasChanged(GotoTask *gotoTarget) {
// Determine if the specified goto task's destination is the
// current target object
GotoObjectTask *gotoObj = (GotoObjectTask *)gotoTarget;
- return gotoObj->getTarget() != currentTarget;
+ return gotoObj->getTarget() != _currentTarget;
}
//----------------------------------------------------------------------
@@ -2312,8 +2314,8 @@ bool HuntObjectTask::targetHasChanged(GotoTask *gotoTarget) {
GotoTask *HuntObjectTask::setupGoto() {
// If there is an object to goto, setup a GotoObjectTask, else
// return NULL
- return currentTarget
- ? new GotoObjectTask(stack, currentTarget)
+ return _currentTarget
+ ? new GotoObjectTask(_stack, _currentTarget)
: nullptr;
}
@@ -2322,7 +2324,7 @@ GotoTask *HuntObjectTask::setupGoto() {
TilePoint HuntObjectTask::currentTargetLoc() {
// If there is a current target object, return its locatio, else
// return Nowhere
- return currentTarget ? currentTarget->getLocation() : Nowhere;
+ return _currentTarget ? _currentTarget->getLocation() : Nowhere;
}
/* ===================================================================== *
@@ -2334,10 +2336,10 @@ HuntToBeNearObjectTask::HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id
debugC(3, kDebugSaveload, "... Loading HuntToBeNearObjectTask");
// Restore the range
- range = in->readUint16LE();
+ _range = in->readUint16LE();
- // Restore the evaluation counter
- targetEvaluateCtr = in->readByte();
+ // Restore the evaluation _counter
+ _targetEvaluateCtr = in->readByte();
}
//----------------------------------------------------------------------
@@ -2346,8 +2348,8 @@ HuntToBeNearObjectTask::HuntToBeNearObjectTask(Common::InSaveFile *in, TaskID id
inline int32 HuntToBeNearObjectTask::archiveSize() const {
return HuntObjectTask::archiveSize()
- + sizeof(range)
- + sizeof(targetEvaluateCtr);
+ + sizeof(_range)
+ + sizeof(_targetEvaluateCtr);
}
void HuntToBeNearObjectTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -2357,10 +2359,10 @@ void HuntToBeNearObjectTask::write(Common::MemoryWriteStreamDynamic *out) const
HuntObjectTask::write(out);
// Store the range
- out->writeUint16LE(range);
+ out->writeUint16LE(_range);
- // Store the evaluation counter
- out->writeByte(targetEvaluateCtr);
+ // Store the evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
}
//----------------------------------------------------------------------
@@ -2379,15 +2381,15 @@ bool HuntToBeNearObjectTask::operator == (const Task &t) const {
const HuntToBeNearObjectTask *taskPtr = (const HuntToBeNearObjectTask *)&t;
return *getTarget() == *taskPtr->getTarget()
- && range == taskPtr->range;
+ && _range == taskPtr->_range;
}
//----------------------------------------------------------------------
void HuntToBeNearObjectTask::evaluateTarget() {
// Determine if it is time to reevaluate the target object
- if (targetEvaluateCtr == 0) {
- Actor *a = stack->getActor();
+ if (_targetEvaluateCtr == 0) {
+ Actor *a = _stack->getActor();
int16 i;
GameObject *objArray[16];
int16 distArray[ARRAYSIZE(objArray)];
@@ -2413,27 +2415,27 @@ void HuntToBeNearObjectTask::evaluateTarget() {
info,
maxSenseRange,
objID)) {
- currentTarget = objArray[i];
+ _currentTarget = objArray[i];
break;
}
}
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- // Decrement the target reevaluate counter
- targetEvaluateCtr--;
+ // Decrement the target reevaluate _counter
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
bool HuntToBeNearObjectTask::atTarget() {
- TilePoint targetLoc = currentTargetLoc();
+ TilePoint _targetLoc = currentTargetLoc();
// Determine if we are within the specified range of the current
// target
- return targetLoc != Nowhere
- && stack->getActor()->inRange(targetLoc, range);
+ return _targetLoc != Nowhere
+ && _stack->getActor()->inRange(_targetLoc, _range);
}
//----------------------------------------------------------------------
@@ -2463,11 +2465,11 @@ TaskResult HuntToBeNearObjectTask::atTargetUpdate() {
HuntToPossessTask::HuntToPossessTask(Common::InSaveFile *in, TaskID id) : HuntObjectTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToPossessTask");
- // Restore evaluation counter
- targetEvaluateCtr = in->readByte();
+ // Restore evaluation _counter
+ _targetEvaluateCtr = in->readByte();
// Restore grab flag
- grabFlag = in->readUint16LE();
+ _grabFlag = in->readUint16LE();
}
//----------------------------------------------------------------------
@@ -2476,8 +2478,8 @@ HuntToPossessTask::HuntToPossessTask(Common::InSaveFile *in, TaskID id) : HuntOb
inline int32 HuntToPossessTask::archiveSize() const {
return HuntObjectTask::archiveSize()
- + sizeof(targetEvaluateCtr)
- + sizeof(grabFlag);
+ + sizeof(_targetEvaluateCtr)
+ + sizeof(_grabFlag);
}
void HuntToPossessTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -2486,11 +2488,11 @@ void HuntToPossessTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
HuntObjectTask::write(out);
- // Store the evaluation counter
- out->writeByte(targetEvaluateCtr);
+ // Store the evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
// Store the grab flag
- out->writeUint16LE(grabFlag);
+ out->writeUint16LE(_grabFlag);
}
//----------------------------------------------------------------------
@@ -2515,8 +2517,8 @@ bool HuntToPossessTask::operator == (const Task &t) const {
void HuntToPossessTask::evaluateTarget() {
// Determine if it is time to reevaluate the target object
- if (targetEvaluateCtr == 0) {
- Actor *a = stack->getActor();
+ if (_targetEvaluateCtr == 0) {
+ Actor *a = _stack->getActor();
int16 i;
GameObject *objArray[16];
int16 distArray[ARRAYSIZE(objArray)];
@@ -2542,27 +2544,27 @@ void HuntToPossessTask::evaluateTarget() {
info,
maxSenseRange,
objID)) {
- currentTarget = objArray[i];
+ _currentTarget = objArray[i];
break;
}
}
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- // Decrement the target reevaluate counter
- targetEvaluateCtr--;
+ // Decrement the target reevaluate _counter
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
bool HuntToPossessTask::atTarget() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
- return currentTarget
- && (a->inReach(currentTarget->getLocation())
- || (grabFlag
- && a->isContaining(currentTarget)));
+ return _currentTarget
+ && (a->inReach(_currentTarget->getLocation())
+ || (_grabFlag
+ && a->isContaining(_currentTarget)));
}
//----------------------------------------------------------------------
@@ -2572,7 +2574,7 @@ void HuntToPossessTask::atTargetabortTask() {}
//----------------------------------------------------------------------
TaskResult HuntToPossessTask::atTargetEvaluate() {
- if (currentTarget && stack->getActor()->isContaining(currentTarget))
+ if (_currentTarget && _stack->getActor()->isContaining(_currentTarget))
return taskSucceeded;
return taskNotDone;
@@ -2597,28 +2599,28 @@ HuntActorTask::HuntActorTask(
const ActorTarget &at,
bool trackFlag) :
HuntTask(ts),
- flags(trackFlag ? track : 0),
- currentTarget(nullptr) {
- assert(at.size() <= sizeof(targetMem));
+ _flags(trackFlag ? track : 0),
+ _currentTarget(nullptr) {
+ assert(at.size() <= sizeof(_targetMem));
debugC(2, kDebugTasks, " - HuntActorTask");
// Copy the target to the target buffer
- at.clone(targetMem);
+ at.clone(_targetMem);
}
HuntActorTask::HuntActorTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
// Restore the flags
- flags = in->readByte();
+ _flags = in->readByte();
// Restore the current target ID
- ObjectID currentTargetID = in->readUint16LE();
+ ObjectID _currentTargetID = in->readUint16LE();
// Convert the ID to a GameObject pointer
- currentTarget = currentTargetID != Nothing
- ? (Actor *)GameObject::objectAddress(currentTargetID)
+ _currentTarget = _currentTargetID != Nothing
+ ? (Actor *)GameObject::objectAddress(_currentTargetID)
: nullptr;
// Reconstruct the object target
- readTarget(targetMem, in);
+ readTarget(_targetMem, in);
}
//----------------------------------------------------------------------
@@ -2627,7 +2629,7 @@ HuntActorTask::HuntActorTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, i
inline int32 HuntActorTask::archiveSize() const {
return HuntTask::archiveSize()
- + sizeof(flags)
+ + sizeof(_flags)
+ sizeof(ObjectID)
+ targetArchiveSize(getTarget());
}
@@ -2637,11 +2639,11 @@ void HuntActorTask::write(Common::MemoryWriteStreamDynamic *out) const {
HuntTask::write(out);
// Store the flags
- out->writeByte(flags);
+ out->writeByte(_flags);
// Store the ID
- if (currentTarget != nullptr)
- out->writeUint16LE(currentTarget->thisID());
+ if (_currentTarget != nullptr)
+ out->writeUint16LE(_currentTarget->thisID());
else
out->writeUint16LE(Nothing);
@@ -2655,7 +2657,7 @@ bool HuntActorTask::targetHasChanged(GotoTask *gotoTarget) {
// Determine if the specified goto task's destination is the
// current target actor
GotoActorTask *gotoActor = (GotoActorTask *)gotoTarget;
- return gotoActor->getTarget() != currentTarget;
+ return gotoActor->getTarget() != _currentTarget;
}
//----------------------------------------------------------------------
@@ -2663,15 +2665,15 @@ bool HuntActorTask::targetHasChanged(GotoTask *gotoTarget) {
GotoTask *HuntActorTask::setupGoto() {
// If there is an actor to goto, setup a GotoActorTask, else
// return NULL
- /* return currentTarget
- ? new GotoActorTask( stack, currentTarget, flags & track )
+ /* return _currentTarget
+ ? new GotoActorTask( stack, _currentTarget, flags & track )
: NULL;
*/
- if (currentTarget != nullptr) {
+ if (_currentTarget != nullptr) {
return new GotoActorTask(
- stack,
- currentTarget,
- flags & track);
+ _stack,
+ _currentTarget,
+ _flags & track);
}
return nullptr;
@@ -2682,7 +2684,7 @@ GotoTask *HuntActorTask::setupGoto() {
TilePoint HuntActorTask::currentTargetLoc() {
// If there is a current target actor, return its location, else
// return Nowhere
- return currentTarget ? currentTarget->getLocation() : Nowhere;
+ return _currentTarget ? _currentTarget->getLocation() : Nowhere;
}
/* ===================================================================== *
@@ -2693,15 +2695,15 @@ HuntToBeNearActorTask::HuntToBeNearActorTask(Common::InSaveFile *in, TaskID id)
HuntActorTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToBeNearActorTask");
- // Get the goAway task ID
+ // Get the _goAway task ID
_goAwayID = in->readSint16LE();
- goAway = nullptr;
+ _goAway = nullptr;
// Restore the range
- range = in->readUint16LE();
+ _range = in->readUint16LE();
- // Restore the evaluation counter
- targetEvaluateCtr = in->readByte();
+ // Restore the evaluation _counter
+ _targetEvaluateCtr = in->readByte();
}
//----------------------------------------------------------------------
@@ -2712,7 +2714,7 @@ void HuntToBeNearActorTask::fixup() {
HuntActorTask::fixup();
// Convert the task ID to a task pointer
- goAway = _goAwayID != NoTask
+ _goAway = _goAwayID != NoTask
? (GoAwayFromObjectTask *)getTaskAddress(_goAwayID)
: nullptr;
}
@@ -2723,9 +2725,9 @@ void HuntToBeNearActorTask::fixup() {
inline int32 HuntToBeNearActorTask::archiveSize() const {
return HuntActorTask::archiveSize()
- + sizeof(TaskID) // goAway ID
- + sizeof(range)
- + sizeof(targetEvaluateCtr);
+ + sizeof(TaskID) // _goAway ID
+ + sizeof(_range)
+ + sizeof(_targetEvaluateCtr);
}
void HuntToBeNearActorTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -2735,16 +2737,16 @@ void HuntToBeNearActorTask::write(Common::MemoryWriteStreamDynamic *out) const {
HuntActorTask::write(out);
// Store the task ID
- if (goAway != nullptr)
- out->writeSint16LE(getTaskID(goAway));
+ if (_goAway != nullptr)
+ out->writeSint16LE(getTaskID(_goAway));
else
out->writeSint16LE(NoTask);
// Store the range
- out->writeUint16LE(range);
+ out->writeUint16LE(_range);
- // Store the evaluation counter
- out->writeByte(targetEvaluateCtr);
+ // Store the evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
}
//----------------------------------------------------------------------
@@ -2764,21 +2766,21 @@ bool HuntToBeNearActorTask::operator == (const Task &t) const {
return *getTarget() == *taskPtr->getTarget()
&& tracking() ? taskPtr->tracking() : !taskPtr->tracking()
- && range == taskPtr->range;
+ && _range == taskPtr->_range;
}
//----------------------------------------------------------------------
void HuntToBeNearActorTask::evaluateTarget() {
// Determine if its time to reevaluate the current target actor
- if (targetEvaluateCtr == 0) {
- Actor *a = stack->getActor();
+ if (_targetEvaluateCtr == 0) {
+ Actor *a = _stack->getActor();
int16 i;
- Actor *actorArray[16];
- int16 distArray[ARRAYSIZE(actorArray)];
+ Actor *_actorArray[16];
+ int16 distArray[ARRAYSIZE(_actorArray)];
TargetActorArray taa(
- ARRAYSIZE(actorArray),
- actorArray,
+ ARRAYSIZE(_actorArray),
+ _actorArray,
distArray);
SenseInfo info;
@@ -2792,25 +2794,25 @@ void HuntToBeNearActorTask::evaluateTarget() {
|| a->canSenseSpecificActor(
info,
maxSenseRange,
- actorArray[i])
+ _actorArray[i])
|| a->canSenseSpecificActorIndirectly(
info,
maxSenseRange,
- actorArray[i])) {
- if (currentTarget != actorArray[i]) {
+ _actorArray[i])) {
+ if (_currentTarget != _actorArray[i]) {
if (atTarget()) atTargetabortTask();
- currentTarget = actorArray[i];
+ _currentTarget = _actorArray[i];
}
break;
}
}
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- // Decrement the target reevaluation counter.
- targetEvaluateCtr--;
+ // Decrement the target reevaluation _counter.
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
@@ -2821,13 +2823,13 @@ bool HuntToBeNearActorTask::atTarget() {
// Determine if we're within the specified range of the current
// target actor
if (targetLoc != Nowhere
- && stack->getActor()->inRange(targetLoc, range))
+ && _stack->getActor()->inRange(targetLoc, _range))
return true;
else {
- if (goAway != nullptr) {
- goAway->abortTask();
- delete goAway;
- goAway = nullptr;
+ if (_goAway != nullptr) {
+ _goAway->abortTask();
+ delete _goAway;
+ _goAway = nullptr;
}
return false;
@@ -2837,26 +2839,26 @@ bool HuntToBeNearActorTask::atTarget() {
//----------------------------------------------------------------------
void HuntToBeNearActorTask::atTargetabortTask() {
- if (goAway != nullptr) {
- goAway->abortTask();
- delete goAway;
- goAway = nullptr;
+ if (_goAway != nullptr) {
+ _goAway->abortTask();
+ delete _goAway;
+ _goAway = nullptr;
}
}
//----------------------------------------------------------------------
TaskResult HuntToBeNearActorTask::atTargetEvaluate() {
- TilePoint targetLoc = currentTargetLoc();
+ TilePoint _targetLoc = currentTargetLoc();
// If we're not TOO close, we're done
- if (stack->getActor()->inRange(targetLoc, tooClose))
+ if (_stack->getActor()->inRange(_targetLoc, tooClose))
return taskNotDone;
- if (goAway != nullptr) {
- goAway->abortTask();
- delete goAway;
- goAway = nullptr;
+ if (_goAway != nullptr) {
+ _goAway->abortTask();
+ delete _goAway;
+ _goAway = nullptr;
}
return taskSucceeded;
@@ -2865,26 +2867,26 @@ TaskResult HuntToBeNearActorTask::atTargetEvaluate() {
//----------------------------------------------------------------------
TaskResult HuntToBeNearActorTask::atTargetUpdate() {
- Actor *a = stack->getActor();
- TilePoint targetLoc = currentTargetLoc();
+ Actor *a = _stack->getActor();
+ TilePoint _targetLoc = currentTargetLoc();
// Determine if we're TOO close
- if (a->inRange(targetLoc, tooClose)) {
+ if (a->inRange(_targetLoc, tooClose)) {
// Setup a go away task if necessary and update it
- if (goAway == nullptr) {
- goAway = new GoAwayFromObjectTask(stack, currentTarget);
- if (goAway != nullptr) goAway->update();
+ if (_goAway == nullptr) {
+ _goAway = new GoAwayFromObjectTask(_stack, _currentTarget);
+ if (_goAway != nullptr) _goAway->update();
} else
- goAway->update();
+ _goAway->update();
return taskNotDone;
}
// Delete the go away task if it exists
- if (goAway != nullptr) {
- goAway->abortTask();
- delete goAway;
- goAway = nullptr;
+ if (_goAway != nullptr) {
+ _goAway->abortTask();
+ delete _goAway;
+ _goAway = nullptr;
}
return taskSucceeded;
@@ -2902,14 +2904,14 @@ HuntToKillTask::HuntToKillTask(
const ActorTarget &at,
bool trackFlag) :
HuntActorTask(ts, at, trackFlag),
- targetEvaluateCtr(0),
- specialAttackCtr(10),
- flags(evalWeapon) {
+ _targetEvaluateCtr(0),
+ _specialAttackCtr(10),
+ _flags(evalWeapon) {
debugC(2, kDebugTasks, " - HuntToKillTask");
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
if (isActor(a->_currentTarget))
- currentTarget = (Actor *)a->_currentTarget;
+ _currentTarget = (Actor *)a->_currentTarget;
a->setFightStance(true);
}
@@ -2917,10 +2919,10 @@ HuntToKillTask::HuntToKillTask(
HuntToKillTask::HuntToKillTask(Common::InSaveFile *in, TaskID id) : HuntActorTask(in, id) {
debugC(3, kDebugSaveload, "... Loading HuntToKillTask");
- // Restore the evaluation counter
- targetEvaluateCtr = in->readByte();
- specialAttackCtr = in->readByte();
- flags = in->readByte();
+ // Restore the evaluation _counter
+ _targetEvaluateCtr = in->readByte();
+ _specialAttackCtr = in->readByte();
+ _flags = in->readByte();
}
//----------------------------------------------------------------------
@@ -2929,9 +2931,9 @@ HuntToKillTask::HuntToKillTask(Common::InSaveFile *in, TaskID id) : HuntActorTas
inline int32 HuntToKillTask::archiveSize() const {
return HuntActorTask::archiveSize()
- + sizeof(targetEvaluateCtr)
- + sizeof(specialAttackCtr)
- + sizeof(flags);
+ + sizeof(_targetEvaluateCtr)
+ + sizeof(_specialAttackCtr)
+ + sizeof(_flags);
}
void HuntToKillTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -2940,10 +2942,10 @@ void HuntToKillTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
HuntActorTask::write(out);
- // Store the evaluation counter
- out->writeByte(targetEvaluateCtr);
- out->writeByte(specialAttackCtr);
- out->writeByte(flags);
+ // Store the evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
+ out->writeByte(_specialAttackCtr);
+ out->writeByte(_flags);
}
//----------------------------------------------------------------------
@@ -2970,7 +2972,7 @@ bool HuntToKillTask::operator == (const Task &t) const {
void HuntToKillTask::abortTask() {
HuntActorTask::abortTask();
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
a->_flags &= ~Actor::specialAttack;
@@ -2980,14 +2982,14 @@ void HuntToKillTask::abortTask() {
//----------------------------------------------------------------------
TaskResult HuntToKillTask::update() {
- if (specialAttackCtr == 0) {
- stack->getActor()->_flags |= Actor::specialAttack;
+ if (_specialAttackCtr == 0) {
+ _stack->getActor()->_flags |= Actor::specialAttack;
// A little hack to make monsters with 99 spellcraft cast spells more often
- if (stack->getActor()->getStats()->spellcraft >= 99)
- specialAttackCtr = 3;
- else specialAttackCtr = 10;
+ if (_stack->getActor()->getStats()->spellcraft >= 99)
+ _specialAttackCtr = 3;
+ else _specialAttackCtr = 10;
} else
- specialAttackCtr--;
+ _specialAttackCtr--;
return HuntActorTask::update();
}
@@ -2995,26 +2997,26 @@ TaskResult HuntToKillTask::update() {
//----------------------------------------------------------------------
void HuntToKillTask::evaluateTarget() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
- if (flags & evalWeapon && a->isInterruptable()) {
+ if (_flags & evalWeapon && a->isInterruptable()) {
evaluateWeapon();
- flags &= ~evalWeapon;
+ _flags &= ~evalWeapon;
}
// Determine if its time to reevaluate the current target actor
- if (targetEvaluateCtr == 0
- || (currentTarget != nullptr
- && currentTarget->isDead())) {
+ if (_targetEvaluateCtr == 0
+ || (_currentTarget != nullptr
+ && _currentTarget->isDead())) {
Actor *bestTarget = nullptr;
ActorProto *proto = (ActorProto *)a->proto();
int16 i;
- Actor *actorArray[16];
- int16 distArray[ARRAYSIZE(actorArray)];
+ Actor *_actorArray[16];
+ int16 distArray[ARRAYSIZE(_actorArray)];
TargetActorArray taa(
- ARRAYSIZE(actorArray),
- actorArray,
+ ARRAYSIZE(_actorArray),
+ _actorArray,
distArray);
SenseInfo info;
@@ -3026,18 +3028,18 @@ void HuntToKillTask::evaluateTarget() {
// Iterate through each actor in the array and determine if
// there is a line of sight to that actor
for (i = 0; i < taa.actors; i++) {
- if (actorArray[i]->isDead()) continue;
+ if (_actorArray[i]->isDead()) continue;
if (tracking()
|| a->canSenseSpecificActor(
info,
maxSenseRange,
- actorArray[i])
+ _actorArray[i])
|| a->canSenseSpecificActorIndirectly(
info,
maxSenseRange,
- actorArray[i])) {
- bestTarget = actorArray[i];
+ _actorArray[i])) {
+ bestTarget = _actorArray[i];
break;
}
}
@@ -3047,25 +3049,25 @@ void HuntToKillTask::evaluateTarget() {
int16 bestScore = 0;
for (i = 0; i < taa.actors; i++) {
- if (actorArray[i]->isDead()) continue;
+ if (_actorArray[i]->isDead()) continue;
if (tracking()
|| a->canSenseSpecificActor(
info,
maxSenseRange,
- actorArray[i])
+ _actorArray[i])
|| a->canSenseSpecificActorIndirectly(
info,
maxSenseRange,
- actorArray[i])) {
+ _actorArray[i])) {
int16 score;
score = closenessScore(distArray[i]) * 16
- / actorArray[i]->defenseScore();
+ / _actorArray[i]->defenseScore();
if (score > bestScore || bestTarget == nullptr) {
bestScore = score;
- bestTarget = actorArray[i];
+ bestTarget = _actorArray[i];
}
}
}
@@ -3076,25 +3078,25 @@ void HuntToKillTask::evaluateTarget() {
int16 bestScore = 0;
for (i = 0; i < taa.actors; i++) {
- if (actorArray[i]->isDead()) continue;
+ if (_actorArray[i]->isDead()) continue;
if (tracking()
|| a->canSenseSpecificActor(
info,
maxSenseRange,
- actorArray[i])
+ _actorArray[i])
|| a->canSenseSpecificActorIndirectly(
info,
maxSenseRange,
- actorArray[i])) {
+ _actorArray[i])) {
int16 score;
score = closenessScore(distArray[i])
- * actorArray[i]->offenseScore();
+ * _actorArray[i]->offenseScore();
if (score > bestScore || bestTarget == nullptr) {
bestScore = score;
- bestTarget = actorArray[i];
+ bestTarget = _actorArray[i];
}
}
}
@@ -3105,26 +3107,26 @@ void HuntToKillTask::evaluateTarget() {
int16 bestScore = 0;
for (i = 0; i < taa.actors; i++) {
- if (actorArray[i]->isDead()) continue;
+ if (_actorArray[i]->isDead()) continue;
if (tracking()
|| a->canSenseSpecificActor(
info,
maxSenseRange,
- actorArray[i])
+ _actorArray[i])
|| a->canSenseSpecificActorIndirectly(
info,
maxSenseRange,
- actorArray[i])) {
+ _actorArray[i])) {
int16 score;
score = closenessScore(distArray[i])
- * actorArray[i]->offenseScore()
- / actorArray[i]->defenseScore();
+ * _actorArray[i]->offenseScore()
+ / _actorArray[i]->defenseScore();
if (score > bestScore || bestTarget == nullptr) {
bestScore = score;
- bestTarget = actorArray[i];
+ bestTarget = _actorArray[i];
}
}
}
@@ -3132,30 +3134,30 @@ void HuntToKillTask::evaluateTarget() {
break;
}
- if (bestTarget != currentTarget) {
+ if (bestTarget != _currentTarget) {
// If the current target has changed, abort any
// action currently taking place
if (atTarget()) atTargetabortTask();
- currentTarget = bestTarget;
- a->_currentTarget = currentTarget;
+ _currentTarget = bestTarget;
+ a->_currentTarget = _currentTarget;
}
- flags |= evalWeapon;
+ _flags |= evalWeapon;
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- // Decrement the target reevaluation counter
- targetEvaluateCtr--;
+ // Decrement the target reevaluation _counter
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
bool HuntToKillTask::atTarget() {
// Determine if we're in attack range of the current target
- return currentTarget != nullptr
- && stack->getActor()->inAttackRange(
- currentTarget->getLocation());
+ return _currentTarget != nullptr
+ && _stack->getActor()->inAttackRange(
+ _currentTarget->getLocation());
}
//----------------------------------------------------------------------
@@ -3163,7 +3165,7 @@ bool HuntToKillTask::atTarget() {
void HuntToKillTask::atTargetabortTask() {
// If the task is aborted while at the target actor, abort any
// attack currently taking place
- stack->getActor()->stopAttack(currentTarget);
+ _stack->getActor()->stopAttack(_currentTarget);
}
//----------------------------------------------------------------------
@@ -3176,14 +3178,14 @@ TaskResult HuntToKillTask::atTargetEvaluate() {
//----------------------------------------------------------------------
TaskResult HuntToKillTask::atTargetUpdate() {
- assert(isActor(currentTarget));
+ assert(isActor(_currentTarget));
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
// If we're ready to attack, attack
if (a->isInterruptable() && g_vm->_rnd->getRandomNumber(7) == 0) {
- a->attack(currentTarget);
- flags |= evalWeapon;
+ a->attack(_currentTarget);
+ _flags |= evalWeapon;
}
return taskNotDone;
@@ -3192,7 +3194,7 @@ TaskResult HuntToKillTask::atTargetUpdate() {
//----------------------------------------------------------------------
void HuntToKillTask::evaluateWeapon() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
ObjectID actorID = a->thisID();
GameObject *obj,
*bestWeapon,
@@ -3212,8 +3214,8 @@ void HuntToKillTask::evaluateWeapon() {
? (WeaponProto *)currentWeapon->proto()
: nullptr;
- if (currentTarget == nullptr) {
- warning("%s: currentTarget = NULL (return)", a->objName());
+ if (_currentTarget == nullptr) {
+ warning("%s: _currentTarget = NULL (return)", a->objName());
return;
}
@@ -3221,7 +3223,7 @@ void HuntToKillTask::evaluateWeapon() {
|| weaponProto->weaponRating(
a->thisID(),
actorID,
- currentTarget->thisID())
+ _currentTarget->thisID())
!= 0)
return;
}
@@ -3241,11 +3243,11 @@ void HuntToKillTask::evaluateWeapon() {
WeaponProto *weaponProto = (WeaponProto *)proto;
int weaponRating;
- if (currentTarget) {
- warning("%s: currentTarget = NULL (weaponRating = 0)", a->objName());
+ if (_currentTarget) {
+ warning("%s: _currentTarget = NULL (weaponRating = 0)", a->objName());
weaponRating = weaponProto->weaponRating(obj->thisID(),
actorID,
- currentTarget->thisID());
+ _currentTarget->thisID());
} else
weaponRating = 0;
@@ -3285,7 +3287,7 @@ HuntToGiveTask::HuntToGiveTask(Common::InSaveFile *in, TaskID id) : HuntActorTas
ObjectID objToGiveID = in->readUint16LE();
// Convert the object ID to a pointer
- objToGive = objToGiveID != Nothing
+ _objToGive = objToGiveID != Nothing
? GameObject::objectAddress(objToGiveID)
: nullptr;
}
@@ -3296,7 +3298,7 @@ HuntToGiveTask::HuntToGiveTask(Common::InSaveFile *in, TaskID id) : HuntActorTas
inline int32 HuntToGiveTask::archiveSize() const {
return HuntActorTask::archiveSize()
- + sizeof(ObjectID); // objToGive ID
+ + sizeof(ObjectID); // _objToGive ID
}
void HuntToGiveTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -3306,8 +3308,8 @@ void HuntToGiveTask::write(Common::MemoryWriteStreamDynamic *out) const {
HuntActorTask::write(out);
// Store the ID
- if (objToGive != nullptr)
- out->writeUint16LE(objToGive->thisID());
+ if (_objToGive != nullptr)
+ out->writeUint16LE(_objToGive->thisID());
else
out->writeUint16LE(Nothing);
}
@@ -3329,7 +3331,7 @@ bool HuntToGiveTask::operator == (const Task &t) const {
return *getTarget() == *taskPtr->getTarget()
&& tracking() ? taskPtr->tracking() : !taskPtr->tracking()
- && objToGive == taskPtr->objToGive;
+ && _objToGive == taskPtr->_objToGive;
}
//----------------------------------------------------------------------
@@ -3367,22 +3369,22 @@ TaskResult HuntToGiveTask::atTargetUpdate() {
bool BandTask::BandingRepulsorIterator::first(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- assert(a->_leader != nullptr && a->_leader->_followers != nullptr);
+ assert(_a->_leader != nullptr && _a->_leader->_followers != nullptr);
- band = a->_leader->_followers;
- bandIndex = 0;
+ _band = _a->_leader->_followers;
+ _bandIndex = 0;
- while (bandIndex < band->size()) {
- Actor *bandMember = (*band)[bandIndex];
+ while (_bandIndex < _band->size()) {
+ Actor *_bandMember = (*_band)[_bandIndex];
- if (bandMember != a) {
- repulsorVector = bandMember->getLocation() - a->getLocation();
+ if (_bandMember != _a) {
+ repulsorVector = _bandMember->getLocation() - _a->getLocation();
repulsorStrength = 1;
return true;
}
- bandIndex++;
+ _bandIndex++;
}
return false;
@@ -3393,22 +3395,22 @@ bool BandTask::BandingRepulsorIterator::first(
bool BandTask::BandingRepulsorIterator::next(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- assert(a->_leader != nullptr && a->_leader->_followers != nullptr);
- assert(band == a->_leader->_followers);
- assert(bandIndex < band->size());
+ assert(_a->_leader != nullptr && _a->_leader->_followers != nullptr);
+ assert(_band == _a->_leader->_followers);
+ assert(_bandIndex < _band->size());
- bandIndex++;
- while (bandIndex < band->size()) {
- Actor *bandMember = (*band)[bandIndex];
+ _bandIndex++;
+ while (_bandIndex < _band->size()) {
+ Actor *_bandMember = (*_band)[_bandIndex];
- if (bandMember != a) {
- repulsorVector = bandMember->getLocation() - a->getLocation();
+ if (_bandMember != _a) {
+ repulsorVector = _bandMember->getLocation() - _a->getLocation();
repulsorStrength = 1;
return true;
}
- bandIndex++;
+ _bandIndex++;
}
return false;
@@ -3418,13 +3420,13 @@ BandTask::BandTask(Common::InSaveFile *in, TaskID id) : HuntTask(in, id) {
debugC(3, kDebugSaveload, "... Loading BandTask");
_attendID = in->readSint16LE();
- attend = nullptr;
+ _attend = nullptr;
// Restore the current target location
- currentTarget.load(in);
+ _currentTarget.load(in);
- // Restore the target evaluation counter
- targetEvaluateCtr = in->readByte();
+ // Restore the target evaluation _counter
+ _targetEvaluateCtr = in->readByte();
}
//----------------------------------------------------------------------
@@ -3435,7 +3437,7 @@ void BandTask::fixup() {
HuntTask::fixup();
// Convert the TaskID to a Task pointer
- attend = _attendID != NoTask
+ _attend = _attendID != NoTask
? (AttendTask *)getTaskAddress(_attendID)
: nullptr;
}
@@ -3446,9 +3448,9 @@ void BandTask::fixup() {
inline int32 BandTask::archiveSize() const {
return HuntTask::archiveSize()
- + sizeof(TaskID) // attend ID
- + sizeof(currentTarget)
- + sizeof(targetEvaluateCtr);
+ + sizeof(TaskID) // _attend ID
+ + sizeof(_currentTarget)
+ + sizeof(_targetEvaluateCtr);
}
void BandTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -3457,17 +3459,17 @@ void BandTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
HuntTask::write(out);
- // Store the attend task ID
- if (attend != nullptr)
- out->writeSint16LE(getTaskID(attend));
+ // Store the _attend task ID
+ if (_attend != nullptr)
+ out->writeSint16LE(getTaskID(_attend));
else
out->writeSint16LE(NoTask);
// Store the current target location
- currentTarget.write(out);
+ _currentTarget.write(out);
- // Store the target evaluation counter
- out->writeByte(targetEvaluateCtr);
+ // Store the target evaluation _counter
+ out->writeByte(_targetEvaluateCtr);
}
//----------------------------------------------------------------------
@@ -3487,9 +3489,9 @@ bool BandTask::operator == (const Task &t) const {
//----------------------------------------------------------------------
void BandTask::evaluateTarget() {
- if (targetEvaluateCtr == 0) {
- Actor *leader = stack->getActor()->_leader;
- TilePoint actorLoc = stack->getActor()->getLocation(),
+ if (_targetEvaluateCtr == 0) {
+ Actor *leader = _stack->getActor()->_leader;
+ TilePoint actorLoc = _stack->getActor()->getLocation(),
movementVector;
TilePoint repulsorVector;
int16 repulsorStrength;
@@ -3503,14 +3505,14 @@ void BandTask::evaluateTarget() {
if (repulsorIter == nullptr) return;
- // Count the leader as two band members to double his
+ // Count the leader as two _band members to double his
// repulsion
repulsorVectorArray[0] = leader->getLocation() - actorLoc;
repulsorStrengthArray[0] = 3;
repulsorDistArray[0] = repulsorVectorArray[0].quickHDistance();
repulsorCount = 1;
- // Iterate through the band members, adding their locations
+ // Iterate through the _band members, adding their locations
// to the repulsor array sorted by distance.
for (repulsorFlag = repulsorIter->first(
repulsorVector,
@@ -3556,31 +3558,31 @@ void BandTask::evaluateTarget() {
repulsorStrengthArray,
repulsorCount);
- currentTarget = actorLoc + movementVector;
- currentTarget.z = leader->getLocation().z;
+ _currentTarget = actorLoc + movementVector;
+ _currentTarget.z = leader->getLocation().z;
- targetEvaluateCtr = targetEvaluateRate;
+ _targetEvaluateCtr = targetEvaluateRate;
}
- targetEvaluateCtr--;
+ _targetEvaluateCtr--;
}
//----------------------------------------------------------------------
bool BandTask::targetHasChanged(GotoTask *gotoTarget) {
GotoLocationTask *gotoLocation = (GotoLocationTask *)gotoTarget;
- TilePoint actorLoc = stack->getActor()->getLocation(),
+ TilePoint actorLoc = _stack->getActor()->getLocation(),
oldTarget = gotoLocation->getTarget();
int16 slop;
- slop = ((currentTarget - actorLoc).quickHDistance()
- + ABS(currentTarget.z - actorLoc.z))
+ slop = ((_currentTarget - actorLoc).quickHDistance()
+ + ABS(_currentTarget.z - actorLoc.z))
/ 2;
- if ((currentTarget - oldTarget).quickHDistance()
- + ABS(currentTarget.z - oldTarget.z)
+ if ((_currentTarget - oldTarget).quickHDistance()
+ + ABS(_currentTarget.z - oldTarget.z)
> slop)
- gotoLocation->changeTarget(currentTarget);
+ gotoLocation->changeTarget(_currentTarget);
return false;
}
@@ -3588,26 +3590,26 @@ bool BandTask::targetHasChanged(GotoTask *gotoTarget) {
//----------------------------------------------------------------------
GotoTask *BandTask::setupGoto() {
- return new GotoLocationTask(stack, currentTarget, getRunThreshold());
+ return new GotoLocationTask(_stack, _currentTarget, getRunThreshold());
}
//----------------------------------------------------------------------
TilePoint BandTask::currentTargetLoc() {
- return currentTarget;
+ return _currentTarget;
}
//----------------------------------------------------------------------
bool BandTask::atTarget() {
- TilePoint actorLoc = stack->getActor()->getLocation();
-
- if ((actorLoc - currentTarget).quickHDistance() > 6
- || ABS(actorLoc.z - currentTarget.z) > kMaxStepHeight) {
- if (attend != nullptr) {
- attend->abortTask();
- delete attend;
- attend = nullptr;
+ TilePoint actorLoc = _stack->getActor()->getLocation();
+
+ if ((actorLoc - _currentTarget).quickHDistance() > 6
+ || ABS(actorLoc.z - _currentTarget.z) > kMaxStepHeight) {
+ if (_attend != nullptr) {
+ _attend->abortTask();
+ delete _attend;
+ _attend = nullptr;
}
return false;
@@ -3619,10 +3621,10 @@ bool BandTask::atTarget() {
//----------------------------------------------------------------------
void BandTask::atTargetabortTask() {
- if (attend != nullptr) {
- attend->abortTask();
- delete attend;
- attend = nullptr;
+ if (_attend != nullptr) {
+ _attend->abortTask();
+ delete _attend;
+ _attend = nullptr;
}
}
@@ -3635,14 +3637,14 @@ TaskResult BandTask::atTargetEvaluate() {
//----------------------------------------------------------------------
TaskResult BandTask::atTargetUpdate() {
- Actor *a = stack->getActor();
+ Actor *a = _stack->getActor();
- if (attend != nullptr)
- attend->update();
+ if (_attend != nullptr)
+ _attend->update();
else {
- attend = new AttendTask(stack, a->_leader);
- if (attend != nullptr)
- attend->update();
+ _attend = new AttendTask(_stack, a->_leader);
+ if (_attend != nullptr)
+ _attend->update();
}
return taskNotDone;
@@ -3657,7 +3659,7 @@ int16 BandTask::getRunThreshold() {
//----------------------------------------------------------------------
BandTask::RepulsorIterator *BandTask::getNewRepulsorIterator() {
- return new BandingRepulsorIterator(stack->getActor());
+ return new BandingRepulsorIterator(_stack->getActor());
}
/* ===================================================================== *
@@ -3670,21 +3672,21 @@ BandTask::RepulsorIterator *BandTask::getNewRepulsorIterator() {
bool BandTask::BandAndAvoidEnemiesRepulsorIterator::firstEnemyRepulsor(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- assert(iteratingThruEnemies);
+ assert(_iteratingThruEnemies);
- int16 actorDistArray[ARRAYSIZE(actorArray)];
- TargetActorArray taa(ARRAYSIZE(actorArray), actorArray, actorDistArray);
+ int16 actorDistArray[ARRAYSIZE(_actorArray)];
+ TargetActorArray taa(ARRAYSIZE(_actorArray), _actorArray, actorDistArray);
ActorPropertyTarget target(actorPropIDEnemy);
- numActors = target.actor(a->world(), a->getLocation(), taa);
+ _numActors = target.actor(_a->world(), _a->getLocation(), taa);
- assert(numActors == taa.actors);
+ assert(_numActors == taa.actors);
- actorIndex = 0;
+ _actorIndex = 0;
- if (actorIndex < numActors) {
+ if (_actorIndex < _numActors) {
repulsorVector =
- actorArray[actorIndex]->getLocation() - a->getLocation();
+ _actorArray[_actorIndex]->getLocation() - _a->getLocation();
repulsorStrength = 6;
return true;
@@ -3699,13 +3701,13 @@ bool BandTask::BandAndAvoidEnemiesRepulsorIterator::firstEnemyRepulsor(
bool BandTask::BandAndAvoidEnemiesRepulsorIterator::nextEnemyRepulsor(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- assert(iteratingThruEnemies);
+ assert(_iteratingThruEnemies);
- actorIndex++;
+ _actorIndex++;
- if (actorIndex < numActors) {
+ if (_actorIndex < _numActors) {
repulsorVector =
- actorArray[actorIndex]->getLocation() - a->getLocation();
+ _actorArray[_actorIndex]->getLocation() - _a->getLocation();
repulsorStrength = 6;
return true;
@@ -3720,12 +3722,12 @@ bool BandTask::BandAndAvoidEnemiesRepulsorIterator::nextEnemyRepulsor(
bool BandTask::BandAndAvoidEnemiesRepulsorIterator::first(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- iteratingThruEnemies = false;
+ _iteratingThruEnemies = false;
if (BandingRepulsorIterator::first(repulsorVector, repulsorStrength))
return true;
- iteratingThruEnemies = true;
+ _iteratingThruEnemies = true;
return firstEnemyRepulsor(repulsorVector, repulsorStrength);
}
@@ -3735,11 +3737,11 @@ bool BandTask::BandAndAvoidEnemiesRepulsorIterator::first(
bool BandTask::BandAndAvoidEnemiesRepulsorIterator::next(
TilePoint &repulsorVector,
int16 &repulsorStrength) {
- if (!iteratingThruEnemies) {
+ if (!_iteratingThruEnemies) {
if (BandingRepulsorIterator::next(repulsorVector, repulsorStrength))
return true;
- iteratingThruEnemies = true;
+ _iteratingThruEnemies = true;
return firstEnemyRepulsor(repulsorVector, repulsorStrength);
}
@@ -3769,7 +3771,7 @@ int16 BandAndAvoidEnemiesTask::getRunThreshold() {
//----------------------------------------------------------------------
BandTask::RepulsorIterator *BandAndAvoidEnemiesTask::getNewRepulsorIterator() {
- return new BandAndAvoidEnemiesRepulsorIterator(stack->getActor());
+ return new BandAndAvoidEnemiesRepulsorIterator(_stack->getActor());
}
/* ===================================================================== *
@@ -3779,21 +3781,21 @@ BandTask::RepulsorIterator *BandAndAvoidEnemiesTask::getNewRepulsorIterator() {
FollowPatrolRouteTask::FollowPatrolRouteTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
debugC(3, kDebugSaveload, "... Loading FollowPatrolRouteTask");
- // Get the gotoWayPoint TaskID
+ // Get the _gotoWayPoint TaskID
_gotoWayPointID = in->readSint16LE();
- gotoWayPoint = nullptr;
+ _gotoWayPoint = nullptr;
// Restore the patrol route iterator
- patrolIter.read(in);
+ _patrolIter.read(in);
// Restore the last waypoint number
- lastWayPointNum = in->readSint16LE();
+ _lastWayPointNum = in->readSint16LE();
- // Restore the paused flag
- paused = in->readUint16LE();
+ // Restore the _paused flag
+ _paused = in->readUint16LE();
- // Restore the paused counter
- counter = in->readSint16LE();
+ // Restore the _paused _counter
+ _counter = in->readSint16LE();
}
//----------------------------------------------------------------------
@@ -3804,7 +3806,7 @@ void FollowPatrolRouteTask::fixup() {
Task::fixup();
// Convert the TaskID to a Task pointer
- gotoWayPoint = _gotoWayPointID != NoTask
+ _gotoWayPoint = _gotoWayPointID != NoTask
? (GotoLocationTask *)getTaskAddress(_gotoWayPointID)
: nullptr;
}
@@ -3815,11 +3817,11 @@ void FollowPatrolRouteTask::fixup() {
inline int32 FollowPatrolRouteTask::archiveSize() const {
return Task::archiveSize()
- + sizeof(TaskID) // gotoWayPoint ID
- + sizeof(patrolIter)
- + sizeof(lastWayPointNum)
- + sizeof(paused)
- + sizeof(counter);
+ + sizeof(TaskID) // _gotoWayPoint ID
+ + sizeof(_patrolIter)
+ + sizeof(_lastWayPointNum)
+ + sizeof(_paused)
+ + sizeof(_counter);
}
void FollowPatrolRouteTask::write(Common::MemoryWriteStreamDynamic *out) const {
@@ -3828,23 +3830,23 @@ void FollowPatrolRouteTask::write(Common::MemoryWriteStreamDynamic *out) const {
// Let the base class archive its data
Task::write(out);
- // Store the gotoWayPoint ID
- if (gotoWayPoint != nullptr)
- out->writeSint16LE(getTaskID(gotoWayPoint));
+ // Store the _gotoWayPoint ID
+ if (_gotoWayPoint != nullptr)
+ out->writeSint16LE(getTaskID(_gotoWayPoint));
else
out->writeSint16LE(NoTask);
// Store the PatrolRouteIterator
- patrolIter.write(out);
+ _patrolIter.write(out);
// Store the last waypoint number
- out->writeSint16LE(lastWayPointNum);
+ out->writeSint16LE(_lastWayPointNum);
- // Store the paused flag
- out->writeUint16LE(paused);
+ // Store the _paused flag
+ out->writeUint16LE(_paused);
- // Store the paused counter
- out->writeSint16LE(counter);
+ // Store the _paused _counter
+ out->writeSint16LE(_counter);
}
//----------------------------------------------------------------------
@@ -3858,10 +3860,10 @@ int16 FollowPatrolRouteTask::getType() const {
void FollowPatrolRouteTask::abortTask() {
// If there is a subtask, get rid of it
- if (gotoWayPoint) {
- gotoWayPoint->abortTask();
- delete gotoWayPoint;
- gotoWayPoint = nullptr;
+ if (_gotoWayPoint) {
+ _gotoWayPoint->abortTask();
+ delete _gotoWayPoint;
+ _gotoWayPoint = nullptr;
}
}
@@ -3870,13 +3872,13 @@ void FollowPatrolRouteTask::abortTask() {
TaskResult FollowPatrolRouteTask::evaluate() {
// Simply check the patrol iterator to determine if there are
// any more waypoints
- return *patrolIter == Nowhere ? taskSucceeded : taskNotDone;
+ return *_patrolIter == Nowhere ? taskSucceeded : taskNotDone;
}
//----------------------------------------------------------------------
TaskResult FollowPatrolRouteTask::update() {
- return !paused ? handleFollowPatrolRoute() : handlePaused();
+ return !_paused ? handleFollowPatrolRoute() : handlePaused();
}
//----------------------------------------------------------------------
@@ -3887,16 +3889,16 @@ bool FollowPatrolRouteTask::operator == (const Task &t) const {
const FollowPatrolRouteTask *taskPtr = (const FollowPatrolRouteTask *)&t;
- return patrolIter == taskPtr->patrolIter
- && lastWayPointNum == taskPtr->lastWayPointNum;
+ return _patrolIter == taskPtr->_patrolIter
+ && _lastWayPointNum == taskPtr->_lastWayPointNum;
}
//----------------------------------------------------------------------
-// Update function used if this task is not paused
+// Update function used if this task is not _paused
TaskResult FollowPatrolRouteTask::handleFollowPatrolRoute() {
- TilePoint currentWayPoint = *patrolIter,
- actorLoc = stack->getActor()->getLocation();
+ TilePoint currentWayPoint = *_patrolIter,
+ actorLoc = _stack->getActor()->getLocation();
if (currentWayPoint == Nowhere) return taskSucceeded;
@@ -3906,22 +3908,22 @@ TaskResult FollowPatrolRouteTask::handleFollowPatrolRoute() {
&& (actorLoc.v >> kTileUVShift)
== (currentWayPoint.v >> kTileUVShift)
&& ABS(actorLoc.z - currentWayPoint.z) <= kMaxStepHeight) {
- // Delete the gotoWayPoint task
- if (gotoWayPoint != nullptr) {
- gotoWayPoint->abortTask();
- delete gotoWayPoint;
- gotoWayPoint = nullptr;
+ // Delete the _gotoWayPoint task
+ if (_gotoWayPoint != nullptr) {
+ _gotoWayPoint->abortTask();
+ delete _gotoWayPoint;
+ _gotoWayPoint = nullptr;
}
// If this way point is the specified last way point,
// return success
- if (lastWayPointNum != -1
- && patrolIter.wayPointNum() == lastWayPointNum)
+ if (_lastWayPointNum != -1
+ && _patrolIter.wayPointNum() == _lastWayPointNum)
return taskSucceeded;
// If there are no more way points in the patrol route, return
// success
- if ((currentWayPoint = *++patrolIter) == Nowhere)
+ if ((currentWayPoint = *++_patrolIter) == Nowhere)
return taskSucceeded;
// We are at a way point so randomly determine if we should
@@ -3932,40 +3934,40 @@ TaskResult FollowPatrolRouteTask::handleFollowPatrolRoute() {
}
}
- // Setup a gotoWayPoint task if one doesn't already exist and
+ // Setup a _gotoWayPoint task if one doesn't already exist and
// update it
- if (gotoWayPoint != nullptr)
- gotoWayPoint->update();
+ if (_gotoWayPoint != nullptr)
+ _gotoWayPoint->update();
else {
- gotoWayPoint = new GotoLocationTask(stack, currentWayPoint);
- if (gotoWayPoint != nullptr) gotoWayPoint->update();
+ _gotoWayPoint = new GotoLocationTask(_stack, currentWayPoint);
+ if (_gotoWayPoint != nullptr) _gotoWayPoint->update();
}
return taskNotDone;
}
//----------------------------------------------------------------------
-// Update function used if this task is paused
+// Update function used if this task is _paused
TaskResult FollowPatrolRouteTask::handlePaused() {
TaskResult result;
if ((result = evaluate()) == taskNotDone) {
- if (counter == 0)
+ if (_counter == 0)
followPatrolRoute();
else
- counter--;
+ _counter--;
}
return result;
}
//----------------------------------------------------------------------
-// Set this task into the paused state
+// Set this task into the _paused state
void FollowPatrolRouteTask::pause() {
- paused = true;
- counter = (g_vm->_rnd->getRandomNumber(63) + g_vm->_rnd->getRandomNumber(63)) / 2;
+ _paused = true;
+ _counter = (g_vm->_rnd->getRandomNumber(63) + g_vm->_rnd->getRandomNumber(63)) / 2;
}
/* ===================================================================== *
@@ -3979,7 +3981,7 @@ AttendTask::AttendTask(Common::InSaveFile *in, TaskID id) : Task(in, id) {
ObjectID objID = in->readUint16LE();
// Convert the object ID to a pointer
- obj = objID != Nothing
+ _obj = objID != Nothing
? GameObject::objectAddress(objID)
: nullptr;
}
@@ -4000,8 +4002,8 @@ void AttendTask::write(Common::MemoryWriteStreamDynamic *out) const {
Task::write(out);
// Store the object ID
- if (obj != nullptr)
- out->writeUint16LE(obj->thisID());
+ if (_obj != nullptr)
+ out->writeUint16LE(_obj->thisID());
else
out->writeUint16LE(Nothing);
}
@@ -4016,7 +4018,7 @@ int16 AttendTask::getType() const {
//----------------------------------------------------------------------
void AttendTask::abortTask() {
- MotionTask *actorMotion = stack->getActor()->_moveTask;
+ MotionTask *actorMotion = _stack->getActor()->_moveTask;
// Determine if we need to abort the actor motion
if (actorMotion != nullptr && actorMotion->isTurn())
@@ -4033,14 +4035,14 @@ TaskResult AttendTask::evaluate() {
//----------------------------------------------------------------------
TaskResult AttendTask::update() {
- Actor *a = stack->getActor();
- TilePoint attendLoc = obj->getWorldLocation();
+ Actor *a = _stack->getActor();
+ TilePoint _attendLoc = _obj->getWorldLocation();
// Determine if we are facing the object
- if (a->_currentFacing != (attendLoc - a->getLocation()).quickDir()) {
+ if (a->_currentFacing != (_attendLoc - a->getLocation()).quickDir()) {
// If not, turn
if (!a->_moveTask || !a->_moveTask->isTurn())
- MotionTask::turnTowards(*a, attendLoc);
+ MotionTask::turnTowards(*a, _attendLoc);
}
return taskNotDone;
@@ -4054,7 +4056,7 @@ bool AttendTask::operator == (const Task &t) const {
const AttendTask *taskPtr = (const AttendTask *)&t;
- return obj == taskPtr->obj;
+ return _obj == taskPtr->_obj;
}
/* ===================================================================== *
@@ -4063,54 +4065,54 @@ bool AttendTask::operator == (const Task &t) const {
void TaskStack::write(Common::MemoryWriteStreamDynamic *out) {
// Store the stack bottom TaskID
- out->writeSint16LE(stackBottomID);
+ out->writeSint16LE(_stackBottomID);
// Store the actor's id
- out->writeUint16LE(actor->thisID());
+ out->writeUint16LE(_actor->thisID());
- // Store the evalCount and evalRate
- out->writeSint16LE(evalCount);
+ // Store the _evalCount and _evalRate
+ out->writeSint16LE(_evalCount);
- out->writeSint16LE(evalRate);
+ out->writeSint16LE(_evalRate);
- debugC(4, kDebugSaveload, "...... stackBottomID = %d", stackBottomID);
- debugC(4, kDebugSaveload, "...... actorID = %d", actor->thisID());
- debugC(4, kDebugSaveload, "...... evalCount = %d", evalCount);
- debugC(4, kDebugSaveload, "...... evalRate = %d", evalRate);
+ debugC(4, kDebugSaveload, "...... stackBottomID = %d", _stackBottomID);
+ debugC(4, kDebugSaveload, "...... actorID = %d", _actor->thisID());
+ debugC(4, kDebugSaveload, "...... evalCount = %d", _evalCount);
+ debugC(4, kDebugSaveload, "...... evalRate = %d", _evalRate);
}
void TaskStack::read(Common::InSaveFile *in) {
ObjectID actorID;
// Restore the stack bottom pointer
- stackBottomID = in->readSint16LE();
+ _stackBottomID = in->readSint16LE();
// Restore the actor pointer
actorID = in->readUint16LE();
- actor = (Actor *)GameObject::objectAddress(actorID);
+ _actor = (Actor *)GameObject::objectAddress(actorID);
// Restore the evaluation count
- evalCount = in->readSint16LE();
+ _evalCount = in->readSint16LE();
// Restore the evaluation rate
- evalRate = in->readSint16LE();
+ _evalRate = in->readSint16LE();
- debugC(4, kDebugSaveload, "...... stackBottomID = %d", stackBottomID);
+ debugC(4, kDebugSaveload, "...... stackBottomID = %d", _stackBottomID);
debugC(4, kDebugSaveload, "...... actorID = %d", actorID);
- debugC(4, kDebugSaveload, "...... evalCount = %d", evalCount);
- debugC(4, kDebugSaveload, "...... evalRate = %d", evalRate);
+ debugC(4, kDebugSaveload, "...... evalCount = %d", _evalCount);
+ debugC(4, kDebugSaveload, "...... evalRate = %d", _evalRate);
}
//----------------------------------------------------------------------
// Set the bottom task of this task stack
void TaskStack::setTask(Task *t) {
- assert(stackBottomID == NoTask);
+ assert(_stackBottomID == NoTask);
- if (t->stack == this) {
+ if (t->_stack == this) {
TaskID id = getTaskID(t);
- stackBottomID = id;
+ _stackBottomID = id;
}
}
@@ -4118,8 +4120,8 @@ void TaskStack::setTask(Task *t) {
// Abort all tasks in stack
void TaskStack::abortTask() {
- if (stackBottomID != NoTask) {
- Task *stackBottom = getTaskAddress(stackBottomID);
+ if (_stackBottomID != NoTask) {
+ Task *stackBottom = getTaskAddress(_stackBottomID);
stackBottom->abortTask();
delete stackBottom;
@@ -4130,8 +4132,8 @@ void TaskStack::abortTask() {
// Re-evaluate tasks in stack
TaskResult TaskStack::evaluate() {
- if (stackBottomID != -1) {
- Task *stackBottom = getTaskAddress(stackBottomID);
+ if (_stackBottomID != -1) {
+ Task *stackBottom = getTaskAddress(_stackBottomID);
return stackBottom->evaluate();
} else
@@ -4144,27 +4146,28 @@ TaskResult TaskStack::evaluate() {
TaskResult TaskStack::update() {
TaskResult result;
- // If the actor is currently uniterruptable then this task is paused
- if (!actor->isInterruptable()) return taskNotDone;
+ // If the actor is currently uniterruptable then this task is _paused
+ if (!_actor->isInterruptable())
+ return taskNotDone;
- if (stackBottomID != NoTask) {
- Task *stackBottom = getTaskAddress(stackBottomID);
+ if (_stackBottomID != NoTask) {
+ Task *stackBottom = getTaskAddress(_stackBottomID);
// Determine if it is time to reevaluate the tasks
- if (--evalCount == 0) {
+ if (--_evalCount == 0) {
if ((result = stackBottom->evaluate()) != taskNotDone) {
delete stackBottom;
- stackBottomID = NoTask;
+ _stackBottomID = NoTask;
return result;
}
- evalCount = evalRate;
+ _evalCount = _evalRate;
}
// Update the tasks
if ((result = stackBottom->update()) != taskNotDone) {
delete stackBottom;
- stackBottomID = NoTask;
+ _stackBottomID = NoTask;
return result;
}
diff --git a/engines/saga2/task.h b/engines/saga2/task.h
index 5ba256f0532..1260cb930b4 100644
--- a/engines/saga2/task.h
+++ b/engines/saga2/task.h
@@ -124,18 +124,18 @@ class Task {
protected:
// A pointer to this task's stack
- TaskStack *stack;
+ TaskStack *_stack;
TaskStackID _stackID;
public:
Common::String _type;
// Constructor -- initial construction
- Task(TaskStack *ts) : stack(ts), _stackID(NoTaskStack) {
+ Task(TaskStack *ts) : _stack(ts), _stackID(NoTaskStack) {
newTask(this);
}
- Task(TaskStack *ts, TaskID id) : stack(ts) {
+ Task(TaskStack *ts, TaskID id) : _stack(ts) {
newTask(this, id);
}
@@ -176,8 +176,8 @@ public:
// This class is basically a shell around the wander motion task
class WanderTask : public Task {
protected:
- bool paused; // Flag indicating "paused"ness of this task
- int16 counter; // Counter for tracking pause length
+ bool _paused; // Flag indicating "paused"ness of this task
+ int16 _counter; // Counter for tracking pause length
public:
// Constructor
@@ -231,13 +231,13 @@ class GotoRegionTask;
// motion task
class TetheredWanderTask : public WanderTask {
// Tether coordinates
- int16 minU,
- minV,
- maxU,
- maxV;
+ int16 _minU,
+ _minV,
+ _maxU,
+ _maxV;
// Pointer to subtask for going to the tether region
- GotoRegionTask *gotoTether;
+ GotoRegionTask *_gotoTether;
TaskID _gotoTetherID;
public:
@@ -249,11 +249,11 @@ public:
int16 uMax,
int16 vMax) :
WanderTask(ts),
- minU(uMin),
- minV(vMin),
- maxU(uMax),
- maxV(vMax),
- gotoTether(NULL),
+ _minU(uMin),
+ _minV(vMin),
+ _maxU(uMax),
+ _maxV(vMax),
+ _gotoTether(NULL),
_gotoTetherID(NoTask) {
debugC(2, kDebugTasks, " - TetheredWanderTask");
_type = "TetheredWanderTask";
@@ -287,17 +287,17 @@ public:
* ===================================================================== */
class GotoTask : public Task {
- WanderTask *wander;
+ WanderTask *_wander;
TaskID _wanderID;
- bool prevRunState;
+ bool _prevRunState;
public:
// Constructor -- initial construction
GotoTask(TaskStack *ts) :
Task(ts),
- wander(NULL),
+ _wander(NULL),
_wanderID(NoTask),
- prevRunState(false) {
+ _prevRunState(false) {
debugC(2, kDebugTasks, " - GotoTask");
_type = "GotoTask";
}
@@ -329,8 +329,8 @@ private:
* ===================================================================== */
class GotoLocationTask : public GotoTask {
- TilePoint targetLoc;
- uint8 runThreshold;
+ TilePoint _targetLoc;
+ uint8 _runThreshold;
public:
// Constructor -- initial construction
@@ -339,8 +339,8 @@ public:
const TilePoint &tp,
uint8 runDist = maxuint8) :
GotoTask(ts),
- targetLoc(tp),
- runThreshold(runDist) {
+ _targetLoc(tp),
+ _runThreshold(runDist) {
debugC(2, kDebugTasks, " - GotoLocationTask");
_type = "GotoLocationTask";
}
@@ -360,11 +360,11 @@ public:
bool operator == (const Task &t) const;
const TilePoint getTarget() const {
- return targetLoc;
+ return _targetLoc;
}
void changeTarget(const TilePoint &newTarget) {
- targetLoc = newTarget;
+ _targetLoc = newTarget;
}
private:
@@ -379,10 +379,10 @@ private:
* ===================================================================== */
class GotoRegionTask : public GotoTask {
- int16 regionMinU,
- regionMinV,
- regionMaxU,
- regionMaxV;
+ int16 _regionMinU,
+ _regionMinV,
+ _regionMaxU,
+ _regionMaxV;
public:
// Constructor -- initial construction
@@ -393,10 +393,10 @@ public:
int16 maxU,
int16 maxV) :
GotoTask(ts),
- regionMinU(minU),
- regionMinV(minV),
- regionMaxU(maxU),
- regionMaxV(maxV) {
+ _regionMinU(minU),
+ _regionMinV(minV),
+ _regionMaxU(maxU),
+ _regionMaxV(maxV) {
debugC(2, kDebugTasks, " - GotoRegionTask");
_type = "GotoRegionTask";
}
@@ -427,10 +427,10 @@ private:
* ===================================================================== */
class GotoObjectTargetTask : public GotoTask {
- TilePoint lastTestedLoc;
- int16 sightCtr;
+ TilePoint _lastTestedLoc;
+ int16 _sightCtr;
- uint8 flags;
+ uint8 _flags;
enum {
track = (1 << 0),
@@ -444,16 +444,16 @@ class GotoObjectTargetTask : public GotoTask {
// static const int16 sightRate = 16;
protected:
- TilePoint lastKnownLoc;
+ TilePoint _lastKnownLoc;
public:
// Constructor -- initial construction
GotoObjectTargetTask(TaskStack *ts, bool trackFlag) :
GotoTask(ts),
- lastTestedLoc(Nowhere),
- sightCtr(0),
- flags(trackFlag ? track : 0),
- lastKnownLoc(Nowhere) {
+ _lastTestedLoc(Nowhere),
+ _sightCtr(0),
+ _flags(trackFlag ? track : 0),
+ _lastKnownLoc(Nowhere) {
debugC(2, kDebugTasks, " - GotoObjectTargetTask");
_type = "GotoObjectTargetTask";
}
@@ -475,10 +475,10 @@ private:
protected:
bool tracking() const {
- return (flags & track) != 0;
+ return (_flags & track) != 0;
}
bool isInSight() const {
- return (flags & inSight) != 0;
+ return (_flags & inSight) != 0;
}
};
@@ -489,7 +489,7 @@ protected:
* ===================================================================== */
class GotoObjectTask : public GotoObjectTargetTask {
- GameObject *targetObj;
+ GameObject *_targetObj;
public:
// Constructor -- initial construction
@@ -498,7 +498,7 @@ public:
GameObject *obj,
bool trackFlag = false) :
GotoObjectTargetTask(ts, trackFlag),
- targetObj(obj) {
+ _targetObj(obj) {
debugC(2, kDebugTasks, " - GotoObjectTask");
_type = "GotoObjectTask";
}
@@ -518,7 +518,7 @@ public:
bool operator == (const Task &t) const;
const GameObject *getTarget() const {
- return targetObj;
+ return _targetObj;
}
private:
@@ -531,13 +531,13 @@ private:
* ===================================================================== */
class GotoActorTask : public GotoObjectTargetTask {
- Actor *targetActor;
+ Actor *_targetActor;
public:
// Constructor -- initial construction
GotoActorTask(TaskStack *ts, Actor *a, bool trackFlag = false) :
GotoObjectTargetTask(ts, trackFlag),
- targetActor(a) {
+ _targetActor(a) {
debugC(2, kDebugTasks, " - GotoActorTask");
_type = "GotoActorTask";
}
@@ -556,7 +556,7 @@ public:
bool operator == (const Task &t) const;
const Actor *getTarget() const {
- return targetActor;
+ return _targetActor;
}
private:
@@ -569,10 +569,10 @@ private:
* ===================================================================== */
class GoAwayFromTask : public Task {
- GotoLocationTask *goTask;
+ GotoLocationTask *_goTask;
TaskID _goTaskID;
- uint8 flags;
+ uint8 _flags;
enum {
run = (1 << 0)
@@ -582,18 +582,18 @@ public:
// Constructor -- initial construction
GoAwayFromTask(TaskStack *ts) :
Task(ts),
- goTask(NULL),
+ _goTask(NULL),
_goTaskID(NoTask),
- flags(0) {
+ _flags(0) {
debugC(2, kDebugTasks, " - GoAwayFromTask1");
_type = "GoAwayFromTask";
}
GoAwayFromTask(TaskStack *ts, bool runFlag) :
Task(ts),
- goTask(NULL),
+ _goTask(NULL),
_goTaskID(NoTask),
- flags(runFlag ? run : 0) {
+ _flags(runFlag ? run : 0) {
debugC(2, kDebugTasks, " - GoAwayFromTask2");
_type = "GoAwayFromTask";
}
@@ -622,13 +622,13 @@ private:
* ===================================================================== */
class GoAwayFromObjectTask : public GoAwayFromTask {
- GameObject *obj;
+ GameObject *_obj;
public:
// Constructor -- initial construction
GoAwayFromObjectTask(TaskStack *ts, GameObject *object) :
GoAwayFromTask(ts),
- obj(object) {
+ _obj(object) {
debugC(2, kDebugTasks, " - GoAwayFromObjectTask");
_type = "GoAwayFromObjectTask";
}
@@ -656,18 +656,12 @@ private:
* ===================================================================== */
class GoAwayFromActorTask : public GoAwayFromTask {
- TargetPlaceHolder targetMem;
+ TargetPlaceHolder _targetMem;
public:
// Constructor -- initial construction
- GoAwayFromActorTask(
- TaskStack *ts,
- Actor *a,
- bool runFlag = false);
- GoAwayFromActorTask(
- TaskStack *ts,
- const ActorTarget &at,
- bool runFlag = false);
+ GoAwayFromActorTask(TaskStack *ts, Actor *a, bool runFlag = false);
+ GoAwayFromActorTask(TaskStack *ts, const ActorTarget &at, bool runFlag = false);
GoAwayFromActorTask(Common::InSaveFile *in, TaskID id);
@@ -687,7 +681,7 @@ private:
TilePoint getRepulsionVector();
const ActorTarget *getTarget() const {
- return (const ActorTarget *)targetMem;
+ return (const ActorTarget *)_targetMem;
}
};
@@ -696,10 +690,10 @@ private:
* ===================================================================== */
class HuntTask : public Task {
- Task *subTask; // This will either be a wander task of a
+ Task *_subTask; // This will either be a wander task of a
TaskID _subTaskID;
// goto task
- uint8 huntFlags;
+ uint8 _huntFlags;
enum HuntFlags {
huntWander = (1 << 0), // Indicates that subtask is a wander task
@@ -708,7 +702,7 @@ class HuntTask : public Task {
public:
// Constructor -- initial construction
- HuntTask(TaskStack *ts) : Task(ts), huntFlags(0), subTask(nullptr), _subTaskID(NoTask) {
+ HuntTask(TaskStack *ts) : Task(ts), _huntFlags(0), _subTask(nullptr), _subTaskID(NoTask) {
debugC(2, kDebugTasks, " - HuntTask");
_type = "HuntTask";
}
@@ -750,10 +744,10 @@ protected:
* ===================================================================== */
class HuntLocationTask : public HuntTask {
- TargetPlaceHolder targetMem;
+ TargetPlaceHolder _targetMem;
protected:
- TilePoint currentTarget;
+ TilePoint _currentTarget;
public:
// Constructor -- initial construction
@@ -773,7 +767,7 @@ protected:
TilePoint currentTargetLoc();
const Target *getTarget() const {
- return (const Target *)targetMem;
+ return (const Target *)_targetMem;
}
};
@@ -782,9 +776,9 @@ protected:
* ===================================================================== */
class HuntToBeNearLocationTask : public HuntLocationTask {
- uint16 range;
+ uint16 _range;
- uint8 targetEvaluateCtr;
+ uint8 _targetEvaluateCtr;
// static const doesn't work in Visual C++
enum {
@@ -796,8 +790,8 @@ public:
// Constructor -- initial construction
HuntToBeNearLocationTask(TaskStack *ts, const Target &t, uint16 r) :
HuntLocationTask(ts, t),
- range(r),
- targetEvaluateCtr(0) {
+ _range(r),
+ _targetEvaluateCtr(0) {
debugC(2, kDebugTasks, " - HuntToBeNearLocationTask");
_type = "HuntToBeNearLocationTask";
}
@@ -826,7 +820,7 @@ protected:
TaskResult atTargetUpdate();
uint16 getRange() const {
- return range;
+ return _range;
}
};
@@ -837,10 +831,10 @@ protected:
* ===================================================================== */
class HuntObjectTask : public HuntTask {
- TargetPlaceHolder targetMem;
+ TargetPlaceHolder _targetMem;
protected:
- GameObject *currentTarget;
+ GameObject *_currentTarget;
public:
// Constructor -- initial construction
@@ -860,7 +854,7 @@ protected:
TilePoint currentTargetLoc();
const ObjectTarget *getTarget() const {
- return (const ObjectTarget *)targetMem;
+ return (const ObjectTarget *)_targetMem;
}
};
@@ -869,9 +863,9 @@ protected:
* ===================================================================== */
class HuntToBeNearObjectTask : public HuntObjectTask {
- uint16 range;
+ uint16 _range;
- uint8 targetEvaluateCtr;
+ uint8 _targetEvaluateCtr;
enum {
targetEvaluateRate = 64
@@ -885,8 +879,8 @@ public:
const ObjectTarget &ot,
uint16 r) :
HuntObjectTask(ts, ot),
- range(r),
- targetEvaluateCtr(0) {
+ _range(r),
+ _targetEvaluateCtr(0) {
debugC(2, kDebugTasks, " - HuntToBeNearObjectTask");
_type = "HuntToBeNearObjectTask";
}
@@ -915,7 +909,7 @@ protected:
TaskResult atTargetUpdate();
uint16 getRange() const {
- return range;
+ return _range;
}
};
@@ -926,21 +920,21 @@ protected:
* ===================================================================== */
class HuntToPossessTask : public HuntObjectTask {
- uint8 targetEvaluateCtr;
+ uint8 _targetEvaluateCtr;
enum {
targetEvaluateRate = 64
};
// static const uint8 targetEvaluateRate;
- bool grabFlag;
+ bool _grabFlag;
public:
// Constructor -- initial construction
HuntToPossessTask(TaskStack *ts, const ObjectTarget &ot) :
HuntObjectTask(ts, ot),
- targetEvaluateCtr(0),
- grabFlag(false) {
+ _targetEvaluateCtr(0),
+ _grabFlag(false) {
debugC(2, kDebugTasks, " - HuntToPossessTask");
_type = "HuntToPossessTask";
}
@@ -975,15 +969,15 @@ protected:
* ===================================================================== */
class HuntActorTask : public HuntTask {
- TargetPlaceHolder targetMem;
- uint8 flags;
+ TargetPlaceHolder _targetMem;
+ uint8 _flags;
enum {
track = (1 << 0)
};
protected:
- Actor *currentTarget;
+ Actor *_currentTarget;
public:
// Constructor -- initial construction
@@ -1006,11 +1000,11 @@ protected:
TilePoint currentTargetLoc();
const ActorTarget *getTarget() const {
- return (const ActorTarget *)targetMem;
+ return (const ActorTarget *)_targetMem;
}
bool tracking() const {
- return (flags & track) != 0;
+ return (_flags & track) != 0;
}
};
@@ -1019,11 +1013,11 @@ protected:
* ===================================================================== */
class HuntToBeNearActorTask : public HuntActorTask {
- GoAwayFromObjectTask *goAway; // The 'go away' sub task pointer
+ GoAwayFromObjectTask *_goAway; // The 'go away' sub task pointer
TaskID _goAwayID;
- uint16 range; // Maximum range
+ uint16 _range; // Maximum range
- uint8 targetEvaluateCtr;
+ uint8 _targetEvaluateCtr;
enum {
targetEvaluateRate = 16
@@ -1043,10 +1037,10 @@ public:
uint16 r,
bool trackFlag = false) :
HuntActorTask(ts, at, trackFlag),
- goAway(NULL),
+ _goAway(NULL),
_goAwayID(NoTask),
- range(MAX<uint16>(r, 16)),
- targetEvaluateCtr(0) {
+ _range(MAX<uint16>(r, 16)),
+ _targetEvaluateCtr(0) {
debugC(2, kDebugTasks, " - HuntToBeNearActorTask");
_type = "HuntToBeNearActorTask";
}
@@ -1078,7 +1072,7 @@ protected:
TaskResult atTargetUpdate();
uint16 getRange() const {
- return range;
+ return _range;
}
};
@@ -1089,8 +1083,8 @@ protected:
* ===================================================================== */
class HuntToKillTask : public HuntActorTask {
- uint8 targetEvaluateCtr;
- uint8 specialAttackCtr;
+ uint8 _targetEvaluateCtr;
+ uint8 _specialAttackCtr;
enum {
targetEvaluateRate = 16
@@ -1100,7 +1094,7 @@ class HuntToKillTask : public HuntActorTask {
currentWeaponBonus = 1
};
- uint8 flags;
+ uint8 _flags;
enum {
evalWeapon = (1 << 0)
@@ -1155,7 +1149,7 @@ inline int16 closenessScore(int16 dist) {
* ===================================================================== */
class HuntToGiveTask : public HuntActorTask {
- GameObject *objToGive;
+ GameObject *_objToGive;
public:
// Constructor -- initial construction
@@ -1165,7 +1159,7 @@ public:
GameObject *obj,
bool trackFlag = false) :
HuntActorTask(ts, at, trackFlag),
- objToGive(obj) {
+ _objToGive(obj) {
debugC(2, kDebugTasks, " - HuntToGiveTask");
_type = "HuntToGiveTask";
}
@@ -1200,11 +1194,11 @@ protected:
class AttendTask;
class BandTask : public HuntTask {
- AttendTask *attend;
+ AttendTask *_attend;
TaskID _attendID;
- TilePoint currentTarget;
- uint8 targetEvaluateCtr;
+ TilePoint _currentTarget;
+ uint8 _targetEvaluateCtr;
enum {
targetEvaluateRate = 2
@@ -1227,14 +1221,14 @@ public:
class BandingRepulsorIterator : public RepulsorIterator {
protected:
- Actor *a;
+ Actor *_a;
private:
- Band *band;
- int bandIndex;
+ Band *_band;
+ int _bandIndex;
public:
- BandingRepulsorIterator(Actor *actor) : a(actor), band(nullptr), bandIndex(0) {}
+ BandingRepulsorIterator(Actor *actor) : _a(actor), _band(nullptr), _bandIndex(0) {}
bool first(
TilePoint &repulsorVector,
@@ -1252,16 +1246,16 @@ public:
// even though it is explicitly declared protected and not private.
// Watcom C++, however, works correctly.
class BandAndAvoidEnemiesRepulsorIterator : public BandingRepulsorIterator {
- Actor *actorArray[6];
- int numActors,
- actorIndex;
- bool iteratingThruEnemies;
+ Actor *_actorArray[6];
+ int _numActors,
+ _actorIndex;
+ bool _iteratingThruEnemies;
public:
BandAndAvoidEnemiesRepulsorIterator(Actor *actor) :
- BandingRepulsorIterator(actor), numActors(0), actorIndex(0), iteratingThruEnemies(false) {
+ BandingRepulsorIterator(actor), _numActors(0), _actorIndex(0), _iteratingThruEnemies(false) {
for (int i = 0; i < 6; i++)
- actorArray[i] = 0;
+ _actorArray[i] = 0;
}
private:
@@ -1287,10 +1281,10 @@ public:
// Constructor -- initial construction
BandTask(TaskStack *ts) :
HuntTask(ts),
- attend(NULL),
+ _attend(NULL),
_attendID(NoTask),
- currentTarget(Nowhere),
- targetEvaluateCtr(0) {
+ _currentTarget(Nowhere),
+ _targetEvaluateCtr(0) {
debugC(2, kDebugTasks, " - BandTask");
_type = "BandTask";
}
@@ -1338,34 +1332,32 @@ protected:
// I had to move this nested class up to the BandTask class because
// Visual C++ is lame.
/* class BandAndAvoidEnemiesRepulsorIterator : public BandingRepulsorIterator {
- Actor *actorArray[6];
- int numActors,
- actorIndex;
- bool iteratingThruEnemies;
+ Actor *_actorArray[6];
+ int _numActors,
+ _actorIndex;
+ bool _iteratingThruEnemies;
public:
- BandAndAvoidEnemiesRepulsorIterator( Actor *actor ) :
- BandingRepulsorIterator( actor )
- {
- }
+ BandAndAvoidEnemiesRepulsorIterator(Actor *actor) :
+ BandingRepulsorIterator(actor) {}
private:
bool firstEnemyRepulsor(
TilePoint &repulsorVector,
- int16 &repulsorStrength );
+ int16 &repulsorStrength);
bool nextEnemyRepulsor(
TilePoint &repulsorVector,
- int16 &repulsorStrength );
+ int16 &repulsorStrength);
public:
bool first(
TilePoint &repulsorVector,
- int16 &repulsorStrength );
+ int16 &repulsorStrength);
bool next(
TilePoint &repulsorVector,
- int16 &repulsorStrength );
+ int16 &repulsorStrength);
};
*/
public:
@@ -1390,15 +1382,15 @@ protected:
* ===================================================================== */
class FollowPatrolRouteTask : public Task {
- GotoLocationTask *gotoWayPoint; // A goto waypoint sub task
+ GotoLocationTask *_gotoWayPoint; // A goto waypoint sub task
TaskID _gotoWayPointID;
// pointer.
- PatrolRouteIterator patrolIter; // The patrol route iterator.
- int16 lastWayPointNum; // Waypoint at which to end
+ PatrolRouteIterator _patrolIter; // The patrol route iterator.
+ int16 _lastWayPointNum; // Waypoint at which to end
// this task.
- bool paused; // Flag indicating "paused"ness
+ bool _paused; // Flag indicating "paused"ness
// of this task
- int16 counter; // Counter for tracking pause
+ int16 _counter; // Counter for tracking pause
// length
public:
@@ -1408,10 +1400,10 @@ public:
PatrolRouteIterator iter,
int16 stopAt = -1) :
Task(ts),
- gotoWayPoint(NULL),
+ _gotoWayPoint(NULL),
_gotoWayPointID(NoTask),
- patrolIter(iter),
- lastWayPointNum(stopAt), counter(0) {
+ _patrolIter(iter),
+ _lastWayPointNum(stopAt), _counter(0) {
debugC(2, kDebugTasks, " - FollowPatrolRouteTask");
_type = "FollowPatrolRouteTask";
followPatrolRoute();
@@ -1449,7 +1441,7 @@ public:
// Set this task into the unpaused state
void followPatrolRoute() {
- paused = false;
+ _paused = false;
}
};
@@ -1458,11 +1450,11 @@ public:
* ===================================================================== */
class AttendTask : public Task {
- GameObject *obj;
+ GameObject *_obj;
public:
// Constructor -- initial construction
- AttendTask(TaskStack *ts, GameObject *o) : Task(ts), obj(o) {
+ AttendTask(TaskStack *ts, GameObject *o) : Task(ts), _obj(o) {
debugC(2, kDebugTasks, " - AttendTask");
_type = "AttendTask";
}
@@ -1495,17 +1487,13 @@ public:
* ===================================================================== */
class DefendTask : public Task {
- Actor *attacker;
+ Actor *_attacker;
- Task *subTask;
+ Task *_subTask;
public:
// Constructor -- initial construction
- DefendTask(TaskStack *ts, Actor *a) :
- Task(ts),
- attacker(a),
- subTask(NULL) {
- }
+ DefendTask(TaskStack *ts, Actor *a) : Task(ts), _attacker(a), _subTask(NULL) {}
// Fixup the subtask pointer
void fixup();
@@ -1530,10 +1518,10 @@ public:
* ===================================================================== */
class ParryTask : public Task {
- Actor *attacker;
- GameObject *defenseObj;
+ Actor *_attacker;
+ GameObject *_defenseObj;
- uint8 flags;
+ uint8 _flags;
enum {
motionStarted = (1 << 0),
@@ -1544,9 +1532,9 @@ public:
// Constructor -- initial construction
ParryTask(TaskStack *ts, Actor *a, GameObject *obj) :
Task(ts),
- attacker(a),
- defenseObj(obj),
- flags(0) {
+ _attacker(a),
+ _defenseObj(obj),
+ _flags(0) {
}
// Return the number of bytes needed to archive this object in
@@ -1574,33 +1562,33 @@ public:
// stack. Also, this class manages the automatic task reevaluation.
class TaskStack {
- TaskID stackBottomID; // Bottom task in stack
+ TaskID _stackBottomID; // Bottom task in stack
- int16 evalCount, // Counter for automatic task re-evaluation
- evalRate; // Rate of automatic task re-evalutation
+ int16 _evalCount, // Counter for automatic task re-evaluation
+ _evalRate; // Rate of automatic task re-evalutation
public:
- Actor *actor; // Pointer to actor performing tasks
+ Actor *_actor; // Pointer to actor performing tasks
// Constructor
TaskStack() :
- stackBottomID(0),
- evalCount(0),
- evalRate(0),
- actor(nullptr) {}
+ _stackBottomID(0),
+ _evalCount(0),
+ _evalRate(0),
+ _actor(nullptr) {}
TaskStack(Actor *a) :
- stackBottomID(NoTask),
- actor(a),
- evalCount(defaultEvalRate),
- evalRate(defaultEvalRate) {
+ _stackBottomID(NoTask),
+ _actor(a),
+ _evalCount(defaultEvalRate),
+ _evalRate(defaultEvalRate) {
newTaskStack(this);
}
// Destructor
~TaskStack() {
- if (actor)
- actor->_curTask = nullptr;
+ if (_actor)
+ _actor->_curTask = nullptr;
deleteTaskStack(this);
}
@@ -1608,9 +1596,9 @@ public:
// in a buffer
int32 archiveSize() {
return sizeof(ObjectID) // actor's id
- + sizeof(stackBottomID)
- + sizeof(evalCount)
- + sizeof(evalRate);
+ + sizeof(_stackBottomID)
+ + sizeof(_evalCount)
+ + sizeof(_evalRate);
}
void write(Common::MemoryWriteStreamDynamic *out);
@@ -1622,13 +1610,13 @@ public:
// Return a pointer to the bottom task in this task stack
const Task *getTask() {
- return stackBottomID != NoTask
- ? getTaskAddress(stackBottomID)
+ return _stackBottomID != NoTask
+ ? getTaskAddress(_stackBottomID)
: NULL;
}
Actor *getActor() {
- return actor;
+ return _actor;
}
// Abort all tasks in stack
Commit: 5b7b40af0b264e755e3d76ce9abdd296f78892b5
https://github.com/scummvm/scummvm/commit/5b7b40af0b264e755e3d76ce9abdd296f78892b5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in tile.h
Changed paths:
engines/saga2/sagafunc.cpp
engines/saga2/tile.cpp
engines/saga2/tile.h
diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index 99ec47dd3b1..0c17f2a48d4 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -3425,11 +3425,11 @@ int16 scriptFindMission(int16 *args) {
int16 scriptSetTileCycleSpeed(int16 *args) {
MONOLOG(SetTileCycleSpeed);
- extern CyclePtr cycleList; // list of tile cycling info
+ extern CyclePtr _cycleList; // list of tile cycling info
- TileCycleData &tcd = cycleList[args[0]];
+ TileCycleData &tcd = _cycleList[args[0]];
- tcd.cycleSpeed = args[1];
+ tcd._cycleSpeed = args[1];
return 0;
}
@@ -3440,12 +3440,12 @@ int16 scriptSetTileCycleSpeed(int16 *args) {
int16 scriptSetTileCycleState(int16 *args) {
MONOLOG(SetTileCycleState);
- extern CyclePtr cycleList; // list of tile cycling info
+ extern CyclePtr _cycleList; // list of tile cycling info
- TileCycleData &tcd = cycleList[args[0]];
+ TileCycleData &tcd = _cycleList[args[0]];
- tcd.currentState = args[1];
- tcd.counter = 0;
+ tcd._currentState = args[1];
+ tcd._counter = 0;
return 0;
}
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 3c0971af40f..3ee24780d29 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -163,7 +163,7 @@ extern ObjectID viewCenterObject; // ID of object that view tracks
Tile structure management
* ===================================================================== */
-int16 cycleCount;
+int16 _cycleCount;
uint16 rippedRoofID;
@@ -176,7 +176,7 @@ WorldMapData *mapList; // master map data array
byte **stateArray; // Array of active item instance
// state arrays
-CyclePtr cycleList; // list of tile cycling info
+CyclePtr _cycleList; // list of tile cycling info
// Platform caching management
PlatformCacheEntry *platformCache;
@@ -224,9 +224,9 @@ TileInfo *TileInfo::tileAddress(TileID id) {
ti = tbh->tile(tileNum);
if (ti->attrs.cycleRange > 0) {
- TileCycleData &tcd = cycleList[ti->attrs.cycleRange - 1];
+ TileCycleData &tcd = _cycleList[ti->attrs.cycleRange - 1];
- TileID2Bank(tcd.cycleList[tcd.currentState],
+ TileID2Bank(tcd._cycleList[tcd._currentState],
tileBank,
tileNum);
@@ -256,9 +256,9 @@ TileInfo *TileInfo::tileAddress(TileID id, uint8 **imageData) {
ti = tbh->tile(tileNum);
if (ti->attrs.cycleRange > 0) {
- TileCycleData &tcd = cycleList[ti->attrs.cycleRange - 1];
+ TileCycleData &tcd = _cycleList[ti->attrs.cycleRange - 1];
- TileID2Bank(tcd.cycleList[tcd.currentState],
+ TileID2Bank(tcd._cycleList[tcd._currentState],
tileBank,
tileNum);
@@ -285,19 +285,19 @@ TileInfo *TileInfo::tileAddress(TileID id, uint8 **imageData) {
// Return the map number of this active item
int16 ActiveItem::getMapNum() {
- int16 mapNum;
+ int16 _mapNum;
// Use a brute force search of all of the maps' active item lists
// to determine which map this active item is on.
- for (mapNum = 0; mapNum < worldCount; mapNum++) {
- WorldMapData *mapData = &mapList[mapNum];
+ for (_mapNum = 0; _mapNum < worldCount; _mapNum++) {
+ WorldMapData *mapData = &mapList[_mapNum];
// Determine if the active item in on this map's list
if (_parent == mapData->activeItemList)
break;
}
- return mapNum;
+ return _mapNum;
}
//-----------------------------------------------------------------------
@@ -336,16 +336,16 @@ ActiveItem *ActiveItem::activeItemAddress(ActiveItemID id) {
// Return this active item's ID
ActiveItemID ActiveItem::thisID() {
- int16 mapNum = getMapNum();
+ int16 _mapNum = getMapNum();
- return ActiveItemID(mapNum, _index);
+ return ActiveItemID(_mapNum, _index);
}
//-----------------------------------------------------------------------
// Return this active item's ID
-ActiveItemID ActiveItem::thisID(int16 mapNum) {
- return ActiveItemID(mapNum, _index);
+ActiveItemID ActiveItem::thisID(int16 _mapNum) {
+ return ActiveItemID(_mapNum, _index);
}
//-----------------------------------------------------------------------
@@ -427,8 +427,8 @@ void ActiveItem::playTAGNoise(ActiveItem *ai, int16 tagNoiseID) {
// use() function for ActiveItem group
bool ActiveItem::use(ActiveItem *ins, ObjectID enactor) {
- int16 mapNum = getMapNum();
- uint16 state = ins->getInstanceState(mapNum);
+ int16 _mapNum = getMapNum();
+ uint16 state = ins->getInstanceState(_mapNum);
scriptCallFrame scf;
if (ins->_data.scriptClassID != 0) {
@@ -458,7 +458,7 @@ bool ActiveItem::use(ActiveItem *ins, ObjectID enactor) {
switch (ins->builtInBehavior()) {
case builtInLamp:
- ins->setInstanceState(mapNum, !state);
+ ins->setInstanceState(_mapNum, !state);
break;
case builtInDoor:
@@ -716,7 +716,7 @@ TilePoint getClosestPointOnTAI(ActiveItem *TAI, GameObject *obj) {
TileRegion TAIReg;
ActiveItem *TAG = TAI->getGroup();
- // Compute in points the region of the TAI
+ // Compute in points the _region of the TAI
TAIReg.min.u = TAI->_data.instance.u << kTileUVShift;
TAIReg.min.v = TAI->_data.instance.v << kTileUVShift;
TAIReg.max.u = TAIReg.min.u
@@ -915,7 +915,7 @@ void TileActivityTaskList::read(Common::InSaveFile *in) {
tat = newTask(tai);
if (tat != nullptr)
- tat->activityType = activityType;
+ tat->_activityType = activityType;
}
}
}
@@ -928,15 +928,15 @@ void TileActivityTaskList::write(Common::MemoryWriteStreamDynamic *out) {
debugC(3, kDebugSaveload, "... taskCount = %d", taskCount);
for (Common::List<TileActivityTask *>::iterator it = _list.begin(); it != _list.end(); ++it) {
- ActiveItem *ai = (*it)->tai;
+ ActiveItem *ai = (*it)->_tai;
// Store the activeItemID
out->writeSint16LE(ai->thisID().val);
debugC(4, kDebugSaveload, "...... activeItemID = %d", ai->thisID().val);
// Store the task type
- out->writeByte((*it)->activityType);
- debugC(4, kDebugSaveload, "...... activityType = %d", (*it)->activityType);
+ out->writeByte((*it)->_activityType);
+ debugC(4, kDebugSaveload, "...... _activityType = %d", (*it)->_activityType);
}
}
@@ -960,7 +960,7 @@ TileActivityTask *TileActivityTaskList::newTask(ActiveItem *activeInstance) {
// Check see if there's already tile activity task associated with
// this instance.
for (Common::List<TileActivityTask *>::iterator it = _list.begin(); it != _list.end(); ++it)
- if ((*it)->tai == activeInstance) {
+ if ((*it)->_tai == activeInstance) {
tat = *it;
break;
}
@@ -973,20 +973,20 @@ TileActivityTask *TileActivityTaskList::newTask(ActiveItem *activeInstance) {
tat = new TileActivityTask;
- tat->tai = activeInstance;
- tat->activityType = TileActivityTask::activityTypeNone;
- tat->script = NoThread;
- tat->targetState = 0;
+ tat->_tai = activeInstance;
+ tat->_activityType = TileActivityTask::activityTypeNone;
+ tat->_script = NoThread;
+ tat->_targetState = 0;
_list.push_back(tat);
}
// If we re-used an old task struct, then make sure script gets woken up.
- if (tat->script != NoThread) {
+ if (tat->_script != NoThread) {
debugC(3, kDebugTasks, "Waking up thread TAT");
- wakeUpThread(tat->script);
- tat->script = NoThread;
+ wakeUpThread(tat->_script);
+ tat->_script = NoThread;
}
return tat;
@@ -1013,7 +1013,7 @@ void TileActivityTask::openDoor(ActiveItem &activeInstance) {
TileActivityTask *tat;
if ((tat = g_vm->_aTaskList->newTask(&activeInstance)) != nullptr)
- tat->activityType = activityTypeOpen;
+ tat->_activityType = activityTypeOpen;
}
//-----------------------------------------------------------------------
@@ -1024,7 +1024,7 @@ void TileActivityTask::closeDoor(ActiveItem &activeInstance) {
TileActivityTask *tat;
if ((tat = g_vm->_aTaskList->newTask(&activeInstance)) != nullptr)
- tat->activityType = activityTypeClose;
+ tat->_activityType = activityTypeClose;
}
//-----------------------------------------------------------------------
@@ -1038,9 +1038,9 @@ void TileActivityTask::doScript(ActiveItem &activeInstance, uint8 finalState, Th
if (scr)
debugC(3, kDebugTasks, "TAT Assign Script!");
- tat->activityType = activityTypeScript;
- tat->targetState = finalState;
- tat->script = scr;
+ tat->_activityType = activityTypeScript;
+ tat->_targetState = finalState;
+ tat->_script = scr;
} else {
debugC(3, kDebugTasks, "Waking up thread 'cause newTask Failed");
@@ -1056,38 +1056,38 @@ void TileActivityTask::updateActiveItems() {
for (Common::List<TileActivityTask *>::iterator it = g_vm->_aTaskList->_list.begin(); it != g_vm->_aTaskList->_list.end();) {
TileActivityTask *tat = *it;
- ActiveItem *activityInstance = tat->tai;
+ ActiveItem *activityInstance = tat->_tai;
bool activityTaskDone = false;
- int16 mapNum = activityInstance->getMapNum();
- uint16 state = activityInstance->getInstanceState(mapNum);
+ int16 _mapNum = activityInstance->getMapNum();
+ uint16 state = activityInstance->getInstanceState(_mapNum);
// collecting stats
count++;
- if (tat->script != NoThread)
+ if (tat->_script != NoThread)
scriptCount++;
- switch (tat->activityType) {
+ switch (tat->_activityType) {
case activityTypeOpen:
if (state < 3)
- activityInstance->setInstanceState(mapNum, state + 1);
+ activityInstance->setInstanceState(_mapNum, state + 1);
else
activityTaskDone = true;
break;
case activityTypeClose:
if (state > 0)
- activityInstance->setInstanceState(mapNum, state - 1);
+ activityInstance->setInstanceState(_mapNum, state - 1);
else
activityTaskDone = true;
break;
case activityTypeScript:
- if (state > tat->targetState)
- activityInstance->setInstanceState(mapNum, state - 1);
- else if (state < tat->targetState)
- activityInstance->setInstanceState(mapNum, state + 1);
+ if (state > tat->_targetState)
+ activityInstance->setInstanceState(_mapNum, state - 1);
+ else if (state < tat->_targetState)
+ activityInstance->setInstanceState(_mapNum, state + 1);
else
activityTaskDone = true;
break;
@@ -1101,10 +1101,10 @@ void TileActivityTask::updateActiveItems() {
if (activityTaskDone) {
// Wake up the script...
- if (tat->script != NoThread) {
+ if (tat->_script != NoThread) {
debugC(3, kDebugTasks, "TAT Wake Up Thread");
- wakeUpThread(tat->script);
+ wakeUpThread(tat->_script);
}
tat->remove();
}
@@ -1118,7 +1118,7 @@ void TileActivityTask::updateActiveItems() {
TileActivityTask *TileActivityTask::find(ActiveItem *tai) {
for (Common::List<TileActivityTask *>::iterator it = g_vm->_aTaskList->_list.begin(); it != g_vm->_aTaskList->_list.end(); ++it) {
- if (tai == (*it)->tai)
+ if (tai == (*it)->_tai)
return *it;
}
@@ -1134,12 +1134,12 @@ bool TileActivityTask::setWait(ActiveItem *tai, ThreadID script) {
debugC(3, kDebugTasks, "Set Wait TAT\n");
if (tat) {
- if (tat->script != NoThread) {
+ if (tat->_script != NoThread) {
debugC(3, kDebugTasks, "TAT Waking Up Thread\n");
- wakeUpThread(tat->script);
+ wakeUpThread(tat->_script);
}
- tat->script = script;
+ tat->_script = script;
return true;
}
@@ -1509,12 +1509,12 @@ void cleanupMaps() {
//-----------------------------------------------------------------------
// Set a new current map
-void setCurrentMap(int mapNum) {
- g_vm->_currentMapNum = mapNum;
+void setCurrentMap(int _mapNum) {
+ g_vm->_currentMapNum = _mapNum;
if (lastMapNum != g_vm->_currentMapNum) {
lastMapNum = g_vm->_currentMapNum;
freeAllTileBanks();
- audioEnvironmentSetWorld(mapNum);
+ audioEnvironmentSetWorld(_mapNum);
}
lastUpdateTime = gameTime;
@@ -1766,7 +1766,7 @@ int16 ptHeight(const TilePoint &tp, uint8 *cornerHeight) {
// REM: This is a likely candidate for downcoding...
TileInfo *Platform::fetchTile(
- int16 mapNum,
+ int16 _mapNum,
const TilePoint &pt,
const TilePoint &origin,
int16 &height_,
@@ -1784,7 +1784,7 @@ TileInfo *Platform::fetchTile(
absPos;
groupItem = ActiveItem::activeItemAddress(
- ActiveItemID(mapNum, tr->tile));
+ ActiveItemID(_mapNum, tr->tile));
// Relpos is the relative position of the
// tile within the group
@@ -1800,14 +1800,14 @@ TileInfo *Platform::fetchTile(
absPos.z = h;
// Look up the group instance in the hash.
- instanceItem = mapList[mapNum].findHashedInstance(
+ instanceItem = mapList[_mapNum].findHashedInstance(
absPos,
tr->tile);
if (instanceItem) {
- state = instanceItem->getInstanceState(mapNum);
+ state = instanceItem->getInstanceState(_mapNum);
// Get the tile to be drawn from the tile group
- tr = &(mapList[mapNum].activeItemData)[
+ tr = &(mapList[_mapNum].activeItemData)[
groupItem->_data.group.grDataOffset
+ state * groupItem->_data.group.animArea
+ relPos.u * groupItem->_data.group.vSize
@@ -1848,7 +1848,7 @@ TileInfo *Platform::fetchTile(
// REM: This is a likely candidate for downcoding...
TileInfo *Platform::fetchTAGInstance(
- int16 mapNum,
+ int16 _mapNum,
const TilePoint &pt,
const TilePoint &origin,
StandingTileInfo &sti) {
@@ -1865,7 +1865,7 @@ TileInfo *Platform::fetchTAGInstance(
absPos;
groupItem = ActiveItem::activeItemAddress(
- ActiveItemID(mapNum, tr->tile));
+ ActiveItemID(_mapNum, tr->tile));
// Relpos is the relative position of the
// tile within the group
@@ -1881,15 +1881,15 @@ TileInfo *Platform::fetchTAGInstance(
absPos.z = h;
// Look up the group instance in the hash.
- instanceItem = mapList[mapNum].findHashedInstance(
+ instanceItem = mapList[_mapNum].findHashedInstance(
absPos,
tr->tile);
if (instanceItem) {
- state = instanceItem->getInstanceState(mapNum);
+ state = instanceItem->getInstanceState(_mapNum);
sti.surfaceTAG = instanceItem;
// Get the tile to be drawn from the tile group
- tr = &(mapList[mapNum].activeItemData)[
+ tr = &(mapList[_mapNum].activeItemData)[
groupItem->_data.group.grDataOffset
+ state * groupItem->_data.group.animArea
+ relPos.u * groupItem->_data.group.vSize
@@ -1922,7 +1922,7 @@ TileInfo *Platform::fetchTAGInstance(
// REM: This is a likely candidate for downcoding...
TileInfo *Platform::fetchTile(
- int16 mapNum,
+ int16 _mapNum,
const TilePoint &pt,
const TilePoint &origin,
uint8 **imageData,
@@ -1941,7 +1941,7 @@ TileInfo *Platform::fetchTile(
absPos;
groupItem = ActiveItem::activeItemAddress(
- ActiveItemID(mapNum, tr->tile));
+ ActiveItemID(_mapNum, tr->tile));
// Relpos is the relative position of the
// tile within the group
@@ -1957,14 +1957,14 @@ TileInfo *Platform::fetchTile(
absPos.z = h;
// Look up the group instance in the hash.
- instanceItem = mapList[mapNum].findHashedInstance(
+ instanceItem = mapList[_mapNum].findHashedInstance(
absPos,
tr->tile);
if (instanceItem) {
- state = instanceItem->getInstanceState(mapNum);
+ state = instanceItem->getInstanceState(_mapNum);
// Get the tile to be drawn from the tile group
- tr = &(mapList[mapNum].activeItemData)[
+ tr = &(mapList[_mapNum].activeItemData)[
groupItem->_data.group.grDataOffset
+ state * groupItem->_data.group.animArea
+ relPos.u * groupItem->_data.group.vSize
@@ -2005,7 +2005,7 @@ TileInfo *Platform::fetchTile(
// REM: This is a likely candidate for downcoding...
TileInfo *Platform::fetchTAGInstance(
- int16 mapNum,
+ int16 _mapNum,
const TilePoint &pt,
const TilePoint &origin,
uint8 **imageData,
@@ -2023,7 +2023,7 @@ TileInfo *Platform::fetchTAGInstance(
absPos;
groupItem = ActiveItem::activeItemAddress(
- ActiveItemID(mapNum, tr->tile));
+ ActiveItemID(_mapNum, tr->tile));
// Relpos is the relative position of the
// tile within the group
@@ -2039,15 +2039,15 @@ TileInfo *Platform::fetchTAGInstance(
absPos.z = h;
// Look up the group instance in the hash.
- instanceItem = mapList[mapNum].findHashedInstance(
+ instanceItem = mapList[_mapNum].findHashedInstance(
absPos,
tr->tile);
if (instanceItem) {
- state = instanceItem->getInstanceState(mapNum);
+ state = instanceItem->getInstanceState(_mapNum);
sti.surfaceTAG = instanceItem;
// Get the tile to be drawn from the tile group
- tr = &(mapList[mapNum].activeItemData)[
+ tr = &(mapList[_mapNum].activeItemData)[
groupItem->_data.group.grDataOffset
+ state * groupItem->_data.group.animArea
+ relPos.u * groupItem->_data.group.vSize
@@ -2108,8 +2108,8 @@ MetaTile *MetaTile::metaTileAddress(MetaTileID id) {
//-----------------------------------------------------------------------
// Return this meta tile's ID
-MetaTileID MetaTile::thisID(int16 mapNum) {
- return MetaTileID(mapNum, _index);
+MetaTileID MetaTile::thisID(int16 _mapNum) {
+ return MetaTileID(_mapNum, _index);
}
//-----------------------------------------------------------------------
@@ -2122,14 +2122,14 @@ metaTileNoise MetaTile::HeavyMetaMusic() {
//-----------------------------------------------------------------------
// Return a pointer to the specified platform
-Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
+Platform *MetaTile::fetchPlatform(int16 _mapNum, int16 layer) {
const int cacheFlag = 0x8000;
uint16 plIndex = _stack[layer];
PlatformCacheEntry *pce;
Common::SeekableReadStream *stream;
assert(layer >= 0);
- assert(_parent == mapList[mapNum].metaList);
+ assert(_parent == mapList[_mapNum].metaList);
if (plIndex == (uint16)nullID) {
return nullptr;
@@ -2142,7 +2142,7 @@ Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
pce = &platformCache[plIndex];
assert(pce->metaID != NoMetaTile);
- assert(pce->metaID == thisID(mapNum));
+ assert(pce->metaID == thisID(_mapNum));
// Move to the end of the LRU
g_vm->_platformLRU.remove(plIndex);
@@ -2151,7 +2151,7 @@ Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
// return the address of the platform
return &pce->pl;
} else {
- debugC(2, kDebugLoading, "Fetching platform (%d,%d)", mapNum, layer);
+ debugC(2, kDebugLoading, "Fetching platform (%d,%d)", _mapNum, layer);
// Since the platform is not in the cache, we need to
// dump something from the cache. Dump the one that
@@ -2178,14 +2178,14 @@ Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
// Initialize the cache entry to the new platform data.
pce->platformNum = plIndex;
pce->layerNum = layer;
- pce->metaID = thisID(mapNum);
+ pce->metaID = thisID(_mapNum);
_stack[layer] = (cacheIndex | cacheFlag);
- assert(plIndex * sizeof(Platform) < tileRes->size(platformID + mapNum));
+ assert(plIndex * sizeof(Platform) < tileRes->size(platformID + _mapNum));
debugC(3, kDebugLoading, "- plIndex: %d", plIndex);
// Now, load the actual metatile data...
- if ((stream = loadResourceToStream(tileRes, platformID + mapNum, "platform"))) {
+ if ((stream = loadResourceToStream(tileRes, platformID + _mapNum, "platform"))) {
if (stream->skip(plIndex * sizeof(Platform))) {
pce->pl.load(stream);
delete stream;
@@ -2193,7 +2193,7 @@ Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
}
}
- error("Unable to read Platform %d of map %d", plIndex, mapNum);
+ error("Unable to read Platform %d of map %d", plIndex, _mapNum);
return nullptr;
}
}
@@ -2202,8 +2202,8 @@ Platform *MetaTile::fetchPlatform(int16 mapNum, int16 layer) {
// Return a pointer to this metatile's current object ripping
// table
-RipTable *MetaTile::ripTable(int16 mapNum) {
- WorldMapData *mapData = &mapList[mapNum];
+RipTable *MetaTile::ripTable(int16 _mapNum) {
+ WorldMapData *mapData = &mapList[_mapNum];
return RipTable::ripTableAddress((mapData->ripTableIDList)[_index]);
}
@@ -2211,8 +2211,8 @@ RipTable *MetaTile::ripTable(int16 mapNum) {
//-----------------------------------------------------------------------
// Return a reference to this meta tile's rip table ID
-RipTableID &MetaTile::ripTableID(int16 mapNum) {
- WorldMapData *mapData = &mapList[mapNum];
+RipTableID &MetaTile::ripTableID(int16 _mapNum) {
+ WorldMapData *mapData = &mapList[_mapNum];
return (mapData->ripTableIDList)[_index];
}
@@ -2337,9 +2337,9 @@ ActiveItem *WorldMapData::findHashedInstance(
* ====================================================================== */
bool MetaTileIterator::iterate() {
- if (++mCoords.v >= region.max.v) {
- if (++mCoords.u >= region.max.u) return false;
- mCoords.v = region.min.v;
+ if (++_mCoords.v >= _region.max.v) {
+ if (++_mCoords.u >= _region.max.u) return false;
+ _mCoords.v = _region.min.v;
}
return true;
@@ -2348,17 +2348,17 @@ bool MetaTileIterator::iterate() {
MetaTile *MetaTileIterator::first(TilePoint *loc) {
MetaTile *mtRes;
- mCoords = region.min;
- if (mCoords.u >= region.max.u || mCoords.v >= region.max.v)
+ _mCoords = _region.min;
+ if (_mCoords.u >= _region.max.u || _mCoords.v >= _region.max.v)
return nullptr;
- mtRes = mapList[mapNum].lookupMeta(mCoords);
+ mtRes = mapList[_mapNum].lookupMeta(_mCoords);
while (mtRes == nullptr) {
if (!iterate()) return nullptr;
- mtRes = mapList[mapNum].lookupMeta(mCoords);
+ mtRes = mapList[_mapNum].lookupMeta(_mCoords);
}
- if (loc) *loc = mCoords << kPlatShift;
+ if (loc) *loc = _mCoords << kPlatShift;
return mtRes;
}
@@ -2367,10 +2367,10 @@ MetaTile *MetaTileIterator::next(TilePoint *loc) {
do {
if (!iterate()) return nullptr;
- mtRes = mapList[mapNum].lookupMeta(mCoords);
+ mtRes = mapList[_mapNum].lookupMeta(_mCoords);
} while (mtRes == nullptr);
- if (loc) *loc = mCoords << kPlatShift;
+ if (loc) *loc = _mCoords << kPlatShift;
return mtRes;
}
@@ -2379,36 +2379,36 @@ MetaTile *MetaTileIterator::next(TilePoint *loc) {
* ====================================================================== */
bool TileIterator::iterate() {
- if (++tCoords.v >= tCoordsReg.max.v) {
- if (++tCoords.u >= tCoordsReg.max.u) {
+ if (++_tCoords.v >= _tCoordsReg.max.v) {
+ if (++_tCoords.u >= _tCoordsReg.max.u) {
do {
- platIndex++;
- if (platIndex >= maxPlatforms) {
- if ((mt = metaIter.next(&origin)) != nullptr) {
- tCoordsReg.min.u = tCoordsReg.min.v = 0;
- tCoordsReg.max.u = tCoordsReg.max.v = kPlatformWidth;
-
- if (origin.u < region.min.u)
- tCoordsReg.min.u = region.min.u & kPlatMask;
- if (origin.u + kPlatformWidth > region.max.u)
- tCoordsReg.max.u = region.max.u & kPlatMask;
- if (origin.v < region.min.v)
- tCoordsReg.min.v = region.min.v & kPlatMask;
- if (origin.v + kPlatformWidth > region.max.v)
- tCoordsReg.max.v = region.max.v & kPlatMask;
+ _platIndex++;
+ if (_platIndex >= maxPlatforms) {
+ if ((_mt = _metaIter.next(&_origin)) != nullptr) {
+ _tCoordsReg.min.u = _tCoordsReg.min.v = 0;
+ _tCoordsReg.max.u = _tCoordsReg.max.v = kPlatformWidth;
+
+ if (_origin.u < _region.min.u)
+ _tCoordsReg.min.u = _region.min.u & kPlatMask;
+ if (_origin.u + kPlatformWidth > _region.max.u)
+ _tCoordsReg.max.u = _region.max.u & kPlatMask;
+ if (_origin.v < _region.min.v)
+ _tCoordsReg.min.v = _region.min.v & kPlatMask;
+ if (_origin.v + kPlatformWidth > _region.max.v)
+ _tCoordsReg.max.v = _region.max.v & kPlatMask;
} else
return false;
- platIndex = 0;
+ _platIndex = 0;
}
- platform = mt->fetchPlatform(
- metaIter.getMapNum(),
- platIndex);
- } while (platform == nullptr);
+ _platform = _mt->fetchPlatform(
+ _metaIter.getMapNum(),
+ _platIndex);
+ } while (_platform == nullptr);
- tCoords.u = tCoordsReg.min.u;
+ _tCoords.u = _tCoordsReg.min.u;
}
- tCoords.v = tCoordsReg.min.v;
+ _tCoords.v = _tCoordsReg.min.v;
}
return true;
@@ -2418,49 +2418,49 @@ TileInfo *TileIterator::first(TilePoint *loc, StandingTileInfo *stiResult) {
TileInfo *tiRes;
StandingTileInfo sti;
- if (region.max.u <= region.min.u || region.max.v <= region.min.v)
+ if (_region.max.u <= _region.min.u || _region.max.v <= _region.min.v)
return nullptr;
- if ((mt = metaIter.first(&origin)) == nullptr) return nullptr;
+ if ((_mt = _metaIter.first(&_origin)) == nullptr) return nullptr;
- platform = mt->fetchPlatform(metaIter.getMapNum(), platIndex = 0);
- while (platform == nullptr) {
- platIndex++;
- if (platIndex >= maxPlatforms) {
- if ((mt = metaIter.next(&origin)) == nullptr) return nullptr;
- platIndex = 0;
+ _platform = _mt->fetchPlatform(_metaIter.getMapNum(), _platIndex = 0);
+ while (_platform == nullptr) {
+ _platIndex++;
+ if (_platIndex >= maxPlatforms) {
+ if ((_mt = _metaIter.next(&_origin)) == nullptr) return nullptr;
+ _platIndex = 0;
}
- platform = mt->fetchPlatform(metaIter.getMapNum(), platIndex);
+ _platform = _mt->fetchPlatform(_metaIter.getMapNum(), _platIndex);
}
- tCoordsReg.min.u = tCoordsReg.min.v = 0;
- tCoordsReg.max.u = tCoordsReg.max.v = kPlatformWidth;
-
- if (origin.u < region.min.u)
- tCoordsReg.min.u = region.min.u & kPlatMask;
- if (origin.u + kPlatformWidth > region.max.u)
- tCoordsReg.max.u = region.max.u & kPlatMask;
- if (origin.v < region.min.v)
- tCoordsReg.min.v = region.min.v & kPlatMask;
- if (origin.v + kPlatformWidth > region.max.v)
- tCoordsReg.max.v = region.max.v & kPlatMask;
-
- tCoords = tCoordsReg.min;
- tiRes = platform->fetchTAGInstance(
- metaIter.getMapNum(),
- tCoords,
- origin,
+ _tCoordsReg.min.u = _tCoordsReg.min.v = 0;
+ _tCoordsReg.max.u = _tCoordsReg.max.v = kPlatformWidth;
+
+ if (_origin.u < _region.min.u)
+ _tCoordsReg.min.u = _region.min.u & kPlatMask;
+ if (_origin.u + kPlatformWidth > _region.max.u)
+ _tCoordsReg.max.u = _region.max.u & kPlatMask;
+ if (_origin.v < _region.min.v)
+ _tCoordsReg.min.v = _region.min.v & kPlatMask;
+ if (_origin.v + kPlatformWidth > _region.max.v)
+ _tCoordsReg.max.v = _region.max.v & kPlatMask;
+
+ _tCoords = _tCoordsReg.min;
+ tiRes = _platform->fetchTAGInstance(
+ _metaIter.getMapNum(),
+ _tCoords,
+ _origin,
sti);
while (tiRes == nullptr) {
if (!iterate()) return nullptr;
- tiRes = platform->fetchTAGInstance(
- metaIter.getMapNum(),
- tCoords,
- origin,
+ tiRes = _platform->fetchTAGInstance(
+ _metaIter.getMapNum(),
+ _tCoords,
+ _origin,
sti);
}
- *loc = tCoords + origin;
+ *loc = _tCoords + _origin;
if (stiResult) *stiResult = sti;
return tiRes;
}
@@ -2471,14 +2471,14 @@ TileInfo *TileIterator::next(TilePoint *loc, StandingTileInfo *stiResult) {
do {
if (!iterate()) return nullptr;
- tiRes = platform->fetchTAGInstance(
- metaIter.getMapNum(),
- tCoords,
- origin,
+ tiRes = _platform->fetchTAGInstance(
+ _metaIter.getMapNum(),
+ _tCoords,
+ _origin,
sti);
} while (tiRes == nullptr);
- *loc = tCoords + origin;
+ *loc = _tCoords + _origin;
if (stiResult) *stiResult = sti;
return tiRes;
}
@@ -2657,13 +2657,13 @@ void buildRipTable(
// the center view object
void buildRipTables() {
- const int16 regionRadius = kTileUVSize * kPlatformWidth * 2;
+ const int16 _regionRadius = kTileUVSize * kPlatformWidth * 2;
TilePoint actorCoords;
MetaTile *mt;
TileRegion ripTableReg;
- MetaTile *mtTable[25]; // Largest region is 5x5
+ MetaTile *mtTable[25]; // Largest _region is 5x5
int16 mtTableSize = 0;
getViewTrackPos(actorCoords);
@@ -2671,14 +2671,14 @@ void buildRipTables() {
ripTableCoords.v = actorCoords.v >> (kTileUVShift + kPlatShift);
ripTableCoords.z = 0;
- // Calculate the region of meta tile for which to build object
+ // Calculate the _region of meta tile for which to build object
// ripping table
- ripTableReg.min.u = (actorCoords.u - regionRadius) >> kTileUVShift;
- ripTableReg.min.v = (actorCoords.v - regionRadius) >> kTileUVShift;
+ ripTableReg.min.u = (actorCoords.u - _regionRadius) >> kTileUVShift;
+ ripTableReg.min.v = (actorCoords.v - _regionRadius) >> kTileUVShift;
ripTableReg.max.u =
- (actorCoords.u + regionRadius + kTileUVMask) >> kTileUVShift;
+ (actorCoords.u + _regionRadius + kTileUVMask) >> kTileUVShift;
ripTableReg.max.v =
- (actorCoords.v + regionRadius + kTileUVMask) >> kTileUVShift;
+ (actorCoords.v + _regionRadius + kTileUVMask) >> kTileUVShift;
MetaTileIterator mIter(g_vm->_currentMapNum, ripTableReg);
@@ -3777,7 +3777,7 @@ bool pointOnHiddenSurface(
WorldMapData *curMap = &mapList[g_vm->_currentMapNum];
TilePoint testCoords,
- mCoords,
+ _mCoords,
tCoords,
origin;
MetaTile *mt;
@@ -3808,16 +3808,16 @@ bool pointOnHiddenSurface(
adjSubMask = 0x0008 << (testCoords.u & ~kSubTileMask);
}
- mCoords = adjTCoords >> kPlatShift;
+ _mCoords = adjTCoords >> kPlatShift;
// If metatile of adjacent tile does not exist, the pick point
// is valid.
- if ((mt = curMap->lookupMeta(mCoords)) == nullptr) return false;
+ if ((mt = curMap->lookupMeta(_mCoords)) == nullptr) return false;
tCoords.u = adjTCoords.u & kPlatMask;
tCoords.v = adjTCoords.v & kPlatMask;
tCoords.z = 0;
- origin = mCoords << kPlatShift;
+ origin = _mCoords << kPlatShift;
int i;
@@ -3880,7 +3880,7 @@ StaticTilePoint pickTile(Point32 pos,
int16 zMax,
zMin,
mag;
- TilePoint mCoords,
+ TilePoint _mCoords,
tCoords,
origin,
testCoords,
@@ -3942,14 +3942,14 @@ StaticTilePoint pickTile(Point32 pos,
// Compute which metatile the click occurred on, and the tile
// within that metatile, and the origin coords of the metatile
- mCoords = tileCoords >> kPlatShift;
+ _mCoords = tileCoords >> kPlatShift;
tCoords.u = tileCoords.u & kPlatMask;
tCoords.v = tileCoords.v & kPlatMask;
tCoords.z = 0;
- origin = mCoords << kPlatShift;
+ origin = _mCoords << kPlatShift;
// Lookup the metatile
- mt = curMap->lookupMeta(mCoords);
+ mt = curMap->lookupMeta(_mCoords);
// While we are less than the pick altitude
while (relPos.y < zMax + kTileDX + kMaxStepHeight - ABS(relPos.x >> 1)) {
@@ -4032,9 +4032,9 @@ StaticTilePoint pickTile(Point32 pos,
coords.u -= kTileUVSize;
if (tCoords.u < 0) {
tCoords.u = kPlatformWidth - 1;
- mCoords.u--;
- origin = mCoords << kPlatShift;
- mt = curMap->lookupMeta(mCoords);
+ _mCoords.u--;
+ origin = _mCoords << kPlatShift;
+ mt = curMap->lookupMeta(_mCoords);
}
relPos.x += kTileDX;
} else {
@@ -4042,9 +4042,9 @@ StaticTilePoint pickTile(Point32 pos,
coords.v -= kTileUVSize;
if (tCoords.v < 0) {
tCoords.v = kPlatformWidth - 1;
- mCoords.v--;
- origin = mCoords << kPlatShift;
- mt = curMap->lookupMeta(mCoords);
+ _mCoords.v--;
+ origin = _mCoords << kPlatShift;
+ mt = curMap->lookupMeta(_mCoords);
}
relPos.x -= kTileDX;
}
@@ -4081,22 +4081,22 @@ StaticTilePoint pickTile(Point32 pos,
void cycleTiles(int32 delta) {
if (delta <= 0) return;
- for (int i = 0; i < cycleCount; i++) {
- TileCycleData &tcd = cycleList[i];
+ for (int i = 0; i < _cycleCount; i++) {
+ TileCycleData &tcd = _cycleList[i];
- tcd.counter += tcd.cycleSpeed * delta;
- if (tcd.counter >= 400) {
- tcd.counter = 0;
- tcd.currentState++;
- if (tcd.currentState >= tcd.numStates)
- tcd.currentState = 0;
+ tcd._counter += tcd._cycleSpeed * delta;
+ if (tcd._counter >= 400) {
+ tcd._counter = 0;
+ tcd._currentState++;
+ if (tcd._currentState >= tcd._numStates)
+ tcd._currentState = 0;
}
}
}
struct TileCycleArchive {
int32 counter;
- uint8 currentState;
+ uint8 _currentState;
};
//-----------------------------------------------------------------------
@@ -4106,17 +4106,17 @@ void initTileCyclingStates() {
Common::SeekableReadStream *stream;
const int tileCycleDataSize = 40;
- cycleCount = tileRes->size(cycleID) / tileCycleDataSize;
- cycleList = new TileCycleData[cycleCount];
+ _cycleCount = tileRes->size(cycleID) / tileCycleDataSize;
+ _cycleList = new TileCycleData[_cycleCount];
- if (cycleList == nullptr)
+ if (_cycleList == nullptr)
error("Unable to load tile cycling data");
if ((stream = loadResourceToStream(tileRes, cycleID, "cycle list"))) {
- for (int i = 0; i < cycleCount; ++i)
- cycleList[i].load(stream);
+ for (int i = 0; i < _cycleCount; ++i)
+ _cycleList[i].load(stream);
- debugC(2, kDebugLoading, "Loaded Cycles: cycleCount = %d", cycleCount);
+ debugC(2, kDebugLoading, "Loaded Cycles: _cycleCount = %d", _cycleCount);
delete stream;
}
}
@@ -4125,14 +4125,14 @@ void saveTileCyclingStates(Common::OutSaveFile *outS) {
debugC(2, kDebugSaveload, "Saving TileCyclingStates");
outS->write("CYCL", 4);
CHUNK_BEGIN;
- for (int i = 0; i < cycleCount; i++) {
+ for (int i = 0; i < _cycleCount; i++) {
debugC(3, kDebugSaveload, "Saving TileCyclingState %d", i);
- out->writeSint32LE(cycleList[i].counter);
- out->writeByte(cycleList[i].currentState);
+ out->writeSint32LE(_cycleList[i]._counter);
+ out->writeByte(_cycleList[i]._currentState);
- debugC(4, kDebugSaveload, "... counter = %d", cycleList[i].counter);
- debugC(4, kDebugSaveload, "... currentState = %d", cycleList[i].currentState);
+ debugC(4, kDebugSaveload, "... counter = %d", _cycleList[i]._counter);
+ debugC(4, kDebugSaveload, "... currentState = %d", _cycleList[i]._currentState);
}
CHUNK_END;
}
@@ -4142,13 +4142,13 @@ void loadTileCyclingStates(Common::InSaveFile *in) {
initTileCyclingStates();
- for (int i = 0; i < cycleCount; i++) {
+ for (int i = 0; i < _cycleCount; i++) {
debugC(3, kDebugSaveload, "Loading TileCyclingState %d", i);
- cycleList[i].counter = in->readSint32LE();
- cycleList[i].currentState = in->readByte();
+ _cycleList[i]._counter = in->readSint32LE();
+ _cycleList[i]._currentState = in->readByte();
- debugC(4, kDebugSaveload, "... counter = %d", cycleList[i].counter);
- debugC(4, kDebugSaveload, "... currentState = %d", cycleList[i].currentState);
+ debugC(4, kDebugSaveload, "... counter = %d", _cycleList[i]._counter);
+ debugC(4, kDebugSaveload, "... currentState = %d", _cycleList[i]._currentState);
}
}
@@ -4156,9 +4156,9 @@ void loadTileCyclingStates(Common::InSaveFile *in) {
// Cleanup the tile cycling state array
void cleanupTileCyclingStates() {
- if (cycleList != nullptr) {
- delete[] cycleList;
- cycleList = nullptr;
+ if (_cycleList != nullptr) {
+ delete[] _cycleList;
+ _cycleList = nullptr;
}
}
@@ -4219,8 +4219,8 @@ uint16 objRoofID(GameObject *obj, int16 objMapNum, const TilePoint &objCoords) {
origin.u = metaU << kPlatShift;
origin.v = metaV << kPlatShift;
- // Compute the tile region relative to the origin of this
- // meta tile clipped to this meta tile region
+ // Compute the tile _region relative to the origin of this
+ // meta tile clipped to this meta tile _region
relTileReg.min.u = MAX(objTileReg.min.u - origin.u, 0);
relTileReg.min.v = MAX(objTileReg.min.v - origin.v, 0);
relTileReg.max.u = MIN(objTileReg.max.u - origin.u, (int)kPlatformWidth);
@@ -4327,7 +4327,7 @@ void updateMainDisplay() {
scrollDistance;
TilePoint trackPos,
- mCoords;
+ _mCoords;
lastUpdateTime = gameTime;
@@ -4390,13 +4390,13 @@ void updateMainDisplay() {
// encloses the view area, and convert to sector coords.
buildRoofTable();
- mCoords.u = trackPos.u >> (kTileUVShift + kPlatShift);
- mCoords.v = trackPos.v >> (kTileUVShift + kPlatShift);
- mCoords.z = 0;
+ _mCoords.u = trackPos.u >> (kTileUVShift + kPlatShift);
+ _mCoords.v = trackPos.v >> (kTileUVShift + kPlatShift);
+ _mCoords.z = 0;
// If trackPos has crossed a metatile boundry, rebuild object
// ripping tables
- if (mCoords != ripTableCoords) buildRipTables();
+ if (_mCoords != ripTableCoords) buildRipTables();
// Build the list of all displayed objects
buildDisplayList();
diff --git a/engines/saga2/tile.h b/engines/saga2/tile.h
index 5d50213e7e8..8d37879f2d1 100644
--- a/engines/saga2/tile.h
+++ b/engines/saga2/tile.h
@@ -304,29 +304,28 @@ void drawMainDisplay();
class TileCycleData {
public:
- int32 counter; // cycling counter
- uint8 pad; // odd-byte pad
- uint8 numStates, // number of animated states
- currentState, // current state of animation
- cycleSpeed; // speed of cycling (0=none)
+ int32 _counter; // cycling counter
+ uint8 _pad; // odd-byte pad
+ uint8 _numStates, // number of animated states
+ _currentState, // current state of animation
+ _cycleSpeed; // speed of cycling (0=none)
- TileID cycleList[16]; // array of tiles
+ TileID _cycleList[16]; // array of tiles
void load(Common::SeekableReadStream *stream) {
- counter = stream->readSint32LE();
- pad = stream->readByte();
- numStates = stream->readByte();
- currentState = stream->readByte();
- cycleSpeed = stream->readByte();
+ _counter = stream->readSint32LE();
+ _pad = stream->readByte();
+ _numStates = stream->readByte();
+ _currentState = stream->readByte();
+ _cycleSpeed = stream->readByte();
for (int i = 0; i < 16; ++i)
- cycleList[i] = stream->readUint16LE();
+ _cycleList[i] = stream->readUint16LE();
}
};
-typedef TileCycleData
-*CyclePtr, // pointer to cycle data
-* *CycleHandle; // handle to cycle data
+typedef TileCycleData *CyclePtr, // pointer to cycle data
+ **CycleHandle; // handle to cycle data
const int maxCycleRanges = 128; // 128 should do for now...
@@ -522,8 +521,8 @@ class TileHitZone : public ActiveItem {
public:
// REM: Allow discontiguous regions??
- int16 numVertices;
- XArray<Point16> vertexList;
+ int16 _numVertices;
+ XArray<Point16> _vertexList;
int16 type() {
return activeTypeHitZone;
@@ -541,12 +540,12 @@ public:
class ObjectInstance : public ActiveItem {
public:
- TileGroupID classID; // ID of object class
+ TileGroupID _classID; // ID of object class
// An instance of a specific object.
- uint16 u, v, h; // where the instance lies
- uint8 facing; // which direction it's facing
+ uint16 _u, _v, _h; // where the instance lies
+ uint8 _facing; // which direction it's facing
int16 type() {
return activeTypeObject;
@@ -569,10 +568,10 @@ class TileActivityTask {
friend class TileActivityTaskList;
friend class ActiveItem;
- uint8 activityType; // open or close
- uint8 targetState;
- ActiveItem *tai; // the tile activity instance
- ThreadID script; // script to wake up when task done
+ uint8 _activityType; // open or close
+ uint8 _targetState;
+ ActiveItem *_tai; // the tile activity instance
+ ThreadID _script; // script to wake up when task done
enum activityTypes {
activityTypeNone, // no activity
@@ -915,27 +914,27 @@ struct WorldMapData {
* ===================================================================== */
class MetaTileIterator {
- TilePoint mCoords;
- TileRegion region;
+ TilePoint _mCoords;
+ TileRegion _region;
- int16 mapNum;
+ int16 _mapNum;
bool iterate();
public:
- MetaTileIterator(int16 map, const TileRegion ®) : mapNum(map) {
- region.min.u = reg.min.u >> kPlatShift;
- region.max.u = (reg.max.u + kPlatMask) >> kPlatShift;
- region.min.v = reg.min.v >> kPlatShift;
- region.max.v = (reg.max.v + kPlatMask) >> kPlatShift;
- region.min.z = region.max.z = 0;
+ MetaTileIterator(int16 map, const TileRegion ®) : _mapNum(map) {
+ _region.min.u = reg.min.u >> kPlatShift;
+ _region.max.u = (reg.max.u + kPlatMask) >> kPlatShift;
+ _region.min.v = reg.min.v >> kPlatShift;
+ _region.max.v = (reg.max.v + kPlatMask) >> kPlatShift;
+ _region.min.z = _region.max.z = 0;
}
MetaTile *first(TilePoint *loc = NULL);
MetaTile *next(TilePoint *loc = NULL);
int16 getMapNum() {
- return mapNum;
+ return _mapNum;
}
};
@@ -944,24 +943,24 @@ public:
* ===================================================================== */
class TileIterator {
- MetaTileIterator metaIter;
- MetaTile *mt;
- int16 platIndex;
- Platform *platform;
- TilePoint tCoords,
- origin;
- TileRegion region,
- tCoordsReg;
+ MetaTileIterator _metaIter;
+ MetaTile *_mt;
+ int16 _platIndex;
+ Platform *_platform;
+ TilePoint _tCoords,
+ _origin;
+ TileRegion _region,
+ _tCoordsReg;
bool iterate();
public:
TileIterator(int16 mapNum, const TileRegion ®) :
- metaIter(mapNum, reg),
- region(reg) {
- mt = nullptr;
- platIndex = 0;
- platform = nullptr;
+ _metaIter(mapNum, reg),
+ _region(reg) {
+ _mt = nullptr;
+ _platIndex = 0;
+ _platform = nullptr;
}
TileInfo *first(TilePoint *loc, StandingTileInfo *stiResult = NULL);
Commit: 8a357493342cf33a1660229ab785044c44ac2d9f
https://github.com/scummvm/scummvm/commit/8a357493342cf33a1660229ab785044c44ac2d9f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in tilemode.cpp
Changed paths:
engines/saga2/tilemode.cpp
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index d33844d4fa5..c64144213d4 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -56,16 +56,16 @@ namespace Saga2 {
* ===================================================================== */
class gStickyDragControl : public gGenericControl {
- bool sticky;
+ bool _sticky;
public:
gStickyDragControl(gPanelList &, const Rect16 &, uint16, AppFunc *cmd = nullptr);
void setSticky(bool s) {
- sticky = s;
+ _sticky = s;
}
bool isSticky() {
- return sticky;
+ return _sticky;
}
private:
@@ -1401,18 +1401,18 @@ void cheatMove(int16 key) {
#endif
/* ===================================================================== *
- gStickyDragControl class: a gGenericControl with a sticky mouse
+ gStickyDragControl class: a gGenericControl with a _sticky mouse
* ===================================================================== */
gStickyDragControl::gStickyDragControl(gPanelList &list, const Rect16 &box,
uint16 ident, AppFunc *cmd)
: gGenericControl(list, box, ident, cmd) {
- sticky = false;
+ _sticky = false;
}
void gStickyDragControl::deactivate() {
- if (sticky) setMouseImage(kMouseArrowImage, 0, 0);
- sticky = false;
+ if (_sticky) setMouseImage(kMouseArrowImage, 0, 0);
+ _sticky = false;
gGenericControl::deactivate();
}
@@ -1422,13 +1422,13 @@ void gStickyDragControl::deactivate() {
//}
bool gStickyDragControl::pointerHit(gPanelMessage &msg) {
- if (sticky) setMouseImage(kMouseArrowImage, 0, 0);
- sticky = false;
+ if (_sticky) setMouseImage(kMouseArrowImage, 0, 0);
+ _sticky = false;
return gGenericControl::pointerHit(msg);
}
void gStickyDragControl::pointerRelease(gPanelMessage &msg) {
- if (sticky == false)
+ if (_sticky == false)
gGenericControl::pointerRelease(msg);
}
Commit: 2865f33aa325f3f2b9fe3cc4ca9731d3d8a321ee
https://github.com/scummvm/scummvm/commit/2865f33aa325f3f2b9fe3cc4ca9731d3d8a321ee
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in uidialog.h
Changed paths:
engines/saga2/uidialog.cpp
engines/saga2/uidialog.h
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 739c57cf623..025bb49f8a0 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -1257,8 +1257,8 @@ CPlacardWindow::CPlacardWindow(
textPallete &pal,
gFont *font) :
ModalWindow(r, ident, cmd) {
- textPal = pal;
- textFont = font;
+ _textPal = pal;
+ _textFont = font;
positionText(windowText, Rect16(0, 0, r.width, r.height));
}
@@ -1271,31 +1271,31 @@ void CPlacardWindow::positionText(
yPos,
maxY;
- int16 fontHeight = textFont->height;
+ int16 fontHeight = _textFont->height;
// make a copy of the window text string
- sprintf(titleBuf, "%s", windowText);
+ sprintf(_titleBuf, "%s", windowText);
// break up the title text string
- titleCount = SplitString(titleBuf, titleStrings, maxLines, '\n');
+ _titleCount = SplitString(_titleBuf, _titleStrings, maxLines, '\n');
yPos = textArea.y +
- ((textArea.height - titleCount * fontHeight) >> 1);
+ ((textArea.height - _titleCount * fontHeight) >> 1);
yPos = MAX(yPos, textArea.y);
maxY = textArea.y + textArea.height - fontHeight;
- for (i = 0; i < titleCount; i++, yPos += fontHeight) {
+ for (i = 0; i < _titleCount; i++, yPos += fontHeight) {
if (yPos < maxY) {
- titlePos[i].y = yPos;
- titlePos[i].x =
+ _titlePos[i].y = yPos;
+ _titlePos[i].x =
textArea.x +
((textArea.width -
- TextWidth(textFont, titleStrings[i], -1, 0))
+ TextWidth(_textFont, _titleStrings[i], -1, 0))
>> 1);
- } else titleCount = i;
+ } else _titleCount = i;
}
- } else titleCount = 0;
+ } else _titleCount = 0;
}
int16 CPlacardWindow:: SplitString(
@@ -1354,16 +1354,16 @@ void CPlacardWindow::drawClipped(
rect.width = _extent.width;
rect.height = _extent.height;
- for (i = 0; i < titleCount; i++) {
- Point16 textPos = origin + titlePos[i];
+ for (i = 0; i < _titleCount; i++) {
+ Point16 textPos = origin + _titlePos[i];
writePlaqTextPos(port,
textPos,
- textFont,
+ _textFont,
0,
- textPal,
+ _textPal,
false,
- titleStrings[i]);
+ _titleStrings[i]);
}
}
@@ -1385,28 +1385,28 @@ void CPlacardPanel::positionText(const char *windowText, const Rect16 &textArea)
int16 fontHeight = _buttonFont->height;
// make a copy of the window text string
- sprintf(titleBuf, "%s", windowText);
+ sprintf(_titleBuf, "%s", windowText);
// break up the title text string
- titleCount = SplitString(titleBuf, titleStrings, maxLines, '\n');
+ _titleCount = SplitString(_titleBuf, _titleStrings, maxLines, '\n');
yPos = textArea.y +
- ((textArea.height - titleCount * fontHeight) >> 1);
+ ((textArea.height - _titleCount * fontHeight) >> 1);
yPos = MAX(yPos, textArea.y);
maxY = textArea.y + textArea.height - fontHeight;
- for (i = 0; i < titleCount; i++, yPos += fontHeight) {
+ for (i = 0; i < _titleCount; i++, yPos += fontHeight) {
if (yPos < maxY) {
- titlePos[i].y = yPos;
- titlePos[i].x =
+ _titlePos[i].y = yPos;
+ _titlePos[i].x =
textArea.x +
((textArea.width -
- TextWidth(_buttonFont, titleStrings[i], -1, 0))
+ TextWidth(_buttonFont, _titleStrings[i], -1, 0))
>> 1);
- } else titleCount = i;
+ } else _titleCount = i;
}
- } else titleCount = 0;
+ } else _titleCount = 0;
}
int16 CPlacardPanel:: SplitString(
@@ -1445,8 +1445,8 @@ void CPlacardPanel::drawClipped(
rect.width = _extent.width;
rect.height = _extent.height;
- for (i = 0; i < titleCount; i++) {
- Point16 textPos = origin + titlePos[i];
+ for (i = 0; i < _titleCount; i++) {
+ Point16 textPos = origin + _titlePos[i];
writePlaqTextPos(port,
textPos,
@@ -1454,7 +1454,7 @@ void CPlacardPanel::drawClipped(
0,
_textFacePal,
false,
- titleStrings[i]);
+ _titleStrings[i]);
}
}
diff --git a/engines/saga2/uidialog.h b/engines/saga2/uidialog.h
index 683a10c240e..2b0270b3a90 100644
--- a/engines/saga2/uidialog.h
+++ b/engines/saga2/uidialog.h
@@ -81,13 +81,13 @@ private:
maxText = 512
};
- int16 titleCount;
- Point16 titlePos[maxLines];
- char *titleStrings[maxLines];
- char titleBuf[maxText];
+ int16 _titleCount;
+ Point16 _titlePos[maxLines];
+ char *_titleStrings[maxLines];
+ char _titleBuf[maxText];
- textPallete textPal;
- gFont *textFont;
+ textPallete _textPal;
+ gFont *_textFont;
void positionText(
char *windowText,
@@ -122,10 +122,10 @@ class CPlacardPanel : public CPlaqText {
maxText = 512
};
- int16 titleCount;
- Point16 titlePos[maxLines];
- char *titleStrings[maxLines];
- char titleBuf[maxText];
+ int16 _titleCount;
+ Point16 _titlePos[maxLines];
+ char *_titleStrings[maxLines];
+ char _titleBuf[maxText];
void positionText(const char *windowText, const Rect16 &textArea);
Commit: 490cf62fc4371d57cb08337fdb3797badcdbbf95
https://github.com/scummvm/scummvm/commit/490cf62fc4371d57cb08337fdb3797badcdbbf95
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in vbacksav.h
Changed paths:
engines/saga2/vbacksav.cpp
engines/saga2/vbacksav.h
diff --git a/engines/saga2/vbacksav.cpp b/engines/saga2/vbacksav.cpp
index 94c515d3bda..f1a1e11f908 100644
--- a/engines/saga2/vbacksav.cpp
+++ b/engines/saga2/vbacksav.cpp
@@ -33,84 +33,38 @@ gBackSave::gBackSave(const Rect16 &extent) {
// initialize the rectangle
- savedRegion = intersect(extent, displayRect); // intersect with display size
+ _savedRegion = intersect(extent, displayRect); // intersect with display size
// Set up the image structure for the video page
- savedPixels._size.x = savedRegion.width;
- savedPixels._size.y = savedRegion.height;
-// savedPixels._data = (uint8 *)malloc( savedPixels.bytes() );
- savedPixels._data = (uint8 *)malloc(savedPixels.bytes());
+ _savedPixels._size.x = _savedRegion.width;
+ _savedPixels._size.y = _savedRegion.height;
+// _savedPixels._data = (uint8 *)malloc(_savedPixels.bytes());
+ _savedPixels._data = (uint8 *)malloc(_savedPixels.bytes());
// Initialize the graphics port
- setMap(&savedPixels);
+ setMap(&_savedPixels);
setMode(drawModeReplace);
- saved = false;
+ _saved = false;
}
-/********* vbacksav.cpp/gBackSave::~gBackSave ************************
-*
-* NAME gBackSave::~gBackSave
-*
-* SYNOPSIS
-*
-* FUNCTION
-*
-* INPUTS
-*
-* RESULT
-*
-**********************************************************************
-*/
gBackSave::~gBackSave() {
- free(savedPixels._data);
+ free(_savedPixels._data);
}
-/********* vbacksav.cpp/gBackSave::save ******************************
-*
-* NAME gBackSave::save
-*
-* SYNOPSIS
-*
-* FUNCTION
-*
-* INPUTS
-*
-* RESULT
-*
-**********************************************************************
-*/
void gBackSave::save(gDisplayPort &port) {
- if (!saved && savedPixels._data) {
- port.protoPage.readPixels(savedRegion,
- savedPixels._data,
- savedPixels._size.x);
- saved = true;
+ if (!_saved && _savedPixels._data) {
+ port.protoPage.readPixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
+ _saved = true;
}
}
-/********* vbacksav.cpp/gBackSave::restore ***************************
-*
-* NAME gBackSave::restore
-*
-* SYNOPSIS
-*
-* FUNCTION
-*
-* INPUTS
-*
-* RESULT
-*
-**********************************************************************
-*/
void gBackSave::restore(gDisplayPort &port) {
- if (saved && savedPixels._data) {
- port.protoPage.writePixels(savedRegion,
- savedPixels._data,
- savedPixels._size.x);
- saved = false;
+ if (_saved && _savedPixels._data) {
+ port.protoPage.writePixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
+ _saved = false;
}
}
diff --git a/engines/saga2/vbacksav.h b/engines/saga2/vbacksav.h
index 4b2f973b2cd..b0ed07e85c7 100644
--- a/engines/saga2/vbacksav.h
+++ b/engines/saga2/vbacksav.h
@@ -34,9 +34,9 @@ namespace Saga2 {
// "things that appear in fron of other things"
class gBackSave : private gPort {
- Rect16 savedRegion; // extent of saved region
- gPixelMap savedPixels; // buffer of saved pixels
- bool saved; // true = saved.
+ Rect16 _savedRegion; // extent of saved region
+ gPixelMap _savedPixels; // buffer of saved pixels
+ bool _saved; // true = saved.
public:
gBackSave(const Rect16 &extent);
@@ -45,11 +45,11 @@ public:
void save(gDisplayPort &port);
void restore(gDisplayPort &port);
void setPos(Point16 pos) {
- savedRegion.x = pos.x;
- savedRegion.y = pos.y;
+ _savedRegion.x = pos.x;
+ _savedRegion.y = pos.y;
}
bool valid() {
- return savedPixels._data != NULL;
+ return _savedPixels._data != NULL;
}
};
Commit: c070fe72741ae539514bfcf6471fd6a3b3ff35b9
https://github.com/scummvm/scummvm/commit/c070fe72741ae539514bfcf6471fd6a3b3ff35b9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in vdraw.h
Changed paths:
engines/saga2/towerfta.cpp
engines/saga2/vbacksav.cpp
engines/saga2/vdraw.h
engines/saga2/vwdraw.cpp
diff --git a/engines/saga2/towerfta.cpp b/engines/saga2/towerfta.cpp
index c4be01048ed..abc9eb6126b 100644
--- a/engines/saga2/towerfta.cpp
+++ b/engines/saga2/towerfta.cpp
@@ -307,7 +307,7 @@ TERMINATOR(termMousePointer) {
INITIALIZER(initDisplay) {
g_vm->_mainPort.setColor(0); // fill screen with color
- drawPage = &g_vm->_mainPort.protoPage;
+ drawPage = &g_vm->_mainPort._protoPage;
//lightsOut();
//g_vm->_mainPort.fillRect( Rect16( 0, 0, screenWidth, screenHeight ) );
diff --git a/engines/saga2/vbacksav.cpp b/engines/saga2/vbacksav.cpp
index f1a1e11f908..89d222b8091 100644
--- a/engines/saga2/vbacksav.cpp
+++ b/engines/saga2/vbacksav.cpp
@@ -56,14 +56,14 @@ gBackSave::~gBackSave() {
void gBackSave::save(gDisplayPort &port) {
if (!_saved && _savedPixels._data) {
- port.protoPage.readPixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
+ port._protoPage.readPixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
_saved = true;
}
}
void gBackSave::restore(gDisplayPort &port) {
if (_saved && _savedPixels._data) {
- port.protoPage.writePixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
+ port._protoPage.writePixels(_savedRegion, _savedPixels._data, _savedPixels._size.x);
_saved = false;
}
}
diff --git a/engines/saga2/vdraw.h b/engines/saga2/vdraw.h
index 428d65b6f46..73cc72bab7c 100644
--- a/engines/saga2/vdraw.h
+++ b/engines/saga2/vdraw.h
@@ -34,7 +34,7 @@ class gDisplayPort : public gPort {
public:
virtual ~gDisplayPort() {}
- vDisplayPage protoPage;
+ vDisplayPage _protoPage;
// Lowest-level drawing functions, (virtually) retargeted to
// call SVGA drawing routines
@@ -42,7 +42,7 @@ public:
void fillRect(const Rect16 r);
void clear() {
- protoPage.fillRect(_clip, _fgPen);
+ _protoPage.fillRect(_clip, _fgPen);
}
// Blitting functions
diff --git a/engines/saga2/vwdraw.cpp b/engines/saga2/vwdraw.cpp
index c06e5f3713c..1695fb79b06 100644
--- a/engines/saga2/vwdraw.cpp
+++ b/engines/saga2/vwdraw.cpp
@@ -42,9 +42,9 @@ void gDisplayPort::fillRect(const Rect16 r) {
if (!sect.empty()) { // if result is non-empty
if (_drawMode == drawModeComplement) // Complement drawing mode
- protoPage.invertRect(sect, _fgPen);
+ _protoPage.invertRect(sect, _fgPen);
else
- protoPage.fillRect(sect, _fgPen); // regular drawing mode
+ _protoPage.fillRect(sect, _fgPen); // regular drawing mode
}
}
@@ -77,16 +77,16 @@ void gDisplayPort::bltPixels(
switch (_drawMode) {
case drawModeMatte: // use transparency
- protoPage.writeTransPixels(sect, src_line, src._size.x);
+ _protoPage.writeTransPixels(sect, src_line, src._size.x);
break;
case drawModeReplace: // don't use transparency
- protoPage.writePixels(sect, src_line, src._size.x);
+ _protoPage.writePixels(sect, src_line, src._size.x);
break;
case drawModeColor: // solid color, use transparency
- protoPage.writeColorPixels(sect, src_line, src._size.x, _fgPen);
+ _protoPage.writeColorPixels(sect, src_line, src._size.x, _fgPen);
break;
case drawModeComplement: // blit in complement mode
- protoPage.writeComplementPixels(sect, src_line, src._size.x, _fgPen);
+ _protoPage.writeComplementPixels(sect, src_line, src._size.x, _fgPen);
break;
default:
error("bltPixels: Unknown drawMode: %d", _drawMode);
@@ -146,8 +146,8 @@ void gDisplayPort::scrollPixels(
// Blit scrolled pixels to system ram and back to SVGA
- protoPage.readPixels(srcRect, tempMap._data, tempMap._size.x);
- protoPage.writePixels(dstRect, tempMap._data, tempMap._size.x);
+ _protoPage.readPixels(srcRect, tempMap._data, tempMap._size.x);
+ _protoPage.writePixels(dstRect, tempMap._data, tempMap._size.x);
// dispose of temp pixel map
@@ -195,14 +195,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
yDir = -1;
yAbs = y1 - y2;
- yMove = -protoPage.size.x;
+ yMove = -_protoPage.size.x;
} else { // drawing down
if (y2 < clip.y || y1 >= clipBottom) return;
if (y1 < clip.y || y2 >= clipBottom) clipNeeded = true;
yDir = 1;
yAbs = y2 - y1;
- yMove = protoPage.size.x;
+ yMove = _protoPage.size.x;
}
if (_clipNeeded) { // clipping versions
@@ -242,11 +242,11 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
}
}
- offset = (y1 + _origin.y) * protoPage.size.x + x1 + _origin.x;
+ offset = (y1 + _origin.y) * _protoPage.size.x + x1 + _origin.x;
bank = offset >> 16;
- protoPage.setWriteBank(bank);
- if (drawMode == drawModeComplement) protoPage.setReadBank(bank);
+ _protoPage.setWriteBank(bank);
+ if (drawMode == drawModeComplement) _protoPage.setReadBank(bank);
offset &= 0x0000ffff;
if (xAbs > yAbs) {
@@ -273,14 +273,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (offset >= cBytesPerBank) {
offset -= cBytesPerBank;
- protoPage.setWriteBank(++bank);
+ _protoPage.setWriteBank(++bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
} else if (offset < 0) {
offset += cBytesPerBank;
- protoPage.setWriteBank(--bank);
+ _protoPage.setWriteBank(--bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
}
}
} else {
@@ -307,24 +307,24 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (offset >= cBytesPerBank) {
offset -= cBytesPerBank;
- protoPage.setWriteBank(++bank);
+ _protoPage.setWriteBank(++bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
} else if (offset < 0) {
offset += cBytesPerBank;
- protoPage.setWriteBank(--bank);
+ _protoPage.setWriteBank(--bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
}
}
}
} else { // non-clipping versions
- offset = (y1 + _origin.y) * protoPage.size.x + x1 + _origin.x;
+ offset = (y1 + _origin.y) * _protoPage.size.x + x1 + _origin.x;
bank = offset >> 16;
- protoPage.setWriteBank(bank);
- if (drawMode == drawModeComplement) protoPage.setReadBank(bank);
+ _protoPage.setWriteBank(bank);
+ if (drawMode == drawModeComplement) _protoPage.setReadBank(bank);
offset &= 0x0000ffff;
if (xAbs > yAbs) {
@@ -348,14 +348,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (offset >= cBytesPerBank) {
offset -= cBytesPerBank;
- protoPage.setWriteBank(++bank);
+ _protoPage.setWriteBank(++bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
} else if (offset < 0) {
offset += cBytesPerBank;
- protoPage.setWriteBank(--bank);
+ _protoPage.setWriteBank(--bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
}
}
} else {
@@ -379,14 +379,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (offset >= cBytesPerBank) {
offset -= cBytesPerBank;
- protoPage.setWriteBank(++bank);
+ _protoPage.setWriteBank(++bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
} else if (offset < 0) {
offset += cBytesPerBank;
- protoPage.setWriteBank(--bank);
+ _protoPage.setWriteBank(--bank);
if (drawMode == drawModeComplement)
- protoPage.setReadBank(bank);
+ _protoPage.setReadBank(bank);
}
}
}
Commit: 5fe1ff2ff4944d3d32f3736d140c9b064b5a5cea
https://github.com/scummvm/scummvm/commit/5fe1ff2ff4944d3d32f3736d140c9b064b5a5cea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:56+02:00
Commit Message:
SAGA2: Rename class variables in videobox.h
Changed paths:
engines/saga2/videobox.cpp
engines/saga2/videobox.h
diff --git a/engines/saga2/videobox.cpp b/engines/saga2/videobox.cpp
index 4f1a6906795..e7097226943 100644
--- a/engines/saga2/videobox.cpp
+++ b/engines/saga2/videobox.cpp
@@ -41,25 +41,25 @@ CVideoBox::CVideoBox(const Rect16 &box,
uint16 ident,
AppFunc *cmd) : ModalWindow(box, ident, cmd) {
// set the size of the window panes
- vidPanRects[0] = Rect16(x, y, xBrushSize, yBrushSize);
- vidPanRects[1] = Rect16(x, y + yBrushSize, xBrushSize, yBrushSize);
+ _vidPanRects[0] = Rect16(x, y, xBrushSize, yBrushSize);
+ _vidPanRects[1] = Rect16(x, y + yBrushSize, xBrushSize, yBrushSize);
// options dialog window decorations
- vidDec[0].set(vidPanRects[0], vidPan1ResID);
- vidDec[1].set(vidPanRects[1], vidPan2ResID);
+ _vidDec[0].set(_vidPanRects[0], vidPan1ResID);
+ _vidDec[1].set(_vidPanRects[1], vidPan2ResID);
- // null out the decRes pointer
- decRes = nullptr;
+ // null out the _decRes pointer
+ _decRes = nullptr;
- rInfo.result = -1;
- rInfo.running = false;
+ _rInfo.result = -1;
+ _rInfo.running = false;
}
CVideoBox::~CVideoBox() {
// remove the resource handle
- if (decRes)
- resFile->disposeContext(decRes);
- decRes = nullptr;
+ if (_decRes)
+ resFile->disposeContext(_decRes);
+ _decRes = nullptr;
// stop video if not done
g_vm->abortVideo();
@@ -130,22 +130,22 @@ void CVideoBox::init() {
assert(resFile);
// set the result info to nominal startup values
- rInfo.result = -1;
- rInfo.running = true;
+ _rInfo.result = -1;
+ _rInfo.running = true;
// init the resource context handle
- decRes = resFile->newContext(MKTAG('V', 'I', 'D', 'O'),
+ _decRes = resFile->newContext(MKTAG('V', 'I', 'D', 'O'),
"Video border resources");
// get the decorations for this window
- setDecorations(vidDec,
- ARRAYSIZE(vidDec),
- decRes,
+ setDecorations(_vidDec,
+ ARRAYSIZE(_vidDec),
+ _decRes,
'V', 'B', 'D');
// attach the result info struct to this window
- _userData = &rInfo;
+ _userData = &_rInfo;
}
int16 CVideoBox::openVidBox(char *fileName) {
@@ -159,13 +159,13 @@ int16 CVideoBox::openVidBox(char *fileName) {
g_vm->startVideo(fileName, x + borderWidth, y + borderWidth);
// run this modal event loop
- //EventLoop( rInfo.running, true );
- rInfo.running = g_vm->checkVideo();
- while (rInfo.running)
- rInfo.running = g_vm->checkVideo();
+ //EventLoop( _rInfo.running, true );
+ _rInfo.running = g_vm->checkVideo();
+ while (_rInfo.running)
+ _rInfo.running = g_vm->checkVideo();
// get the result
- return rInfo.result;
+ return _rInfo.result;
}
// this opens a video box for business
diff --git a/engines/saga2/videobox.h b/engines/saga2/videobox.h
index 9578399b7a3..e00a78ab455 100644
--- a/engines/saga2/videobox.h
+++ b/engines/saga2/videobox.h
@@ -60,20 +60,20 @@ private:
public:
// resource handle
- hResContext *decRes;
+ hResContext *_decRes;
// requester info struct
- requestInfo rInfo;
+ requestInfo _rInfo;
// rect for the window
- Rect16 vidBoxRect;
+ Rect16 _vidBoxRect;
// rect for the window panes
- Rect16 vidPanRects[numBrushes];
+ Rect16 _vidPanRects[numBrushes];
public:
// decoration declarations
- WindowDecoration vidDec[numBrushes];
+ WindowDecoration _vidDec[numBrushes];
protected:
Commit: 9ffcbb3fb7b00b2ae426ae79bda9adba368ec245
https://github.com/scummvm/scummvm/commit/9ffcbb3fb7b00b2ae426ae79bda9adba368ec245
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-27T17:44:57+02:00
Commit Message:
SAGA2: Rename class variables in vpage.h
Changed paths:
engines/saga2/contain.h
engines/saga2/grequest.cpp
engines/saga2/vpage.h
diff --git a/engines/saga2/contain.h b/engines/saga2/contain.h
index 003d0dc766f..d48b0b52549 100644
--- a/engines/saga2/contain.h
+++ b/engines/saga2/contain.h
@@ -220,7 +220,7 @@ public:
// sub class for enchantment container panels
-class EnchantmentContainerView : public ContainerView {
+class EnchantmentContainerView : public ContainerView {
public:
EnchantmentContainerView(gPanelList &list,
ContainerNode &nd,
diff --git a/engines/saga2/grequest.cpp b/engines/saga2/grequest.cpp
index 42d6a30e9a1..98254a425b6 100644
--- a/engines/saga2/grequest.cpp
+++ b/engines/saga2/grequest.cpp
@@ -348,8 +348,8 @@ int16 GameDialogA(
rInfo.running = true;
win = new ModalRequestWindow(
- Rect16((drawPage->size.x - 200) / 2,
- (drawPage->size.y - 100) / 3,
+ Rect16((drawPage->_size.x - 200) / 2,
+ (drawPage->_size.y - 100) / 3,
200,
100),
0,
@@ -401,8 +401,8 @@ int16 GameDisplayA(
rInfo.running = true;
win = new ModalDisplayWindow(
- Rect16((drawPage->size.x - 200) / 2,
- (drawPage->size.y - 100) / 3,
+ Rect16((drawPage->_size.x - 200) / 2,
+ (drawPage->_size.y - 100) / 3,
200,
100),
0,
diff --git a/engines/saga2/vpage.h b/engines/saga2/vpage.h
index 2bee76193ef..b875e2e0f60 100644
--- a/engines/saga2/vpage.h
+++ b/engines/saga2/vpage.h
@@ -32,7 +32,7 @@ class vDisplayPage {
public:
virtual ~vDisplayPage() {}
- Point16 size; // size in pixels
+ Point16 _size; // size in pixels
#if ! defined( USEWINDOWS )
// inline function to set the bank if needed
More information about the Scummvm-git-logs
mailing list