mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
GLK: COMPREHEND: Cleanup of game classes
This commit is contained in:
parent
99dffa8609
commit
54e16ae6dd
@ -35,6 +35,8 @@ namespace Comprehend {
|
||||
#define ROOM_IS_DARK 1
|
||||
#define ROOM_IS_TOO_BRIGHT 2
|
||||
|
||||
struct GameStrings;
|
||||
|
||||
class ComprehendGame : public GameInfo, public OpcodeMap {
|
||||
public:
|
||||
Common::String _gameDataFile;
|
||||
@ -44,7 +46,7 @@ public:
|
||||
Common::String _titleGraphicFile;
|
||||
unsigned _colorTable;
|
||||
|
||||
struct GameStrings *_gameStrings;
|
||||
const GameStrings *_gameStrings;
|
||||
|
||||
public:
|
||||
ComprehendGame();
|
||||
|
@ -26,7 +26,7 @@
|
||||
namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
static GameStrings CC1_STRINGS = {0x9};
|
||||
static const GameStrings CC1_STRINGS = {0x9};
|
||||
|
||||
CrimsonCrownGame::CrimsonCrownGame() : ComprehendGame() {
|
||||
setupDisk(1);
|
||||
@ -59,12 +59,8 @@ void CrimsonCrownGame::handleSpecialOpcode(uint8 operand) {
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
/*
|
||||
* Game over - failure.
|
||||
*
|
||||
* FIXME - If playing the second disk this should restart
|
||||
* from the beginning of the first disk.
|
||||
*/
|
||||
// Game over - failure
|
||||
setupDisk(1);
|
||||
game_restart(this);
|
||||
break;
|
||||
|
||||
|
@ -255,7 +255,7 @@ struct StringFile {
|
||||
uint32 base_offset;
|
||||
uint32 end_offset;
|
||||
|
||||
StringFile() : filename(nullptr), base_offset(0), end_offset(0) {}
|
||||
StringFile() : base_offset(0), end_offset(0) {}
|
||||
StringFile(const Common::String &fname, uint32 baseOfs, uint32 endO = 0) : filename(fname), base_offset(baseOfs), end_offset(endO) {
|
||||
}
|
||||
};
|
||||
|
@ -57,22 +57,22 @@ OOToposGame::OOToposGame() : ComprehendGame() {
|
||||
}
|
||||
|
||||
int OOToposGame::roomIsSpecial(unsigned room_index,
|
||||
unsigned *room_desc_string) {
|
||||
unsigned *roomDescString) {
|
||||
Room *room = &_rooms[room_index];
|
||||
|
||||
/* Is the room dark */
|
||||
// Is the room dark
|
||||
if ((room->flags & OO_ROOM_FLAG_DARK) &&
|
||||
!(_flags[OO_FLAG_FLASHLIGHT_ON])) {
|
||||
if (room_desc_string)
|
||||
*room_desc_string = 0xb3;
|
||||
if (roomDescString)
|
||||
*roomDescString = 0xb3;
|
||||
return ROOM_IS_DARK;
|
||||
}
|
||||
|
||||
/* Is the room too bright */
|
||||
// Is the room too bright
|
||||
if (room_index == OO_BRIGHT_ROOM &&
|
||||
!_flags[OO_FLAG_WEARING_GOGGLES]) {
|
||||
if (room_desc_string)
|
||||
*room_desc_string = 0x1c;
|
||||
if (roomDescString)
|
||||
*roomDescString = 0x1c;
|
||||
return ROOM_IS_TOO_BRIGHT;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ int OOToposGame::roomIsSpecial(unsigned room_index,
|
||||
}
|
||||
|
||||
bool OOToposGame::beforeTurn() {
|
||||
/* FIXME - probably doesn't work correctly with restored games */
|
||||
// FIXME: Probably doesn't work correctly with restored games
|
||||
static bool flashlight_was_on = false, googles_were_worn = false;
|
||||
Room *room = &_rooms[_currentRoom];
|
||||
|
||||
@ -110,21 +110,23 @@ bool OOToposGame::beforeTurn() {
|
||||
void OOToposGame::handleSpecialOpcode(uint8 operand) {
|
||||
switch (operand) {
|
||||
case 0x03:
|
||||
/* Game over - failure */
|
||||
// Game over - failure
|
||||
// fall through
|
||||
case 0x05:
|
||||
/* Won the game */
|
||||
// Won the game
|
||||
// fall through
|
||||
case 0x04:
|
||||
/* Restart game */
|
||||
// Restart game
|
||||
game_restart(this);
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
/* Save game */
|
||||
// Save game
|
||||
game_save(this);
|
||||
break;
|
||||
|
||||
case 0x07:
|
||||
/* Restore game */
|
||||
// Restore game
|
||||
game_restore(this);
|
||||
break;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ const TransylvaniaMonster TransylvaniaGame::VAMPIRE = {
|
||||
0x26, 5, (1 << 7), 0, 5
|
||||
};
|
||||
|
||||
static GameStrings TR_STRINGS = {
|
||||
static const GameStrings TR_STRINGS = {
|
||||
EXTRA_STRING_TABLE(0x8a)
|
||||
};
|
||||
|
||||
@ -62,7 +62,7 @@ TransylvaniaGame::TransylvaniaGame() : ComprehendGame() {
|
||||
_gameStrings = &TR_STRINGS;
|
||||
}
|
||||
|
||||
void TransylvaniaGame::update_monster(const TransylvaniaMonster *monster_info) {
|
||||
void TransylvaniaGame::updateMonster(const TransylvaniaMonster *monsterInfo) {
|
||||
Item *monster;
|
||||
Room *room;
|
||||
uint16 turn_count;
|
||||
@ -70,21 +70,21 @@ void TransylvaniaGame::update_monster(const TransylvaniaMonster *monster_info) {
|
||||
room = &_rooms[_currentRoom];
|
||||
turn_count = _variables[VAR_TURN_COUNT];
|
||||
|
||||
monster = get_item(this, monster_info->object);
|
||||
monster = get_item(this, monsterInfo->object);
|
||||
if (monster->room == _currentRoom) {
|
||||
/* The monster is in the current room - leave it there */
|
||||
// The monster is in the current room - leave it there
|
||||
return;
|
||||
}
|
||||
|
||||
if ((room->flags & monster_info->room_allow_flag) &&
|
||||
!_flags[monster_info->dead_flag] &&
|
||||
turn_count > monster_info->min_turns_before) {
|
||||
if ((room->flags & monsterInfo->room_allow_flag) &&
|
||||
!_flags[monsterInfo->dead_flag] &&
|
||||
turn_count > monsterInfo->min_turns_before) {
|
||||
/*
|
||||
* The monster is alive and allowed to move to the current
|
||||
* room. Randomly decide whether on not to. If not, move
|
||||
* it back to limbo.
|
||||
*/
|
||||
if ((g_comprehend->getRandomNumber(0x7fffffff) % monster_info->randomness) == 0) {
|
||||
if ((g_comprehend->getRandomNumber(0x7fffffff) % monsterInfo->randomness) == 0) {
|
||||
move_object(this, monster, _currentRoom);
|
||||
_variables[0xf] = turn_count + 1;
|
||||
} else {
|
||||
@ -94,13 +94,13 @@ void TransylvaniaGame::update_monster(const TransylvaniaMonster *monster_info) {
|
||||
}
|
||||
|
||||
int TransylvaniaGame::roomIsSpecial(unsigned room_index,
|
||||
unsigned *room_desc_string)
|
||||
unsigned *roomDescString)
|
||||
{
|
||||
Room *room = &_rooms[room_index];
|
||||
|
||||
if (room_index == 0x28) {
|
||||
if (room_desc_string)
|
||||
*room_desc_string = room->string_desc;
|
||||
if (roomDescString)
|
||||
*roomDescString = room->string_desc;
|
||||
return ROOM_IS_DARK;
|
||||
}
|
||||
|
||||
@ -108,8 +108,8 @@ int TransylvaniaGame::roomIsSpecial(unsigned room_index,
|
||||
}
|
||||
|
||||
bool TransylvaniaGame::beforeTurn() {
|
||||
update_monster(&WEREWOLF);
|
||||
update_monster(&VAMPIRE);
|
||||
updateMonster(&WEREWOLF);
|
||||
updateMonster(&VAMPIRE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -117,14 +117,11 @@ void TransylvaniaGame::handleSpecialOpcode(uint8 operand)
|
||||
{
|
||||
switch (operand) {
|
||||
case 0x01:
|
||||
/*
|
||||
* FIXME - Called when the mice are dropped and the cat chases
|
||||
* them.
|
||||
*/
|
||||
// FIXME: Called when the mice are dropped and the cat chases them.
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
/* FIXME - Called when the gun is fired */
|
||||
// FIXME: Called when the gun is fired
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
@ -136,11 +133,13 @@ void TransylvaniaGame::handleSpecialOpcode(uint8 operand)
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
/* Game over - failure */
|
||||
// Game over - failure
|
||||
// fall through
|
||||
case 0x05:
|
||||
/* Won the game */
|
||||
// Won the game
|
||||
// fall through
|
||||
case 0x08:
|
||||
/* Restart game */
|
||||
// Restart game
|
||||
game_restart(this);
|
||||
break;
|
||||
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
static const TransylvaniaMonster WEREWOLF;
|
||||
static const TransylvaniaMonster VAMPIRE;
|
||||
|
||||
void update_monster(const TransylvaniaMonster *monster_info);
|
||||
void updateMonster(const TransylvaniaMonster *monsterInfo);
|
||||
|
||||
public:
|
||||
TransylvaniaGame();
|
||||
@ -49,7 +49,7 @@ public:
|
||||
|
||||
void beforeGame() override;
|
||||
bool beforeTurn() override;
|
||||
int roomIsSpecial(unsigned room_index, unsigned *room_desc_string) override;
|
||||
int roomIsSpecial(unsigned room_index, unsigned *roomDescString) override;
|
||||
void handleSpecialOpcode(uint8 operand) override;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user