GOB: more comments on Map "oblique" coordinates used in Adibou2

This commit is contained in:
Simon Delamarre 2022-11-28 12:45:27 +01:00 committed by Eugene Sandulenko
parent 2300f9c7e9
commit 2ec5b0185d
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
6 changed files with 28 additions and 23 deletions

View File

@ -42,7 +42,7 @@ Goblin_v2::Goblin_v2(GobEngine *vm) : Goblin_v1(vm) {
}
void Goblin_v2::freeObjects() {
_vm->_map->_mapUnknownBool = false;
_vm->_map->_usesObliqueCoordinates = false;
if (_gobsCount < 0)
return;

View File

@ -254,8 +254,8 @@ void Goblin_v7::setGoblinState(Mult::Mult_Object *obj, int16 animState) {
int32 newX = 0;
int32 newY = 0;
if (_vm->_map->_mapUnknownBool) {
// Weird coordinates mapping
if (_vm->_map->_usesObliqueCoordinates) {
// Oblique coordinates to screen coordinates mapping
newX = (_vm->_map->getTilesWidth() / 2) * obj->pAnimData->destX +
(_vm->_map->getTilesWidth() / 2) * obj->pAnimData->destY -
(_vm->_map->getTilesWidth() * 39) / 2;
@ -315,16 +315,21 @@ void Goblin_v7::setGoblinState(Mult::Mult_Object *obj, int16 animState) {
}
/*
* 0: (0, 0)
* 1: (-1, -1)
* 2: (0, -1)
* 3: (1, -1)
* 4: (1, 0)
* 5: (1, 1)
* 6: (0, 1)
* 7: (-1, 1)
* 8: (-1, 0)
* 9: (0, 0)
* NOTE: conversion between direction index, coordinates in Map with _map->_usesObliqueCoordinates
* and screen coordinates
* -----------------------------------------------------
* | dir. index | Map obl. | screen |
* | 0 | ( 0, 0) | ( 0, 0) |
* | 1 | (-1, -1) | (-1, 0) -> left |
* | 2 | ( 0, -1) | (-1, -1) -> up-left |
* | 3 | ( 1, -1) | ( 0, -1) -> up |
* | 4 | ( 1, 0) | ( 1, -1) -> up-right |
* | 5 | ( 1, 1) | ( 1, 0) -> right |
* | 6 | ( 0, 1) | ( 1, 1) -> down-right |
* | 7 | (-1, 1) | ( 0, 1) -> down |
* | 8 | (-1, 0) | (-1, 1) -> down-left |
* | 9 | ( 0, 0) | ( 0, 0) |
* -----------------------------------------------------
*/
static int8 deltaXFromDirection[10] = {0, -1, 0, 1, 1, 1, 0, -1, -1, 0};

View File

@ -43,7 +43,7 @@ Map::Map(GobEngine *vm) : _vm(vm) {
_bigTiles = false;
_mapUnknownBool = false;
_usesObliqueCoordinates = false;
_wayPointCount = 0;
_wayPoints = nullptr;

View File

@ -76,7 +76,7 @@ public:
int16 _destX;
int16 _destY;
bool _mapUnknownBool;
bool _usesObliqueCoordinates;
ItemPos _itemPoses[40];
char _sourceFile[15];

View File

@ -81,11 +81,11 @@ void Map_v2::loadMapObjects(const char *avjFile) {
break;
}
case 65534:
_tilesWidth = READ_VARO_UINT8(var);
_tilesHeight = READ_VARO_UINT8(var + 1);
_mapWidth = READ_VARO_UINT8(var + 2);
_mapHeight = READ_VARO_UINT8(var + 3);
_mapUnknownBool = READ_VARO_UINT8(var + 4) ? true : false;
_tilesWidth = READ_VARO_UINT8(var);
_tilesHeight = READ_VARO_UINT8(var + 1);
_mapWidth = READ_VARO_UINT8(var + 2);
_mapHeight = READ_VARO_UINT8(var + 3);
_usesObliqueCoordinates = READ_VARO_UINT8(var + 4) ? true : false;
break;
case 65535:
_passMap = (int8 *)_vm->_inter->_variables->getAddressOff8(var);

View File

@ -832,7 +832,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) {
break;
case 10:
if (_vm->_map->_mapUnknownBool) {
if (_vm->_map->_usesObliqueCoordinates) {
int8 deltaY = animObj.destY - animObj.goblinY;
if (deltaY == -1) {
*animObj.pPosX = *animObj.pPosX - _vm->_map->getTilesWidth();
@ -841,7 +841,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) {
}
}
else {
warning("Adibou2 newCycleAnim _mapUnknownBool == false stub");
warning("STUB: newCycleAnim: _map->_usesObliqueCoordinates == false");
}
@ -894,7 +894,7 @@ void Mult_v2::animate() {
Mult_Object &animObj = _objects[i];
Mult_AnimData &animData = *(animObj.pAnimData);
if (_vm->_map->_mapUnknownBool && !animData.isStatic && animData.order < 100) {
if (_vm->_map->_usesObliqueCoordinates && !animData.isStatic && animData.order < 100) {
animData.order = currentOrder;
animData.field_22 = 0;
animData.field_21 = 0;