refactored parts of actor.cpp: many methods are now members of class Actor instead of class Scumm. This is still work in progress!
svn-id: r4319
This commit is contained in:
parent
a592de4333
commit
fe4230bcbf
11 changed files with 616 additions and 555 deletions
112
actor.h
Normal file
112
actor.h
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/* ScummVM - Scumm Interpreter
|
||||||
|
* Copyright (C) 2001 Ludvig Strigeus
|
||||||
|
* Copyright (C) 2001/2002 The ScummVM project
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Header$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ACTOR_H
|
||||||
|
#define ACTOR_H
|
||||||
|
|
||||||
|
struct ActorWalkData {
|
||||||
|
int16 destx,desty; // Final destination
|
||||||
|
byte destbox;
|
||||||
|
int16 destdir;
|
||||||
|
byte curbox;
|
||||||
|
int16 x,y; // Current position
|
||||||
|
int16 newx,newy; // Next position on our way to the destination
|
||||||
|
int32 XYFactor, YXFactor;
|
||||||
|
uint16 xfrac,yfrac;
|
||||||
|
int point3x, point3y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CostumeData {
|
||||||
|
byte active[16];
|
||||||
|
uint16 animCounter1;
|
||||||
|
byte animCounter2;
|
||||||
|
uint16 stopped;
|
||||||
|
uint16 curpos[16];
|
||||||
|
uint16 start[16];
|
||||||
|
uint16 end[16];
|
||||||
|
uint16 frame[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Actor {
|
||||||
|
int x, y, top, bottom;
|
||||||
|
int elevation;
|
||||||
|
uint width;
|
||||||
|
byte number;
|
||||||
|
uint16 facing;
|
||||||
|
uint16 costume;
|
||||||
|
byte room;
|
||||||
|
byte talkColor;
|
||||||
|
byte scalex,scaley;
|
||||||
|
byte charset;
|
||||||
|
int16 newDirection;
|
||||||
|
byte moving;
|
||||||
|
byte ignoreBoxes;
|
||||||
|
byte forceClip;
|
||||||
|
byte initFrame, walkFrame, standFrame, talkFrame1, talkFrame2;
|
||||||
|
bool needRedraw, needBgReset, costumeNeedsInit, visible;
|
||||||
|
byte shadow_mode;
|
||||||
|
bool flip;
|
||||||
|
uint speedx,speedy;
|
||||||
|
byte frame;
|
||||||
|
byte walkbox;
|
||||||
|
byte mask;
|
||||||
|
byte animProgress, animSpeed;
|
||||||
|
int16 new_1,new_2;
|
||||||
|
uint16 talk_script, walk_script;
|
||||||
|
byte new_3;
|
||||||
|
int8 layer;
|
||||||
|
ActorWalkData walkdata;
|
||||||
|
int16 animVariable[16];
|
||||||
|
uint16 sound[8];
|
||||||
|
CostumeData cost;
|
||||||
|
byte palette[64];
|
||||||
|
|
||||||
|
void hideActor();
|
||||||
|
void showActor();
|
||||||
|
|
||||||
|
void initActor(int mode);
|
||||||
|
void setActorWalkSpeed(uint newSpeedX, uint newSpeedY);
|
||||||
|
int calcMovementFactor(int newx, int newy);
|
||||||
|
int actorWalkStep();
|
||||||
|
int remapDirection(int dir);
|
||||||
|
void setupActorScale();
|
||||||
|
void stopActorMoving();
|
||||||
|
void startWalkAnim(int cmd, int angle);
|
||||||
|
void startAnimActor(int frame);
|
||||||
|
void setActorBox(int box);
|
||||||
|
|
||||||
|
int updateActorDirection();
|
||||||
|
void setActorDirection(int direction);
|
||||||
|
|
||||||
|
void adjustActorPos();
|
||||||
|
void turnToDirection(int newdir);
|
||||||
|
void walkActor();
|
||||||
|
void setActorCostume(int c);
|
||||||
|
byte *getActorName();
|
||||||
|
void startWalkActor(int x, int y, int dir);
|
||||||
|
|
||||||
|
void remapActor(int b, int c, int d, int e);
|
||||||
|
void walkActorOld();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
38
boxes.cpp
38
boxes.cpp
|
@ -871,35 +871,35 @@ int Scumm::findPathTowardsOld(Actor * a, byte trap1, byte trap2,
|
||||||
GetGates(trap1, trap2);
|
GetGates(trap1, trap2);
|
||||||
ScummPoint pt;
|
ScummPoint pt;
|
||||||
|
|
||||||
p[1].x = actor->x;
|
gateLoc[1].x = actor->x;
|
||||||
p[1].y = actor->y;
|
gateLoc[1].y = actor->y;
|
||||||
p[2].x = 32000;
|
gateLoc[2].x = 32000;
|
||||||
p[3].x = 32000;
|
gateLoc[3].x = 32000;
|
||||||
p[4].x = 32000;
|
gateLoc[4].x = 32000;
|
||||||
|
|
||||||
if (trap2 == final_trap) { /* next = final box? */
|
if (trap2 == final_trap) { /* next = final box? */
|
||||||
p[4].x = actor->walkdata.destx;
|
gateLoc[4].x = actor->walkdata.destx;
|
||||||
p[4].y = actor->walkdata.desty;
|
gateLoc[4].y = actor->walkdata.desty;
|
||||||
|
|
||||||
if (getMaskFromBox(trap1) == getMaskFromBox(trap2) || 1) {
|
if (getMaskFromBox(trap1) == getMaskFromBox(trap2) || 1) {
|
||||||
if (CompareSlope(p[1].x, p[1].y, p[4].x, p[4].y, gate1ax, gate1ay) !=
|
if (CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[4].x, gateLoc[4].y, gate1ax, gate1ay) !=
|
||||||
CompareSlope(p[1].x, p[1].y, p[4].x, p[4].y, gate1bx, gate1by) &&
|
CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[4].x, gateLoc[4].y, gate1bx, gate1by) &&
|
||||||
CompareSlope(p[1].x, p[1].y, p[4].x, p[4].y, gate2ax, gate2ay) !=
|
CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[4].x, gateLoc[4].y, gate2ax, gate2ay) !=
|
||||||
CompareSlope(p[1].x, p[1].y, p[4].x, p[4].y, gate2bx, gate2by)) {
|
CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[4].x, gateLoc[4].y, gate2bx, gate2by)) {
|
||||||
return 0; /* same zplane and between both gates? */
|
return 0; /* same zplane and between both gates? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt = closestPtOnLine(gate2ax, gate2ay, gate2bx, gate2by, p[1].x, p[1].y);
|
pt = closestPtOnLine(gate2ax, gate2ay, gate2bx, gate2by, gateLoc[1].x, gateLoc[1].y);
|
||||||
p[3].x = pt.x;
|
gateLoc[3].x = pt.x;
|
||||||
p[3].y = pt.y;
|
gateLoc[3].y = pt.y;
|
||||||
|
|
||||||
if (CompareSlope(p[1].x, p[1].y, p[3].x, p[3].y, gate1ax, gate1ay) ==
|
if (CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[3].x, gateLoc[3].y, gate1ax, gate1ay) ==
|
||||||
CompareSlope(p[1].x, p[1].y, p[3].x, p[3].y, gate1bx, gate1by)) {
|
CompareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[3].x, gateLoc[3].y, gate1bx, gate1by)) {
|
||||||
closestPtOnLine(gate1ax, gate1ay, gate1bx, gate1by, p[1].x, p[1].y);
|
closestPtOnLine(gate1ax, gate1ay, gate1bx, gate1by, gateLoc[1].x, gateLoc[1].y);
|
||||||
p[2].x = pt.x; /* if point 2 between gates, ignore! */
|
gateLoc[2].x = pt.x; /* if point 2 between gates, ignore! */
|
||||||
p[2].y = pt.y;
|
gateLoc[2].y = pt.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -720,7 +720,7 @@ byte *Scumm::getObjOrActorName(int obj)
|
||||||
byte *objptr;
|
byte *objptr;
|
||||||
|
|
||||||
if (obj < NUM_ACTORS)
|
if (obj < NUM_ACTORS)
|
||||||
return getActorName(derefActorSafe(obj, "getObjOrActorName"));
|
return derefActorSafe(obj, "getObjOrActorName")->getActorName();
|
||||||
|
|
||||||
if (_features & GF_SMALL_HEADER) {
|
if (_features & GF_SMALL_HEADER) {
|
||||||
byte offset = 0;
|
byte offset = 0;
|
||||||
|
|
22
script.cpp
22
script.cpp
|
@ -883,7 +883,7 @@ void Scumm::faceActorToObj(int act, int obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dir = (_xPos > x) ? 90 : 270;
|
dir = (_xPos > x) ? 90 : 270;
|
||||||
turnToDirection(derefActorSafe(act, "faceActorToObj"), dir);
|
derefActorSafe(act, "faceActorToObj")->turnToDirection(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::animateActor(int act, int anim)
|
void Scumm::animateActor(int act, int anim)
|
||||||
|
@ -905,18 +905,18 @@ void Scumm::animateActor(int act, int anim)
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 2:
|
case 2:
|
||||||
stopActorMoving(a);
|
a->stopActorMoving();
|
||||||
startAnimActor(a, a->standFrame);
|
a->startAnimActor(a->standFrame);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
setActorDirection(a, dir);
|
a->setActorDirection(dir);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
turnToDirection(a, dir);
|
a->turnToDirection(dir);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
startAnimActor(a, anim);
|
a->startAnimActor(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -931,18 +931,18 @@ void Scumm::animateActor(int act, int anim)
|
||||||
|
|
||||||
switch (anim >> 2) {
|
switch (anim >> 2) {
|
||||||
case 0x3F:
|
case 0x3F:
|
||||||
stopActorMoving(a);
|
a->stopActorMoving();
|
||||||
startAnimActor(a, a->standFrame);
|
a->startAnimActor(a->standFrame);
|
||||||
break;
|
break;
|
||||||
case 0x3E:
|
case 0x3E:
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
setActorDirection(a, oldDirToNewDir(dir));
|
a->setActorDirection(oldDirToNewDir(dir));
|
||||||
break;
|
break;
|
||||||
case 0x3D:
|
case 0x3D:
|
||||||
turnToDirection(a, oldDirToNewDir(dir));
|
a->turnToDirection(oldDirToNewDir(dir));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
startAnimActor(a, anim);
|
a->startAnimActor(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -715,12 +715,12 @@ void Scumm::o5_actorSet()
|
||||||
getVarOrDirectByte(0x80);
|
getVarOrDirectByte(0x80);
|
||||||
break;
|
break;
|
||||||
case 1: /* costume */
|
case 1: /* costume */
|
||||||
setActorCostume(a, getVarOrDirectByte(0x80));
|
a->setActorCostume(getVarOrDirectByte(0x80));
|
||||||
break;
|
break;
|
||||||
case 2: /* walkspeed */
|
case 2: /* walkspeed */
|
||||||
i = getVarOrDirectByte(0x80);
|
i = getVarOrDirectByte(0x80);
|
||||||
j = getVarOrDirectByte(0x40);
|
j = getVarOrDirectByte(0x40);
|
||||||
setActorWalkSpeed(a, i, j);
|
a->setActorWalkSpeed(i, j);
|
||||||
break;
|
break;
|
||||||
case 3: /* sound */
|
case 3: /* sound */
|
||||||
a->sound[0] = getVarOrDirectByte(0x80);
|
a->sound[0] = getVarOrDirectByte(0x80);
|
||||||
|
@ -741,7 +741,7 @@ void Scumm::o5_actorSet()
|
||||||
getVarOrDirectByte(0x20);
|
getVarOrDirectByte(0x20);
|
||||||
break;
|
break;
|
||||||
case 8: /* init */
|
case 8: /* init */
|
||||||
initActor(a, 0);
|
a->initActor(0);
|
||||||
break;
|
break;
|
||||||
case 9: /* elevation */
|
case 9: /* elevation */
|
||||||
a->elevation = getVarOrDirectWord(0x80);
|
a->elevation = getVarOrDirectWord(0x80);
|
||||||
|
@ -1306,17 +1306,15 @@ void Scumm::o5_getActorWidth()
|
||||||
|
|
||||||
void Scumm::o5_getActorX()
|
void Scumm::o5_getActorX()
|
||||||
{
|
{
|
||||||
int actor;
|
int a;
|
||||||
getResultPos();
|
getResultPos();
|
||||||
|
|
||||||
if(_gameId == GID_INDY3_256)
|
if(_gameId == GID_INDY3_256)
|
||||||
|
a = getVarOrDirectByte(0x80);
|
||||||
actor = getVarOrDirectByte(0x80);
|
|
||||||
|
|
||||||
else
|
else
|
||||||
actor = getVarOrDirectWord(0x80);
|
a = getVarOrDirectWord(0x80);
|
||||||
|
|
||||||
setResult(getObjX(actor));
|
setResult(getObjX(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::o5_getActorY()
|
void Scumm::o5_getActorY()
|
||||||
|
@ -1634,7 +1632,7 @@ void Scumm::o5_loadRoomWithEgo()
|
||||||
_fullRedraw = 1;
|
_fullRedraw = 1;
|
||||||
|
|
||||||
if (x != -1) {
|
if (x != -1) {
|
||||||
startWalkActor(a, x, y, -1);
|
a->startWalkActor(x, y, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2557,7 +2555,7 @@ void Scumm::o5_walkActorTo()
|
||||||
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorTo");
|
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorTo");
|
||||||
x = getVarOrDirectWord(0x40);
|
x = getVarOrDirectWord(0x40);
|
||||||
y = getVarOrDirectWord(0x20);
|
y = getVarOrDirectWord(0x20);
|
||||||
startWalkActor(a, x, y, -1);
|
a->startWalkActor(x, y, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::o5_walkActorToActor()
|
void Scumm::o5_walkActorToActor()
|
||||||
|
@ -2603,7 +2601,7 @@ void Scumm::o5_walkActorToActor()
|
||||||
else
|
else
|
||||||
x -= b;
|
x -= b;
|
||||||
|
|
||||||
startWalkActor(a, x, y, -1);
|
a->startWalkActor(x, y, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::o5_walkActorToObject()
|
void Scumm::o5_walkActorToObject()
|
||||||
|
@ -2617,7 +2615,7 @@ void Scumm::o5_walkActorToObject()
|
||||||
obj = getVarOrDirectWord(0x40);
|
obj = getVarOrDirectWord(0x40);
|
||||||
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
if (whereIsObject(obj) != WIO_NOT_FOUND) {
|
||||||
getObjectXYPos(obj);
|
getObjectXYPos(obj);
|
||||||
startWalkActor(a, _xPos, _yPos, _dir);
|
a->startWalkActor(_xPos, _yPos, _dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1345,7 +1345,7 @@ void Scumm::o6_walkActorToObj()
|
||||||
if (whereIsObject(obj) == WIO_NOT_FOUND)
|
if (whereIsObject(obj) == WIO_NOT_FOUND)
|
||||||
return;
|
return;
|
||||||
getObjectXYPos(obj);
|
getObjectXYPos(obj);
|
||||||
startWalkActor(a, _xPos, _yPos, _dir);
|
a->startWalkActor(_xPos, _yPos, _dir);
|
||||||
} else {
|
} else {
|
||||||
a2 = derefActorSafe(obj, "o6_walkActorToObj(2)");
|
a2 = derefActorSafe(obj, "o6_walkActorToObj(2)");
|
||||||
if (!a2)
|
if (!a2)
|
||||||
|
@ -1361,7 +1361,7 @@ void Scumm::o6_walkActorToObj()
|
||||||
x += dist;
|
x += dist;
|
||||||
else
|
else
|
||||||
x -= dist;
|
x -= dist;
|
||||||
startWalkActor(a, x, a2->y, -1);
|
a->startWalkActor(x, a2->y, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,7 +1370,7 @@ void Scumm::o6_walkActorTo()
|
||||||
int x, y;
|
int x, y;
|
||||||
y = pop();
|
y = pop();
|
||||||
x = pop();
|
x = pop();
|
||||||
startWalkActor(derefActorSafe(pop(), "o6_walkActorTo"), x, y, -1);
|
derefActorSafe(pop(), "o6_walkActorTo")->startWalkActor(x, y, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::o6_putActorInRoom()
|
void Scumm::o6_putActorInRoom()
|
||||||
|
@ -1508,7 +1508,7 @@ void Scumm::o6_loadRoomWithEgo()
|
||||||
}
|
}
|
||||||
_fullRedraw = 1;
|
_fullRedraw = 1;
|
||||||
if (x != -1) {
|
if (x != -1) {
|
||||||
startWalkActor(a, x, y, -1);
|
a->startWalkActor(x, y, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1920,12 +1920,12 @@ void Scumm::o6_actorSet()
|
||||||
|
|
||||||
switch (b) {
|
switch (b) {
|
||||||
case 76: /* actor-costume */
|
case 76: /* actor-costume */
|
||||||
setActorCostume(a, pop());
|
a->setActorCostume(pop());
|
||||||
break;
|
break;
|
||||||
case 77: /* actor-speed */
|
case 77: /* actor-speed */
|
||||||
j = pop();
|
j = pop();
|
||||||
i = pop();
|
i = pop();
|
||||||
setActorWalkSpeed(a, i, j);
|
a->setActorWalkSpeed(i, j);
|
||||||
break;
|
break;
|
||||||
case 78: /* actor-sound */
|
case 78: /* actor-sound */
|
||||||
k = getStackList(args, sizeof(args) / sizeof(args[0]));
|
k = getStackList(args, sizeof(args) / sizeof(args[0]));
|
||||||
|
@ -1948,7 +1948,7 @@ void Scumm::o6_actorSet()
|
||||||
pop();
|
pop();
|
||||||
break;
|
break;
|
||||||
case 83:
|
case 83:
|
||||||
initActor(a, 0);
|
a->initActor(0);
|
||||||
break;
|
break;
|
||||||
case 84: /* actor-elevation */
|
case 84: /* actor-elevation */
|
||||||
a->elevation = pop();
|
a->elevation = pop();
|
||||||
|
@ -2026,7 +2026,7 @@ void Scumm::o6_actorSet()
|
||||||
a->new_3 = 0;
|
a->new_3 = 0;
|
||||||
break;
|
break;
|
||||||
case 217:
|
case 217:
|
||||||
initActor(a, 2);
|
a->initActor(2);
|
||||||
break;
|
break;
|
||||||
case 227: /* actor_layer */
|
case 227: /* actor_layer */
|
||||||
a->layer = pop();
|
a->layer = pop();
|
||||||
|
@ -2038,15 +2038,15 @@ void Scumm::o6_actorSet()
|
||||||
a->talk_script = pop();
|
a->talk_script = pop();
|
||||||
break;
|
break;
|
||||||
case 229: /* stand */
|
case 229: /* stand */
|
||||||
stopActorMoving(a);
|
a->stopActorMoving();
|
||||||
startAnimActor(a, a->standFrame);
|
a->startAnimActor(a->standFrame);
|
||||||
break;
|
break;
|
||||||
case 230: /* set direction */
|
case 230: /* set direction */
|
||||||
a->moving &= ~4;
|
a->moving &= ~4;
|
||||||
setActorDirection(a, pop());
|
a->setActorDirection(pop());
|
||||||
break;
|
break;
|
||||||
case 231: /* turn to direction */
|
case 231: /* turn to direction */
|
||||||
turnToDirection(a, pop());
|
a->turnToDirection(pop());
|
||||||
break;
|
break;
|
||||||
case 233: /* freeze actor */
|
case 233: /* freeze actor */
|
||||||
a->moving |= 0x80;
|
a->moving |= 0x80;
|
||||||
|
@ -2710,11 +2710,11 @@ void Scumm::o6_miscOps()
|
||||||
setCursorImg(args[1], (uint) - 1, args[2]);
|
setCursorImg(args[1], (uint) - 1, args[2]);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
remapActor(derefActorSafe(args[1], "o6_miscOps:14"), args[2], args[3],
|
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3],
|
||||||
args[4], -1);
|
args[4], -1);
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
remapActor(derefActorSafe(args[1], "o6_miscOps:14"), args[2], args[3],
|
derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3],
|
||||||
args[4], args[5]);
|
args[4], args[5]);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
|
111
scumm.h
111
scumm.h
|
@ -1,5 +1,6 @@
|
||||||
/* ScummVM - Scumm Interpreter
|
/* ScummVM - Scumm Interpreter
|
||||||
* Copyright (C) 2001 Ludvig Strigeus
|
* Copyright (C) 2001 Ludvig Strigeus
|
||||||
|
* Copyright (C) 2001/2002 The ScummVM project
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -19,10 +20,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef SCUMM_H
|
||||||
|
#define SCUMM_H
|
||||||
|
|
||||||
#include "scummsys.h"
|
#include "scummsys.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "config-file.h"
|
#include "config-file.h"
|
||||||
|
#include "actor.h"
|
||||||
|
|
||||||
#define SCUMMVM_VERSION "0.2.0 Release"
|
#define SCUMMVM_VERSION "0.2.0 Release"
|
||||||
#define SCUMMVM_CVS "051302"
|
#define SCUMMVM_CVS "051302"
|
||||||
|
@ -200,29 +205,6 @@ public:
|
||||||
byte fl_object_index;
|
byte fl_object_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CostumeData {
|
|
||||||
byte active[16];
|
|
||||||
uint16 animCounter1;
|
|
||||||
byte animCounter2;
|
|
||||||
uint16 stopped;
|
|
||||||
uint16 curpos[16];
|
|
||||||
uint16 start[16];
|
|
||||||
uint16 end[16];
|
|
||||||
uint16 frame[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ActorWalkData {
|
|
||||||
int16 destx,desty; // Final destination
|
|
||||||
byte destbox;
|
|
||||||
int16 destdir;
|
|
||||||
byte curbox;
|
|
||||||
int16 x,y; // Current position
|
|
||||||
int16 newx,newy; // Next position on our way to the destination
|
|
||||||
int32 XYFactor, YXFactor;
|
|
||||||
uint16 xfrac,yfrac;
|
|
||||||
int point3x, point3y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ScriptSlot {
|
struct ScriptSlot {
|
||||||
uint32 offs;
|
uint32 offs;
|
||||||
int32 delay;
|
int32 delay;
|
||||||
|
@ -431,41 +413,6 @@ struct CostumeRenderer {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Actor {
|
|
||||||
int x,y,top,bottom;
|
|
||||||
int elevation;
|
|
||||||
uint width;
|
|
||||||
byte number;
|
|
||||||
uint16 facing;
|
|
||||||
uint16 costume;
|
|
||||||
byte room;
|
|
||||||
byte talkColor;
|
|
||||||
byte scalex,scaley;
|
|
||||||
byte charset;
|
|
||||||
int16 newDirection;
|
|
||||||
byte moving;
|
|
||||||
byte ignoreBoxes;
|
|
||||||
byte forceClip;
|
|
||||||
byte initFrame,walkFrame,standFrame,talkFrame1,talkFrame2;
|
|
||||||
bool needRedraw, needBgReset,costumeNeedsInit,visible;
|
|
||||||
byte shadow_mode;
|
|
||||||
bool flip;
|
|
||||||
uint speedx,speedy;
|
|
||||||
byte frame;
|
|
||||||
byte walkbox;
|
|
||||||
byte mask;
|
|
||||||
byte animProgress, animSpeed;
|
|
||||||
int16 new_1,new_2;
|
|
||||||
uint16 talk_script, walk_script;
|
|
||||||
byte new_3;
|
|
||||||
int8 layer;
|
|
||||||
ActorWalkData walkdata;
|
|
||||||
int16 animVariable[16];
|
|
||||||
uint16 sound[8];
|
|
||||||
CostumeData cost;
|
|
||||||
byte palette[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ARRAY_HDR_SIZE 6
|
#define ARRAY_HDR_SIZE 6
|
||||||
struct ArrayHeader {
|
struct ArrayHeader {
|
||||||
int16 dim1_size;
|
int16 dim1_size;
|
||||||
|
@ -1039,21 +986,21 @@ public:
|
||||||
Actor *derefActorSafe(int id, const char *errmsg);
|
Actor *derefActorSafe(int id, const char *errmsg);
|
||||||
Actor *getFirstActor() {return actor;}
|
Actor *getFirstActor() {return actor;}
|
||||||
void putActor(Actor *a, int x, int y, byte room);
|
void putActor(Actor *a, int x, int y, byte room);
|
||||||
void hideActor(Actor *a);
|
// void hideActor(Actor *a);
|
||||||
void showActor(Actor *a);
|
// void showActor(Actor *a);
|
||||||
void showActors();
|
void showActors();
|
||||||
|
|
||||||
void initActor(Actor *a, int mode);
|
// void initActor(Actor *a, int mode);
|
||||||
void setActorWalkSpeed(Actor *a, uint speed1, uint speed2);
|
// void setActorWalkSpeed(Actor *a, uint speed1, uint speed2);
|
||||||
int calcMovementFactor(Actor *a, int newx, int newy);
|
// int calcMovementFactor(Actor *a, int newx, int newy);
|
||||||
int actorWalkStep(Actor *a);
|
// int actorWalkStep(Actor *a);
|
||||||
int remapDirection(Actor *a, int dir);
|
// int remapDirection(Actor *a, int dir);
|
||||||
void setupActorScale(Actor *a);
|
// void setupActorScale(Actor *a);
|
||||||
void stopActorMoving(Actor *a);
|
// void stopActorMoving(Actor *a);
|
||||||
uint32 *_classData;
|
uint32 *_classData;
|
||||||
void startWalkAnim(Actor *a, int cmd, int angle);
|
// void startWalkAnim(Actor *a, int cmd, int angle);
|
||||||
void startAnimActor(Actor *a, int frame);
|
// void startAnimActor(Actor *a, int frame);
|
||||||
void setActorBox(Actor *a, int box);
|
// void setActorBox(Actor *a, int box);
|
||||||
|
|
||||||
int newDirToOldDir(int dir);
|
int newDirToOldDir(int dir);
|
||||||
int oldDirToNewDir(int dir);
|
int oldDirToNewDir(int dir);
|
||||||
|
@ -1063,34 +1010,34 @@ public:
|
||||||
static int fromSimpleDir(int dirtype, int dir);
|
static int fromSimpleDir(int dirtype, int dir);
|
||||||
static int toSimpleDir(int dirtype, int dir);
|
static int toSimpleDir(int dirtype, int dir);
|
||||||
static int numSimpleDirDirections(int dirType);
|
static int numSimpleDirDirections(int dirType);
|
||||||
int updateActorDirection(Actor *a);
|
// int updateActorDirection(Actor *a);
|
||||||
void startAnimActorEx(Actor *a, int frame, int direction);
|
void startAnimActorEx(Actor *a, int frame, int direction);
|
||||||
int getProgrDirChange(Actor *a, int mode);
|
int getProgrDirChange(Actor *a, int mode);
|
||||||
void initActorCostumeData(Actor *a);
|
void initActorCostumeData(Actor *a);
|
||||||
void setActorDirection(Actor *a, int direction);
|
// void setActorDirection(Actor *a, int direction);
|
||||||
|
|
||||||
int getActorXYPos(Actor *a);
|
int getActorXYPos(Actor *a);
|
||||||
void adjustActorPos(Actor *a);
|
// void adjustActorPos(Actor *a);
|
||||||
void turnToDirection(Actor *a, int newdir);
|
// void turnToDirection(Actor *a, int newdir);
|
||||||
AdjustBoxResult adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom);
|
AdjustBoxResult adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom);
|
||||||
void walkActors();
|
void walkActors();
|
||||||
void playActorSounds();
|
void playActorSounds();
|
||||||
void walkActor(Actor *a);
|
// void walkActor(Actor *a);
|
||||||
void setActorRedrawFlags();
|
void setActorRedrawFlags();
|
||||||
void resetActorBgs();
|
void resetActorBgs();
|
||||||
void processActors();
|
void processActors();
|
||||||
void drawActorCostume(Actor *a);
|
void drawActorCostume(Actor *a);
|
||||||
void actorAnimate(Actor *a);
|
void actorAnimate(Actor *a);
|
||||||
int getActorFromPos(int x, int y);
|
int getActorFromPos(int x, int y);
|
||||||
void setActorCostume(Actor *a, int c);
|
// void setActorCostume(Actor *a, int c);
|
||||||
byte *getActorName(Actor *a);
|
// byte *getActorName(Actor *a);
|
||||||
void faceActorToObj(int act, int obj);
|
void faceActorToObj(int act, int obj);
|
||||||
void animateActor(int act, int anim);
|
void animateActor(int act, int anim);
|
||||||
void actorFollowCamera(int act);
|
void actorFollowCamera(int act);
|
||||||
void startWalkActor(Actor *a, int x, int y, int dir);
|
// void startWalkActor(Actor *a, int x, int y, int dir);
|
||||||
|
|
||||||
void remapActor(Actor *a, int b, int c, int d, int e);
|
// void remapActor(Actor *a, int b, int c, int d, int e);
|
||||||
void walkActorOld(Actor *a);
|
// void walkActorOld(Actor *a);
|
||||||
bool isCostumeInUse(int i);
|
bool isCostumeInUse(int i);
|
||||||
|
|
||||||
/* Actor talking stuff */
|
/* Actor talking stuff */
|
||||||
|
@ -1261,7 +1208,8 @@ public:
|
||||||
int _maxBoxVertexHeap, _boxPathVertexHeapIndex, _boxMatrixItem;
|
int _maxBoxVertexHeap, _boxPathVertexHeapIndex, _boxMatrixItem;
|
||||||
byte *_boxMatrixPtr4, *_boxMatrixPtr1, *_boxMatrixPtr3;
|
byte *_boxMatrixPtr4, *_boxMatrixPtr1, *_boxMatrixPtr3;
|
||||||
|
|
||||||
ScummPoint p[5]; /* Gate locations */
|
// ScummPoint p[5]; /* Gate locations */
|
||||||
|
ScummPoint gateLoc[5]; /* Gate locations */
|
||||||
int gate1ax, gate1ay, gate1bx, gate1by, gate2ax, gate2ay, gate2bx, gate2by;
|
int gate1ax, gate1ay, gate1bx, gate1by, gate2ax, gate2ay, gate2bx, gate2by;
|
||||||
uint16 _extraBoxFlags[65];
|
uint16 _extraBoxFlags[65];
|
||||||
int16 _foundPathX, _foundPathY;
|
int16 _foundPathX, _foundPathY;
|
||||||
|
@ -1890,3 +1838,4 @@ byte *findResourceSmall(uint32 tag, byte *searchin);
|
||||||
void setWindowName(Scumm *s);
|
void setWindowName(Scumm *s);
|
||||||
uint16 newTag2Old(uint32 oldTag);
|
uint16 newTag2Old(uint32 oldTag);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Scumm::scummInit()
|
||||||
|
|
||||||
for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) {
|
for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) {
|
||||||
a->number = i;
|
a->number = i;
|
||||||
initActor(a, 1);
|
a->initActor(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_vars[VAR_CHARINC] = 4;
|
_vars[VAR_CHARINC] = 4;
|
||||||
|
@ -408,7 +408,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
|
||||||
|
|
||||||
for (i = 1, at = getFirstActor(); ++at, i < NUM_ACTORS; i++) {
|
for (i = 1, at = getFirstActor(); ++at, i < NUM_ACTORS; i++) {
|
||||||
if (at->visible)
|
if (at->visible)
|
||||||
hideActor(at);
|
at->hideActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(_features & GF_AFTER_V7)) {
|
if (!(_features & GF_AFTER_V7)) {
|
||||||
|
@ -484,7 +484,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
|
||||||
_currentRoom);
|
_currentRoom);
|
||||||
getObjectXYPos(objectNr);
|
getObjectXYPos(objectNr);
|
||||||
putActor(a, _xPos, _yPos, _currentRoom);
|
putActor(a, _xPos, _yPos, _currentRoom);
|
||||||
setActorDirection(a, _dir + 180);
|
a->setActorDirection(_dir + 180);
|
||||||
a->moving = 0;
|
a->moving = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ void Scumm::processSfxQueues()
|
||||||
b = isMouthSyncOff(_curSoundPos);
|
b = isMouthSyncOff(_curSoundPos);
|
||||||
if (_mouthSyncMode != b) {
|
if (_mouthSyncMode != b) {
|
||||||
_mouthSyncMode = b;
|
_mouthSyncMode = b;
|
||||||
startAnimActor(a, b ? a->talkFrame2 : a->talkFrame1);
|
a->startAnimActor(b ? a->talkFrame2 : a->talkFrame1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
string.cpp
12
string.cpp
|
@ -288,7 +288,7 @@ void Scumm::CHARSET_1()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a && !string[0].no_talk_anim) {
|
if (a && !string[0].no_talk_anim) {
|
||||||
startAnimActor(a, a->talkFrame1);
|
a->startAnimActor(a->talkFrame1);
|
||||||
_useTalkAnims = true;
|
_useTalkAnims = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,16 +393,16 @@ void Scumm::CHARSET_1()
|
||||||
frme = *buffer++;
|
frme = *buffer++;
|
||||||
frme |= *buffer++ << 8;
|
frme |= *buffer++ << 8;
|
||||||
if (a)
|
if (a)
|
||||||
startAnimActor(a, frme);
|
a->startAnimActor(frme);
|
||||||
} else if (c == 10) {
|
} else if (c == 10) {
|
||||||
uint32 a, b;
|
uint32 tmpA, tmpB;
|
||||||
|
|
||||||
a =
|
tmpA =
|
||||||
buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
|
buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
|
||||||
b =
|
tmpB =
|
||||||
buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] <<
|
buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] <<
|
||||||
24);
|
24);
|
||||||
talkSound(a, b, 2);
|
talkSound(tmpA, tmpB, 2);
|
||||||
buffer += 14;
|
buffer += 14;
|
||||||
} else if (c == 14) {
|
} else if (c == 14) {
|
||||||
int oldy = getResourceAddress(rtCharset, charset._curId)[30];
|
int oldy = getResourceAddress(rtCharset, charset._curId)[30];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue