gathered character related stuff into a new struct Character, and modified calling code accordingly
svn-id: r26158
This commit is contained in:
parent
86ba69f75b
commit
1ef774b2ee
11 changed files with 127 additions and 125 deletions
|
@ -658,7 +658,7 @@ void sortAnimations() {
|
||||||
Node v14;
|
Node v14;
|
||||||
memset(&v14, 0, sizeof(Node));
|
memset(&v14, 0, sizeof(Node));
|
||||||
|
|
||||||
_yourself._z = _yourself._cnv._height + _yourself._zone._limits._top;
|
_vm->_char._yourself._z = _vm->_char._yourself._cnv._height + _vm->_char._yourself._zone._limits._top;
|
||||||
|
|
||||||
Animation *vC = (Animation*)_animations._next;
|
Animation *vC = (Animation*)_animations._next;
|
||||||
Node *v8;
|
Node *v8;
|
||||||
|
|
|
@ -322,7 +322,7 @@ void _c_finito(void *parm) {
|
||||||
_vm->_menu->selectCharacter();
|
_vm->_menu->selectCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeNode(&_yourself._zone._node);
|
removeNode(&_vm->_char._yourself._zone._node);
|
||||||
_vm->_locationNames[0][0] = '\0';
|
_vm->_locationNames[0][0] = '\0';
|
||||||
_vm->_numLocations = 0;
|
_vm->_numLocations = 0;
|
||||||
_commandFlags = 0;
|
_commandFlags = 0;
|
||||||
|
@ -339,7 +339,7 @@ void _c_finito(void *parm) {
|
||||||
|
|
||||||
_engineFlags &= ~kEngineQuit;
|
_engineFlags &= ~kEngineQuit;
|
||||||
|
|
||||||
addNode(&_animations, &_yourself._zone._node);
|
addNode(&_animations, &_vm->_char._yourself._zone._node);
|
||||||
_score = 0;
|
_score = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -328,7 +328,7 @@ void runCommands(Command *list, Zone *z) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_MOVE: { // move
|
case CMD_MOVE: { // move
|
||||||
if ((_yourself._zone._flags & kFlagsRemove) || (_yourself._zone._flags & kFlagsActive) == 0) {
|
if ((_vm->_char._yourself._zone._flags & kFlagsRemove) || (_vm->_char._yourself._zone._flags & kFlagsActive) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ void runDialogue(SpeakData *data) {
|
||||||
StaticCnv v5C, v48;
|
StaticCnv v5C, v48;
|
||||||
|
|
||||||
if (!scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') {
|
if (!scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') {
|
||||||
memcpy(&v6E, &_yourTalk, sizeof(Cnv));
|
memcpy(&v6E, &_vm->_char._yourTalk, sizeof(Cnv));
|
||||||
debugC(1, kDebugDialogue, "runDialogue: using default character head");
|
debugC(1, kDebugDialogue, "runDialogue: using default character head");
|
||||||
} else {
|
} else {
|
||||||
debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName);
|
debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName);
|
||||||
|
@ -249,8 +249,8 @@ void runDialogue(SpeakData *data) {
|
||||||
v5C._width = v6E._width;
|
v5C._width = v6E._width;
|
||||||
v5C._height = v6E._height;
|
v5C._height = v6E._height;
|
||||||
|
|
||||||
v48._width = _yourTalk._width;
|
v48._width = _vm->_char._yourTalk._width;
|
||||||
v48._height = _yourTalk._height;
|
v48._height = _vm->_char._yourTalk._height;
|
||||||
|
|
||||||
bool displayedAnswers = false;
|
bool displayedAnswers = false;
|
||||||
int16 question_width = 0, question_height = 0;
|
int16 question_width = 0, question_height = 0;
|
||||||
|
@ -263,7 +263,7 @@ void runDialogue(SpeakData *data) {
|
||||||
|
|
||||||
v5C._data0 = v6E._array[v60->_mood & 0xF];
|
v5C._data0 = v6E._array[v60->_mood & 0xF];
|
||||||
v5C._data1 = NULL; // v6E.field_8[v60->_mood & 0xF];
|
v5C._data1 = NULL; // v6E.field_8[v60->_mood & 0xF];
|
||||||
v48._data0 = _yourTalk._array[0];
|
v48._data0 = _vm->_char._yourTalk._array[0];
|
||||||
v48._data1 = NULL; // _yourTalk.field_8[0];
|
v48._data1 = NULL; // _yourTalk.field_8[0];
|
||||||
|
|
||||||
// display Question if any
|
// display Question if any
|
||||||
|
@ -504,7 +504,7 @@ void runDialogue(SpeakData *data) {
|
||||||
_vm->_disk->selectArchive("disk1");
|
_vm->_disk->selectArchive("disk1");
|
||||||
_vm->_disk->loadFrames(_dinoName, &_characterFrames);
|
_vm->_disk->loadFrames(_dinoName, &_characterFrames);
|
||||||
|
|
||||||
memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv));
|
memcpy(&_vm->_char._yourself._cnv, &_characterFrames, sizeof(Cnv));
|
||||||
|
|
||||||
debugC(1, kDebugDialogue, "runDialogue: special trick for 'museum' location ok");
|
debugC(1, kDebugDialogue, "runDialogue: special trick for 'museum' location ok");
|
||||||
}
|
}
|
||||||
|
@ -543,8 +543,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) {
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
cnv->_data0 = _yourTalk._array[q->_answer_moods[_di] & 0xF];
|
cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_di] & 0xF];
|
||||||
// cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_di] & 0xF];
|
// cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_di] & 0xF];
|
||||||
|
|
||||||
_vm->_gfx->flatBlitCnv(
|
_vm->_gfx->flatBlitCnv(
|
||||||
cnv,
|
cnv,
|
||||||
|
@ -585,8 +585,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) {
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
cnv->_data0 = _yourTalk._array[q->_answer_moods[_si] & 0xF];
|
cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_si] & 0xF];
|
||||||
// cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_si] & 0xF];
|
// cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_si] & 0xF];
|
||||||
|
|
||||||
_vm->_gfx->flatBlitCnv(
|
_vm->_gfx->flatBlitCnv(
|
||||||
cnv,
|
cnv,
|
||||||
|
|
|
@ -51,7 +51,6 @@ namespace Parallaction {
|
||||||
#define INVENTORY_HEIGHT (INVENTORY_LINES*INVENTORYITEM_HEIGHT)
|
#define INVENTORY_HEIGHT (INVENTORY_LINES*INVENTORYITEM_HEIGHT)
|
||||||
|
|
||||||
static byte *_buffer;
|
static byte *_buffer;
|
||||||
extern Cnv _yourObjects;
|
|
||||||
uint16 _numInvLines = 0;
|
uint16 _numInvLines = 0;
|
||||||
static Point _invPosition = { 0, 0 };
|
static Point _invPosition = { 0, 0 };
|
||||||
|
|
||||||
|
@ -188,8 +187,8 @@ void drawInventoryItem(uint16 pos, InventoryItem *item) {
|
||||||
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
|
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
|
||||||
|
|
||||||
// FIXME: this will end up in a general blit function
|
// FIXME: this will end up in a general blit function
|
||||||
byte* s = _yourObjects._array[item->_index];
|
byte* s = _vm->_char._yourObjects._array[item->_index];
|
||||||
byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH;
|
byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH;
|
||||||
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
|
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
|
||||||
memcpy(d, s, INVENTORYITEM_WIDTH);
|
memcpy(d, s, INVENTORYITEM_WIDTH);
|
||||||
|
|
||||||
|
@ -229,8 +228,8 @@ void highlightInventoryItem(int16 pos, byte color) {
|
||||||
uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
|
uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
|
||||||
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
|
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
|
||||||
|
|
||||||
Common::Rect r(INVENTORYITEM_WIDTH, _yourObjects._height);
|
Common::Rect r(INVENTORYITEM_WIDTH, _vm->_char._yourObjects._height);
|
||||||
r.moveTo(col * INVENTORYITEM_WIDTH, line * _yourObjects._height);
|
r.moveTo(col * INVENTORYITEM_WIDTH, line * _vm->_char._yourObjects._height);
|
||||||
|
|
||||||
drawBorder(r, _buffer, color);
|
drawBorder(r, _buffer, color);
|
||||||
|
|
||||||
|
@ -248,7 +247,7 @@ void extractInventoryGraphics(int16 pos, byte *dst) {
|
||||||
|
|
||||||
// FIXME: this will end up in a general blit function
|
// FIXME: this will end up in a general blit function
|
||||||
byte* d = dst;
|
byte* d = dst;
|
||||||
byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH;
|
byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH;
|
||||||
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
|
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
|
||||||
memcpy(d, s, INVENTORYITEM_WIDTH);
|
memcpy(d, s, INVENTORYITEM_WIDTH);
|
||||||
|
|
||||||
|
@ -358,7 +357,7 @@ void redrawInventory() {
|
||||||
|
|
||||||
void initInventory() {
|
void initInventory() {
|
||||||
_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT); // this buffer is also used by menu so it must stay this size
|
_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT); // this buffer is also used by menu so it must stay this size
|
||||||
_yourObjects._count = 0;
|
_vm->_char._yourObjects._count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanInventory() {
|
void cleanInventory() {
|
||||||
|
|
|
@ -92,12 +92,12 @@ void Parallaction::parseLocation(const char *filename) {
|
||||||
switchBackground(_location._name, mask);
|
switchBackground(_location._name, mask);
|
||||||
|
|
||||||
if (_tokens[2][0] != '\0') {
|
if (_tokens[2][0] != '\0') {
|
||||||
_yourself._zone.pos._position._x = atoi(_tokens[2]);
|
_vm->_char._yourself._zone.pos._position._x = atoi(_tokens[2]);
|
||||||
_yourself._zone.pos._position._y = atoi(_tokens[3]);
|
_vm->_char._yourself._zone.pos._position._y = atoi(_tokens[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tokens[4][0] != '\0') {
|
if (_tokens[4][0] != '\0') {
|
||||||
_yourself._frame = atoi(_tokens[4]);
|
_vm->_char._yourself._frame = atoi(_tokens[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!scumm_stricmp(_tokens[0], "DISK")) {
|
if (!scumm_stricmp(_tokens[0], "DISK")) {
|
||||||
|
@ -237,8 +237,8 @@ void parseWalkNodes(Script& script, Node *list) {
|
||||||
if (!scumm_stricmp(_tokens[0], "COORD")) {
|
if (!scumm_stricmp(_tokens[0], "COORD")) {
|
||||||
|
|
||||||
WalkNode *v4 = (WalkNode*)malloc(sizeof(WalkNode));
|
WalkNode *v4 = (WalkNode*)malloc(sizeof(WalkNode));
|
||||||
v4->_x = atoi(_tokens[1]) - _yourself._cnv._width/2;
|
v4->_x = atoi(_tokens[1]) - _vm->_char._yourself._cnv._width/2;
|
||||||
v4->_y = atoi(_tokens[2]) - _yourself._cnv._height;
|
v4->_y = atoi(_tokens[2]) - _vm->_char._yourself._cnv._height;
|
||||||
|
|
||||||
addNode(list, &v4->_node);
|
addNode(list, &v4->_node);
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ void Parallaction::changeLocation(char *location) {
|
||||||
debugC(2, kDebugLocation, "changeLocation: changed cursor");
|
debugC(2, kDebugLocation, "changeLocation: changed cursor");
|
||||||
}
|
}
|
||||||
|
|
||||||
removeNode(&_yourself._zone._node);
|
removeNode(&_vm->_char._yourself._zone._node);
|
||||||
debugC(2, kDebugLocation, "changeLocation: removed character from the animation list");
|
debugC(2, kDebugLocation, "changeLocation: removed character from the animation list");
|
||||||
|
|
||||||
freeLocation();
|
freeLocation();
|
||||||
|
@ -375,7 +375,7 @@ void Parallaction::changeLocation(char *location) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addNode(&_animations, &_yourself._zone._node);
|
addNode(&_animations, &_vm->_char._yourself._zone._node);
|
||||||
debugC(2, kDebugLocation, "changeLocation: new character added to the animation list");
|
debugC(2, kDebugLocation, "changeLocation: new character added to the animation list");
|
||||||
|
|
||||||
strcpy(_saveData1, list[0].c_str());
|
strcpy(_saveData1, list[0].c_str());
|
||||||
|
@ -384,14 +384,14 @@ void Parallaction::changeLocation(char *location) {
|
||||||
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
|
_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
|
||||||
debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1);
|
debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1);
|
||||||
|
|
||||||
_yourself._zone.pos._oldposition._x = -1000;
|
_vm->_char._yourself._zone.pos._oldposition._x = -1000;
|
||||||
_yourself._zone.pos._oldposition._y = -1000;
|
_vm->_char._yourself._zone.pos._oldposition._y = -1000;
|
||||||
|
|
||||||
_yourself.field_50 = 0;
|
_vm->_char._yourself.field_50 = 0;
|
||||||
if (_location._startPosition._x != -1000) {
|
if (_location._startPosition._x != -1000) {
|
||||||
_yourself._zone.pos._position._x = _location._startPosition._x;
|
_vm->_char._yourself._zone.pos._position._x = _location._startPosition._x;
|
||||||
_yourself._zone.pos._position._y = _location._startPosition._y;
|
_vm->_char._yourself._zone.pos._position._y = _location._startPosition._y;
|
||||||
_yourself._frame = _location._startFrame;
|
_vm->_char._yourself._frame = _location._startFrame;
|
||||||
_location._startPosition._y = -1000;
|
_location._startPosition._y = -1000;
|
||||||
_location._startPosition._x = -1000;
|
_location._startPosition._x = -1000;
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,7 @@ uint32 _engineFlags = 0;
|
||||||
char *_objectsNames[100];
|
char *_objectsNames[100];
|
||||||
Zone *_activeZone = NULL;
|
Zone *_activeZone = NULL;
|
||||||
|
|
||||||
Animation _yourself;
|
|
||||||
StaticCnv _yourHead;
|
|
||||||
Cnv _yourTalk;
|
|
||||||
Cnv _characterFrames;
|
|
||||||
static Cnv _miniCharacterFrames;
|
|
||||||
Cnv _yourObjects;
|
|
||||||
|
|
||||||
uint16 _score = 1;
|
uint16 _score = 1;
|
||||||
|
|
||||||
|
@ -230,32 +225,32 @@ int Parallaction::init() {
|
||||||
|
|
||||||
initWalk();
|
initWalk();
|
||||||
|
|
||||||
_yourTalk._width = 0;
|
_vm->_char._yourTalk._width = 0;
|
||||||
_yourTalk._height = 0;
|
_vm->_char._yourTalk._height = 0;
|
||||||
_yourTalk._count = 0;
|
_vm->_char._yourTalk._count = 0;
|
||||||
_yourTalk._array = NULL;
|
_vm->_char._yourTalk._array = NULL;
|
||||||
|
|
||||||
_yourHead._width = 0;
|
_vm->_char._yourHead._width = 0;
|
||||||
_yourHead._height = 0;
|
_vm->_char._yourHead._height = 0;
|
||||||
_yourHead._data0 = NULL;
|
_vm->_char._yourHead._data0 = NULL;
|
||||||
_yourHead._data1 = NULL;
|
_vm->_char._yourHead._data1 = NULL;
|
||||||
|
|
||||||
_yourself._zone.pos._position._x = 150;
|
_vm->_char._yourself._zone.pos._position._x = 150;
|
||||||
_yourself._zone.pos._position._y = 100;
|
_vm->_char._yourself._zone.pos._position._y = 100;
|
||||||
initInventory();
|
initInventory();
|
||||||
_yourself._z = 10;
|
_vm->_char._yourself._z = 10;
|
||||||
|
|
||||||
_yourself._zone.pos._oldposition._x = -1000;
|
_vm->_char._yourself._zone.pos._oldposition._x = -1000;
|
||||||
_yourself._zone.pos._oldposition._y = -1000;
|
_vm->_char._yourself._zone.pos._oldposition._y = -1000;
|
||||||
_yourself._frame = 0;
|
_vm->_char._yourself._frame = 0;
|
||||||
|
|
||||||
_yourself._zone._flags = kFlagsActive | kFlagsNoName;
|
_vm->_char._yourself._zone._flags = kFlagsActive | kFlagsNoName;
|
||||||
_yourself._zone._type = kZoneYou;
|
_vm->_char._yourself._zone._type = kZoneYou;
|
||||||
|
|
||||||
_yourself._zone._label._cnv._data0 = NULL;
|
_vm->_char._yourself._zone._label._cnv._data0 = NULL;
|
||||||
_yourself._zone._label._text = strdup("yourself");
|
_vm->_char._yourself._zone._label._text = strdup("yourself");
|
||||||
|
|
||||||
addNode(&_animations, &_yourself._zone._node);
|
addNode(&_animations, &_vm->_char._yourself._zone._node);
|
||||||
_gfx = new Gfx(this);
|
_gfx = new Gfx(this);
|
||||||
|
|
||||||
int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
|
int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
|
||||||
|
@ -300,9 +295,9 @@ void Parallaction::initGame() {
|
||||||
parseLocation(_location._name);
|
parseLocation(_location._name);
|
||||||
|
|
||||||
if (_location._startPosition._x != -1000) {
|
if (_location._startPosition._x != -1000) {
|
||||||
_yourself._zone.pos._position._x = _location._startPosition._x;
|
_vm->_char._yourself._zone.pos._position._x = _location._startPosition._x;
|
||||||
_yourself._zone.pos._position._y = _location._startPosition._y;
|
_vm->_char._yourself._zone.pos._position._y = _location._startPosition._y;
|
||||||
_yourself._frame = _location._startFrame;
|
_vm->_char._yourself._frame = _location._startFrame;
|
||||||
_location._startPosition._y = -1000;
|
_location._startPosition._y = -1000;
|
||||||
_location._startPosition._x = -1000;
|
_location._startPosition._x = -1000;
|
||||||
}
|
}
|
||||||
|
@ -544,8 +539,8 @@ void Parallaction::processInput(InputData *data) {
|
||||||
debugC(2, kDebugInput, "processInput: kEvWalk");
|
debugC(2, kDebugInput, "processInput: kEvWalk");
|
||||||
_hoverZone = NULL;
|
_hoverZone = NULL;
|
||||||
changeCursor(kCursorArrow);
|
changeCursor(kCursorArrow);
|
||||||
if (_yourself._zone._flags & kFlagsRemove) break;
|
if (_vm->_char._yourself._zone._flags & kFlagsRemove) break;
|
||||||
if ((_yourself._zone._flags & kFlagsActive) == 0) break;
|
if ((_vm->_char._yourself._zone._flags & kFlagsActive) == 0) break;
|
||||||
v4 = buildWalkPath(data->_mousePos._x, data->_mousePos._y);
|
v4 = buildWalkPath(data->_mousePos._x, data->_mousePos._y);
|
||||||
addJob(jobWalk, v4, kPriority19);
|
addJob(jobWalk, v4, kPriority19);
|
||||||
_engineFlags |= kEngineWalking; // inhibits processing of input until walking is over
|
_engineFlags |= kEngineWalking; // inhibits processing of input until walking is over
|
||||||
|
@ -759,14 +754,14 @@ void Parallaction::changeCursor(int32 index) {
|
||||||
|
|
||||||
void freeCharacterFrames() {
|
void freeCharacterFrames() {
|
||||||
|
|
||||||
_vm->_gfx->freeCnv(&_characterFrames);
|
_vm->_gfx->freeCnv(&_vm->_char._characterFrames);
|
||||||
|
|
||||||
if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
|
if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
|
||||||
_vm->_gfx->freeCnv(&_miniCharacterFrames);
|
_vm->_gfx->freeCnv(&_vm->_char._miniCharacterFrames);
|
||||||
_vm->freeTable(_objectsNames);
|
_vm->freeTable(_objectsNames);
|
||||||
_vm->_gfx->freeCnv(&_yourTalk);
|
_vm->_gfx->freeCnv(&_vm->_char._yourTalk);
|
||||||
_vm->_gfx->freeStaticCnv(&_yourHead);
|
_vm->_gfx->freeStaticCnv(&_vm->_char._yourHead);
|
||||||
_vm->_gfx->freeCnv(&_yourObjects);
|
_vm->_gfx->freeCnv(&_vm->_char._yourObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -839,15 +834,15 @@ void Parallaction::changeCharacter(const char *name) {
|
||||||
|
|
||||||
char path[PATH_LEN];
|
char path[PATH_LEN];
|
||||||
strcpy(path, v32);
|
strcpy(path, v32);
|
||||||
_disk->loadFrames(path, &_characterFrames);
|
_disk->loadFrames(path, &_vm->_char._characterFrames);
|
||||||
|
|
||||||
if (!IS_DUMMY_CHARACTER(name)) {
|
if (!IS_DUMMY_CHARACTER(name)) {
|
||||||
_disk->loadHead(path, &_yourHead);
|
_disk->loadHead(path, &_vm->_char._yourHead);
|
||||||
_disk->loadTalk(path, &_yourTalk);
|
_disk->loadTalk(path, &_vm->_char._yourTalk);
|
||||||
_disk->loadObjects(name, &_yourObjects);
|
_disk->loadObjects(name, &_vm->_char._yourObjects);
|
||||||
|
|
||||||
sprintf(path, "mini%s", v32);
|
sprintf(path, "mini%s", v32);
|
||||||
_disk->loadFrames(path, &_miniCharacterFrames);
|
_disk->loadFrames(path, &_vm->_char._miniCharacterFrames);
|
||||||
|
|
||||||
sprintf(path, "%s.tab", name);
|
sprintf(path, "%s.tab", name);
|
||||||
initTable(path, _objectsNames);
|
initTable(path, _objectsNames);
|
||||||
|
@ -860,9 +855,9 @@ void Parallaction::changeCharacter(const char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (miniCharacter)
|
if (miniCharacter)
|
||||||
memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv));
|
memcpy(&_vm->_char._yourself._cnv, &_vm->_char._miniCharacterFrames, sizeof(Cnv));
|
||||||
else
|
else
|
||||||
memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv));
|
memcpy(&_vm->_char._yourself._cnv, &_vm->_char._characterFrames, sizeof(Cnv));
|
||||||
|
|
||||||
strcpy(_characterName1, v32);
|
strcpy(_characterName1, v32);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "parallaction/inventory.h"
|
#include "parallaction/inventory.h"
|
||||||
#include "parallaction/parser.h"
|
#include "parallaction/parser.h"
|
||||||
#include "parallaction/disk.h"
|
#include "parallaction/disk.h"
|
||||||
|
#include "parallaction/zone.h"
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
#include "gui/dialog.h"
|
#include "gui/dialog.h"
|
||||||
#include "gui/widget.h"
|
#include "gui/widget.h"
|
||||||
|
@ -103,7 +104,7 @@ extern uint16 _language;
|
||||||
extern Zone *_activeZone;
|
extern Zone *_activeZone;
|
||||||
extern uint32 _engineFlags;
|
extern uint32 _engineFlags;
|
||||||
extern callable _callables[];
|
extern callable _callables[];
|
||||||
extern Animation _yourself;
|
|
||||||
extern Node _zones;
|
extern Node _zones;
|
||||||
extern Node _animations;
|
extern Node _animations;
|
||||||
extern uint32 _localFlags[];
|
extern uint32 _localFlags[];
|
||||||
|
@ -122,9 +123,7 @@ extern char _saveData1[];
|
||||||
extern byte _mouseHidden;
|
extern byte _mouseHidden;
|
||||||
extern uint32 _commandFlags;
|
extern uint32 _commandFlags;
|
||||||
|
|
||||||
extern Cnv _yourTalk;
|
|
||||||
|
|
||||||
extern Cnv _characterFrames;
|
|
||||||
|
|
||||||
//extern char _locationName[];
|
//extern char _locationName[];
|
||||||
//extern Node _walkNodes;
|
//extern Node _walkNodes;
|
||||||
|
@ -251,6 +250,15 @@ struct Location {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Character {
|
||||||
|
Animation _yourself;
|
||||||
|
StaticCnv _yourHead;
|
||||||
|
Cnv _yourTalk;
|
||||||
|
Cnv _characterFrames;
|
||||||
|
Cnv _miniCharacterFrames;
|
||||||
|
Cnv _yourObjects;
|
||||||
|
};
|
||||||
|
|
||||||
class Parallaction : public Engine {
|
class Parallaction : public Engine {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -305,6 +313,7 @@ public:
|
||||||
int16 _currentLocationIndex;
|
int16 _currentLocationIndex;
|
||||||
uint16 _numLocations;
|
uint16 _numLocations;
|
||||||
|
|
||||||
|
Character _char;
|
||||||
Location _location;
|
Location _location;
|
||||||
|
|
||||||
InventoryItem _activeItem;
|
InventoryItem _activeItem;
|
||||||
|
|
|
@ -175,9 +175,9 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) {
|
||||||
|
|
||||||
sprintf(s, "%s\n", _saveData1);
|
sprintf(s, "%s\n", _saveData1);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _yourself._zone.pos._position._x);
|
sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._x);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _yourself._zone.pos._position._y);
|
sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._y);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _score);
|
sprintf(s, "%d\n", _score);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
|
|
|
@ -95,7 +95,7 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
|
||||||
|
|
||||||
if (close == right) {
|
if (close == right) {
|
||||||
to_x += right;
|
to_x += right;
|
||||||
walkData3 = (_yourself._cnv._count == 20) ? 7 : 9;
|
walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 7 : 9;
|
||||||
} else
|
} else
|
||||||
if (close == left) {
|
if (close == left) {
|
||||||
to_x -= left;
|
to_x -= left;
|
||||||
|
@ -106,7 +106,7 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
|
||||||
} else
|
} else
|
||||||
if (close == bottom) {
|
if (close == bottom) {
|
||||||
to_y += bottom;
|
to_y += bottom;
|
||||||
walkData3 = (_yourself._cnv._count == 20) ? 17 : 21;
|
walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 17 : 21;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,8 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
|
||||||
WalkNode *v48 = (WalkNode*)malloc(sizeof(WalkNode));
|
WalkNode *v48 = (WalkNode*)malloc(sizeof(WalkNode));
|
||||||
WalkNode *v44 = (WalkNode*)malloc(sizeof(WalkNode));
|
WalkNode *v44 = (WalkNode*)malloc(sizeof(WalkNode));
|
||||||
|
|
||||||
v48->_x = to_x - _yourself._cnv._width / 2; // target top left coordinates
|
v48->_x = to_x - _vm->_char._yourself._cnv._width / 2; // target top left coordinates
|
||||||
v48->_y = to_y - _yourself._cnv._height;
|
v48->_y = to_y - _vm->_char._yourself._cnv._height;
|
||||||
v48->_node._next = NULL;
|
v48->_node._next = NULL;
|
||||||
memcpy(v44, v48, sizeof(WalkNode));
|
memcpy(v44, v48, sizeof(WalkNode));
|
||||||
|
|
||||||
|
@ -152,11 +152,11 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
|
||||||
|
|
||||||
v48 = &v58;
|
v48 = &v58;
|
||||||
|
|
||||||
v20._x = _yourself._zone.pos._position._x;
|
v20._x = _vm->_char._yourself._zone.pos._position._x;
|
||||||
v20._y = _yourself._zone.pos._position._y;
|
v20._y = _vm->_char._yourself._zone.pos._position._y;
|
||||||
|
|
||||||
v8._x = _si - _yourself._zone.pos._position._x;
|
v8._x = _si - _vm->_char._yourself._zone.pos._position._x;
|
||||||
v8._y = _di - _yourself._zone.pos._position._y;
|
v8._y = _di - _vm->_char._yourself._zone.pos._position._y;
|
||||||
v34 = v30 = dotProduct(&v8, &v8); // square distance from current position and target
|
v34 = v30 = dotProduct(&v8, &v8); // square distance from current position and target
|
||||||
|
|
||||||
while (_closest_node_found != 0) {
|
while (_closest_node_found != 0) {
|
||||||
|
@ -245,8 +245,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
|
||||||
Point v4 = { 0, 0 };
|
Point v4 = { 0, 0 };
|
||||||
|
|
||||||
Point foot = {
|
Point foot = {
|
||||||
_yourself._zone.pos._position._x + _yourself._cnv._width/2,
|
_vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width/2,
|
||||||
_yourself._zone.pos._position._y + _yourself._cnv._height
|
_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height
|
||||||
};
|
};
|
||||||
|
|
||||||
Point v8 = {
|
Point v8 = {
|
||||||
|
@ -297,8 +297,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
|
||||||
v8._y = foot._y;
|
v8._y = foot._y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->_x = v4._x - _yourself._cnv._width / 2;
|
Node->_x = v4._x - _vm->_char._yourself._cnv._width / 2;
|
||||||
Node->_y = v4._y - _yourself._cnv._height;
|
Node->_y = v4._y - _vm->_char._yourself._cnv._height;
|
||||||
|
|
||||||
return (x - v4._x) * (x - v4._x) + (y - v4._y) * (y - v4._y);
|
return (x - v4._x) * (x - v4._x) + (y - v4._y) * (y - v4._y);
|
||||||
}
|
}
|
||||||
|
@ -316,13 +316,13 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
|
||||||
void jobWalk(void *parm, Job *j) {
|
void jobWalk(void *parm, Job *j) {
|
||||||
WalkNode *node = (WalkNode*)parm;
|
WalkNode *node = (WalkNode*)parm;
|
||||||
|
|
||||||
int16 _si = _yourself._zone.pos._position._x;
|
int16 _si = _vm->_char._yourself._zone.pos._position._x;
|
||||||
int16 _di = _yourself._zone.pos._position._y;
|
int16 _di = _vm->_char._yourself._zone.pos._position._y;
|
||||||
|
|
||||||
// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _yourself._cnv._width / 2, node->_y + _yourself._cnv._height);
|
// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _vm->_char._yourself._cnv._width / 2, node->_y + _vm->_char._yourself._cnv._height);
|
||||||
|
|
||||||
_yourself._zone.pos._oldposition._x = _si;
|
_vm->_char._yourself._zone.pos._oldposition._x = _si;
|
||||||
_yourself._zone.pos._oldposition._y = _di;
|
_vm->_char._yourself._zone.pos._oldposition._y = _di;
|
||||||
|
|
||||||
if ((node->_x == _si) && (node->_y == _di)) {
|
if ((node->_x == _si) && (node->_y == _di)) {
|
||||||
if (node->_node._next == NULL) {
|
if (node->_node._next == NULL) {
|
||||||
|
@ -346,8 +346,8 @@ void jobWalk(void *parm, Job *j) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Point dist = {
|
Point dist = {
|
||||||
node->_x - _yourself._zone.pos._position._x,
|
node->_x - _vm->_char._yourself._zone.pos._position._x,
|
||||||
node->_y - _yourself._zone.pos._position._y
|
node->_y - _vm->_char._yourself._zone.pos._position._y
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dist._x < 0)
|
if (dist._x < 0)
|
||||||
|
@ -359,7 +359,7 @@ void jobWalk(void *parm, Job *j) {
|
||||||
|
|
||||||
// walk frame selection
|
// walk frame selection
|
||||||
int16 v16;
|
int16 v16;
|
||||||
if (_yourself._cnv._count == 20) {
|
if (_vm->_char._yourself._cnv._count == 20) {
|
||||||
|
|
||||||
if (dist._x > dist._y) {
|
if (dist._x > dist._y) {
|
||||||
walkData2 = (node->_x > _si) ? 0 : 7;
|
walkData2 = (node->_x > _si) ? 0 : 7;
|
||||||
|
@ -386,36 +386,36 @@ void jobWalk(void *parm, Job *j) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// StaticCnv v14;
|
// StaticCnv v14;
|
||||||
// v14._width = _yourself._cnv._width;
|
// v14._width = _vm->_char._yourself._cnv._width;
|
||||||
// v14._height = _yourself._cnv._height;
|
// v14._height = _vm->_char._yourself._cnv._height;
|
||||||
// v14._data0 = _yourself._cnv._array[_yourself._frame];
|
// v14._data0 = _vm->_char._yourself._cnv._array[_vm->_char._yourself._frame];
|
||||||
// v14._data1 = _yourself._cnv.field_8[_yourself._frame];
|
// v14._data1 = _vm->_char._yourself._cnv.field_8[_vm->_char._yourself._frame];
|
||||||
|
|
||||||
if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_yourself._cnv._width/2 + _si + 2, _yourself._cnv._height + _di) != 0)) {
|
if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si + 2, _vm->_char._yourself._cnv._height + _di) != 0)) {
|
||||||
// printf("walk right\n");
|
// printf("walk right\n");
|
||||||
_si = (_si + 2 < node->_x) ? _si + 2 : node->_x;
|
_si = (_si + 2 < node->_x) ? _si + 2 : node->_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_si > node->_x) && (_si > -20) && (queryPath(_yourself._cnv._width/2 + _si - 2, _yourself._cnv._height + _di) != 0)) {
|
if ((_si > node->_x) && (_si > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si - 2, _vm->_char._yourself._cnv._height + _di) != 0)) {
|
||||||
// printf("walk left\n");
|
// printf("walk left\n");
|
||||||
_si = (_si - 2 > node->_x) ? _si - 2 :node->_x;
|
_si = (_si - 2 > node->_x) ? _si - 2 :node->_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _yourself._cnv._height)) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di + 2) != 0)) {
|
if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _vm->_char._yourself._cnv._height)) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di + 2) != 0)) {
|
||||||
// printf("walk down\n");
|
// printf("walk down\n");
|
||||||
_di = (_di + 2 <= node->_y) ? _di + 2 : node->_y;
|
_di = (_di + 2 <= node->_y) ? _di + 2 : node->_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_di > node->_y) && (_di > -20) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di - 2) != 0)) {
|
if ((_di > node->_y) && (_di > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di - 2) != 0)) {
|
||||||
// printf("walk up\n");
|
// printf("walk up\n");
|
||||||
_di = (_di - 2 >= node->_y) ? _di - 2 : node->_y;
|
_di = (_di - 2 >= node->_y) ? _di - 2 : node->_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("hitZone: %i, %i\n", _si, _di);
|
// printf("hitZone: %i, %i\n", _si, _di);
|
||||||
_yourself._zone.pos._position._x = _si;
|
_vm->_char._yourself._zone.pos._position._x = _si;
|
||||||
_yourself._zone.pos._position._y = _di;
|
_vm->_char._yourself._zone.pos._position._y = _di;
|
||||||
|
|
||||||
if ((_si == _yourself._zone.pos._oldposition._x) && (_di == _yourself._zone.pos._oldposition._y)) {
|
if ((_si == _vm->_char._yourself._zone.pos._oldposition._x) && (_di == _vm->_char._yourself._zone.pos._oldposition._y)) {
|
||||||
|
|
||||||
j->_finished = 1;
|
j->_finished = 1;
|
||||||
checkDoor();
|
checkDoor();
|
||||||
|
@ -423,7 +423,7 @@ void jobWalk(void *parm, Job *j) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_yourself._frame = v16 + walkData2 + 1;
|
_vm->_char._yourself._frame = v16 + walkData2 + 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ uint16 checkDoor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_engineFlags &= ~kEngineWalking;
|
_engineFlags &= ~kEngineWalking;
|
||||||
Zone *z = hitZone(kZoneDoor, _yourself._zone.pos._position._x + _yourself._cnv._width / 2, _yourself._zone.pos._position._y + _yourself._cnv._height);
|
Zone *z = hitZone(kZoneDoor, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2, _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height);
|
||||||
|
|
||||||
if (z != NULL) {
|
if (z != NULL) {
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ uint16 checkDoor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
z = hitZone(kZoneTrap, _yourself._zone.pos._position._x + _yourself._cnv._width / 2, _yourself._zone.pos._position._y + _yourself._cnv._height);
|
z = hitZone(kZoneTrap, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2, _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height);
|
||||||
|
|
||||||
if (z != NULL) {
|
if (z != NULL) {
|
||||||
_localFlags[_vm->_currentLocationIndex] |= kFlagsEnter;
|
_localFlags[_vm->_currentLocationIndex] |= kFlagsEnter;
|
||||||
|
@ -475,8 +475,8 @@ uint16 checkDoor() {
|
||||||
|
|
||||||
// printf("done\n");
|
// printf("done\n");
|
||||||
|
|
||||||
_yourself._frame = walkData2;
|
_vm->_char._yourself._frame = walkData2;
|
||||||
return _yourself._frame;
|
return _vm->_char._yourself._frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 queryPath(uint16 x, uint16 y) {
|
uint16 queryPath(uint16 x, uint16 y) {
|
||||||
|
|
|
@ -37,7 +37,6 @@ Node _zones = { NULL, NULL };
|
||||||
Node _animations = { NULL, NULL };
|
Node _animations = { NULL, NULL };
|
||||||
|
|
||||||
extern Node helperNode;
|
extern Node helperNode;
|
||||||
extern StaticCnv _yourHead;
|
|
||||||
|
|
||||||
Zone *findZone(const char *name) {
|
Zone *findZone(const char *name) {
|
||||||
|
|
||||||
|
@ -367,9 +366,9 @@ void displayCharacterComment(ExamineData *data) {
|
||||||
if (data->_description == NULL) return;
|
if (data->_description == NULL) return;
|
||||||
|
|
||||||
StaticCnv v3C;
|
StaticCnv v3C;
|
||||||
v3C._width = _yourTalk._width;
|
v3C._width = _vm->_char._yourTalk._width;
|
||||||
v3C._height = _yourTalk._height;
|
v3C._height = _vm->_char._yourTalk._height;
|
||||||
v3C._data0 = _yourTalk._array[0];
|
v3C._data0 = _vm->_char._yourTalk._array[0];
|
||||||
v3C._data1 = NULL; //_yourTalk.field_8[0];
|
v3C._data1 = NULL; //_yourTalk.field_8[0];
|
||||||
|
|
||||||
_vm->_gfx->setFont("comic");
|
_vm->_gfx->setFont("comic");
|
||||||
|
@ -415,7 +414,7 @@ void displayItemComment(ExamineData *data) {
|
||||||
Common::Rect r(v6C, v6A);
|
Common::Rect r(v6C, v6A);
|
||||||
r.moveTo(0, 90);
|
r.moveTo(0, 90);
|
||||||
_vm->_gfx->drawBalloon(r, 0);
|
_vm->_gfx->drawBalloon(r, 0);
|
||||||
_vm->_gfx->flatBlitCnv(&_yourHead, 100, 152, Gfx::kBitFront, _yourHead._data1);
|
_vm->_gfx->flatBlitCnv(&_vm->_char._yourHead, 100, 152, Gfx::kBitFront, _vm->_char._yourHead._data1);
|
||||||
_vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0);
|
_vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0);
|
||||||
|
|
||||||
jobEraseAnimations((void*)1, NULL);
|
jobEraseAnimations((void*)1, NULL);
|
||||||
|
@ -609,13 +608,13 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
|
|
||||||
if (z->_limits._left != -1)
|
if (z->_limits._left != -1)
|
||||||
continue;
|
continue;
|
||||||
if (_si < _yourself._zone.pos._position._x)
|
if (_si < _vm->_char._yourself._zone.pos._position._x)
|
||||||
continue;
|
continue;
|
||||||
if (_si > (_yourself._zone.pos._position._x + _yourself._cnv._width))
|
if (_si > (_vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width))
|
||||||
continue;
|
continue;
|
||||||
if (_di < _yourself._zone.pos._position._y)
|
if (_di < _vm->_char._yourself._zone.pos._position._y)
|
||||||
continue;
|
continue;
|
||||||
if (_di > (_yourself._zone.pos._position._y + _yourself._cnv._height))
|
if (_di > (_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue