WAGE: Finished world reset
This commit is contained in:
parent
130a671e8f
commit
c001c30547
4 changed files with 108 additions and 79 deletions
|
@ -59,6 +59,19 @@ void Designed::setDesignBounds(Common::Rect *bounds) {
|
|||
_design->setBounds(bounds);
|
||||
}
|
||||
|
||||
Context::Context() {
|
||||
_visits = 0;
|
||||
_kills = 0;
|
||||
_experience = 0;
|
||||
_frozen = false;
|
||||
|
||||
for (int i = 0; i < 26 * 9; i++)
|
||||
_userVariables[i] = 0;
|
||||
|
||||
for (int i = 0; i < 18; i++)
|
||||
_statVariables[i] = 0;
|
||||
}
|
||||
|
||||
Scene::Scene() {
|
||||
_script = NULL;
|
||||
_design = NULL;
|
||||
|
@ -317,6 +330,20 @@ Chr::Chr(String name, Common::SeekableReadStream *data) {
|
|||
_armor[i] = NULL;
|
||||
}
|
||||
|
||||
void Chr::resetState() {
|
||||
_context._statVariables[PHYS_STR_BAS] = _context._statVariables[PHYS_STR_CUR] = _physicalStrength;
|
||||
_context._statVariables[PHYS_HIT_BAS] = _context._statVariables[PHYS_HIT_CUR] = _physicalHp;
|
||||
_context._statVariables[PHYS_ARM_BAS] = _context._statVariables[PHYS_ARM_CUR] = _naturalArmor;
|
||||
_context._statVariables[PHYS_ACC_BAS] = _context._statVariables[PHYS_ACC_CUR] = _physicalAccuracy;
|
||||
|
||||
_context._statVariables[SPIR_STR_BAS] = _context._statVariables[SPIR_STR_CUR] = _spiritualStength;
|
||||
_context._statVariables[SPIR_HIT_BAS] = _context._statVariables[SPIR_HIT_CUR] = _spiritialHp;
|
||||
_context._statVariables[SPIR_ARM_BAS] = _context._statVariables[SPIR_ARM_CUR] = _naturalArmor;
|
||||
_context._statVariables[SPIR_ACC_BAS] = _context._statVariables[SPIR_ACC_CUR] = _physicalAccuracy;
|
||||
|
||||
_context._statVariables[PHYS_SPE_BAS] = _context._statVariables[PHYS_SPE_CUR] = _runningSpeed;
|
||||
}
|
||||
|
||||
WeaponArray *Chr::getWeapons() {
|
||||
WeaponArray *list = new WeaponArray;
|
||||
|
||||
|
|
|
@ -62,50 +62,53 @@ class Weapon;
|
|||
|
||||
typedef Common::Array<Weapon *> WeaponArray;
|
||||
|
||||
enum StatVariable {
|
||||
/** The base physical accuracy of the player. */
|
||||
PHYS_ACC_BAS = 0,
|
||||
/** The current physical accuracy of the player. */
|
||||
PHYS_ACC_CUR = 1,
|
||||
/** The base physical armor of the player. */
|
||||
PHYS_ARM_BAS = 2,
|
||||
/** The current physical armor of the player. */
|
||||
PHYS_ARM_CUR = 3,
|
||||
/** The base physical hit points of the player. */
|
||||
PHYS_HIT_BAS = 4,
|
||||
/** The current physical hit points of the player. */
|
||||
PHYS_HIT_CUR = 5,
|
||||
/** The base physical speed of the player. */
|
||||
PHYS_SPE_BAS = 6,
|
||||
/** The current physical speed of the player. */
|
||||
PHYS_SPE_CUR = 7,
|
||||
/** The base physical strength of the player. */
|
||||
PHYS_STR_BAS = 8,
|
||||
/** The current physical strength of the player. */
|
||||
PHYS_STR_CUR = 9,
|
||||
/** The base spiritual accuracy of the player. */
|
||||
SPIR_ACC_BAS = 10,
|
||||
/** The current spiritual accuracy of the player. */
|
||||
SPIR_ACC_CUR = 11,
|
||||
/** The base spiritual armor of the player. */
|
||||
SPIR_ARM_BAS = 12,
|
||||
/** The current spiritual armor of the player. */
|
||||
SPIR_ARM_CUR = 13,
|
||||
/** The base spiritual hit points of the player. */
|
||||
SPIR_HIT_BAS = 14,
|
||||
/** The current spiritual hit points of the player. */
|
||||
SPIR_HIT_CUR = 15,
|
||||
/** The base spiritual strength of the player. */
|
||||
SPIR_STR_BAS = 16,
|
||||
/** The current spiritual strength of the player. */
|
||||
SPIR_STR_CUR = 17
|
||||
};
|
||||
|
||||
class Context {
|
||||
public:
|
||||
enum StatVariable {
|
||||
/** The base physical accuracy of the player. */
|
||||
PHYS_ACC_BAS = 0,
|
||||
/** The current physical accuracy of the player. */
|
||||
PHYS_ACC_CUR = 1,
|
||||
/** The base physical armor of the player. */
|
||||
PHYS_ARM_BAS = 2,
|
||||
/** The current physical armor of the player. */
|
||||
PHYS_ARM_CUR = 3,
|
||||
/** The base physical hit points of the player. */
|
||||
PHYS_HIT_BAS = 4,
|
||||
/** The current physical hit points of the player. */
|
||||
PHYS_HIT_CUR = 5,
|
||||
/** The base physical speed of the player. */
|
||||
PHYS_SPE_BAS = 6,
|
||||
/** The current physical speed of the player. */
|
||||
PHYS_SPE_CUR = 7,
|
||||
/** The base physical strength of the player. */
|
||||
PHYS_STR_BAS = 8,
|
||||
/** The current physical strength of the player. */
|
||||
PHYS_STR_CUR = 9,
|
||||
/** The base spiritual accuracy of the player. */
|
||||
SPIR_ACC_BAS = 10,
|
||||
/** The current spiritual accuracy of the player. */
|
||||
SPIR_ACC_CUR = 11,
|
||||
/** The base spiritual armor of the player. */
|
||||
SPIR_ARM_BAS = 12,
|
||||
/** The current spiritual armor of the player. */
|
||||
SPIR_ARM_CUR = 13,
|
||||
/** The base spiritual hit points of the player. */
|
||||
SPIR_HIT_BAS = 14,
|
||||
/** The current spiritual hit points of the player. */
|
||||
SPIR_HIT_CUR = 15,
|
||||
/** The base spiritual strength of the player. */
|
||||
SPIR_STR_BAS = 16,
|
||||
/** The current spiritual strength of the player. */
|
||||
SPIR_STR_CUR = 17
|
||||
};
|
||||
Context();
|
||||
|
||||
int16 _visits; // Number of scenes visited, including repeated visits
|
||||
int16 _kills; // Number of characters killed
|
||||
int16 _experience;
|
||||
bool _frozen;
|
||||
int16 _userVariables[26 * 9];
|
||||
int16 _statVariables[18];
|
||||
};
|
||||
|
@ -284,6 +287,8 @@ public:
|
|||
}
|
||||
int wearObjIfPossible(Obj *obj);
|
||||
void wearObjs();
|
||||
|
||||
void resetState();
|
||||
};
|
||||
|
||||
class Weapon {
|
||||
|
|
|
@ -261,41 +261,41 @@ Script::Operand *Script::readOperand() {
|
|||
return new Operand(cont->_userVariables[value - 1], NUMBER);
|
||||
}
|
||||
case 0xD0:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_STR_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_STR_BAS], NUMBER);
|
||||
case 0xD1:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_HIT_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_HIT_BAS], NUMBER);
|
||||
case 0xD2:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_ARM_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_ARM_BAS], NUMBER);
|
||||
case 0xD3:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_ACC_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_ACC_BAS], NUMBER);
|
||||
case 0xD4:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_STR_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_STR_BAS], NUMBER);
|
||||
case 0xD5:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_HIT_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_HIT_BAS], NUMBER);
|
||||
case 0xD6:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_ARM_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_ARM_BAS], NUMBER);
|
||||
case 0xD7:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_ACC_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_ACC_BAS], NUMBER);
|
||||
case 0xD8:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_SPE_BAS], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_SPE_BAS], NUMBER);
|
||||
case 0xE0:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_STR_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_STR_CUR], NUMBER);
|
||||
case 0xE1:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_HIT_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_HIT_CUR], NUMBER);
|
||||
case 0xE2:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_ARM_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_ARM_CUR], NUMBER);
|
||||
case 0xE3:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_ACC_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_ACC_CUR], NUMBER);
|
||||
case 0xE4:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_STR_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_STR_CUR], NUMBER);
|
||||
case 0xE5:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_HIT_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_HIT_CUR], NUMBER);
|
||||
case 0xE6:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_ARM_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_ARM_CUR], NUMBER);
|
||||
case 0xE7:
|
||||
return new Operand(cont->_statVariables[Context::SPIR_ACC_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[SPIR_ACC_CUR], NUMBER);
|
||||
case 0xE8:
|
||||
return new Operand(cont->_statVariables[Context::PHYS_SPE_CUR], NUMBER);
|
||||
return new Operand(cont->_statVariables[PHYS_SPE_CUR], NUMBER);
|
||||
default:
|
||||
if (operandType >= 0x20 && operandType < 0x80) {
|
||||
_data->seek(-1, SEEK_CUR);
|
||||
|
@ -315,58 +315,58 @@ void Script::assign(byte operandType, int uservar, uint16 value) {
|
|||
cont->_userVariables[uservar - 1] = value;
|
||||
break;
|
||||
case 0xD0:
|
||||
cont->_statVariables[Context::PHYS_STR_BAS] = value;
|
||||
cont->_statVariables[PHYS_STR_BAS] = value;
|
||||
break;
|
||||
case 0xD1:
|
||||
cont->_statVariables[Context::PHYS_HIT_BAS] = value;
|
||||
cont->_statVariables[PHYS_HIT_BAS] = value;
|
||||
break;
|
||||
case 0xD2:
|
||||
cont->_statVariables[Context::PHYS_ARM_BAS] = value;
|
||||
cont->_statVariables[PHYS_ARM_BAS] = value;
|
||||
break;
|
||||
case 0xD3:
|
||||
cont->_statVariables[Context::PHYS_ACC_BAS] = value;
|
||||
cont->_statVariables[PHYS_ACC_BAS] = value;
|
||||
break;
|
||||
case 0xD4:
|
||||
cont->_statVariables[Context::SPIR_STR_BAS] = value;
|
||||
cont->_statVariables[SPIR_STR_BAS] = value;
|
||||
break;
|
||||
case 0xD5:
|
||||
cont->_statVariables[Context::SPIR_HIT_BAS] = value;
|
||||
cont->_statVariables[SPIR_HIT_BAS] = value;
|
||||
break;
|
||||
case 0xD6:
|
||||
cont->_statVariables[Context::SPIR_ARM_BAS] = value;
|
||||
cont->_statVariables[SPIR_ARM_BAS] = value;
|
||||
break;
|
||||
case 0xD7:
|
||||
cont->_statVariables[Context::SPIR_ACC_BAS] = value;
|
||||
cont->_statVariables[SPIR_ACC_BAS] = value;
|
||||
break;
|
||||
case 0xD8:
|
||||
cont->_statVariables[Context::PHYS_SPE_BAS] = value;
|
||||
cont->_statVariables[PHYS_SPE_BAS] = value;
|
||||
break;
|
||||
case 0xE0:
|
||||
cont->_statVariables[Context::PHYS_STR_CUR] = value;
|
||||
cont->_statVariables[PHYS_STR_CUR] = value;
|
||||
break;
|
||||
case 0xE1:
|
||||
cont->_statVariables[Context::PHYS_HIT_CUR] = value;
|
||||
cont->_statVariables[PHYS_HIT_CUR] = value;
|
||||
break;
|
||||
case 0xE2:
|
||||
cont->_statVariables[Context::PHYS_ARM_CUR] = value;
|
||||
cont->_statVariables[PHYS_ARM_CUR] = value;
|
||||
break;
|
||||
case 0xE3:
|
||||
cont->_statVariables[Context::PHYS_ACC_CUR] = value;
|
||||
cont->_statVariables[PHYS_ACC_CUR] = value;
|
||||
break;
|
||||
case 0xE4:
|
||||
cont->_statVariables[Context::SPIR_STR_CUR] = value;
|
||||
cont->_statVariables[SPIR_STR_CUR] = value;
|
||||
break;
|
||||
case 0xE5:
|
||||
cont->_statVariables[Context::SPIR_HIT_CUR] = value;
|
||||
cont->_statVariables[SPIR_HIT_CUR] = value;
|
||||
break;
|
||||
case 0xE6:
|
||||
cont->_statVariables[Context::SPIR_ARM_CUR] = value;
|
||||
cont->_statVariables[SPIR_ARM_CUR] = value;
|
||||
break;
|
||||
case 0xE7:
|
||||
cont->_statVariables[Context::SPIR_ACC_CUR] = value;
|
||||
cont->_statVariables[SPIR_ACC_CUR] = value;
|
||||
break;
|
||||
case 0xE8:
|
||||
cont->_statVariables[Context::PHYS_SPE_CUR] = value;
|
||||
cont->_statVariables[PHYS_SPE_CUR] = value;
|
||||
break;
|
||||
default:
|
||||
debug("No idea what I'm supposed to assign! (%x at %d)!\n", operandType, _data->pos()-1);
|
||||
|
|
|
@ -419,13 +419,10 @@ void World::move(Chr *chr, Scene *scene, bool skipSort) {
|
|||
Common::sort(scene->_chrs.begin(), scene->_chrs.end(), ChrComparator);
|
||||
|
||||
if (scene == _storageScene) {
|
||||
warning("STUB: World::move (chrState)");
|
||||
//chr.setState(new Chr.State(chr));
|
||||
chr->resetState();
|
||||
} else if (chr->_playerCharacter) {
|
||||
scene->_visited = true;
|
||||
warning("STUB: World::move (visits)");
|
||||
//Context context = getPlayerContext();
|
||||
//context.setVisits(context.getVisits() + 1);
|
||||
_player->_context._visits++;
|
||||
}
|
||||
chr->_currentScene = scene;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue