[Scummvm-cvs-logs] SF.net SVN: scummvm: [25101] scummvm/trunk/engines/agi
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Tue Jan 16 13:40:52 CET 2007
Revision: 25101
http://scummvm.svn.sourceforge.net/scummvm/?rev=25101&view=rev
Author: aquadran
Date: 2007-01-16 04:40:51 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
Formating names in source code
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/agi_v2.cpp
scummvm/trunk/engines/agi/agi_v3.cpp
scummvm/trunk/engines/agi/checks.cpp
scummvm/trunk/engines/agi/console.cpp
scummvm/trunk/engines/agi/console.h
scummvm/trunk/engines/agi/cycle.cpp
scummvm/trunk/engines/agi/font.h
scummvm/trunk/engines/agi/global.cpp
scummvm/trunk/engines/agi/graphics.cpp
scummvm/trunk/engines/agi/graphics.h
scummvm/trunk/engines/agi/id.cpp
scummvm/trunk/engines/agi/inv.cpp
scummvm/trunk/engines/agi/keyboard.cpp
scummvm/trunk/engines/agi/keyboard.h
scummvm/trunk/engines/agi/logic.cpp
scummvm/trunk/engines/agi/logic.h
scummvm/trunk/engines/agi/lzw.cpp
scummvm/trunk/engines/agi/lzw.h
scummvm/trunk/engines/agi/menu.cpp
scummvm/trunk/engines/agi/menu.h
scummvm/trunk/engines/agi/motion.cpp
scummvm/trunk/engines/agi/objects.cpp
scummvm/trunk/engines/agi/op_cmd.cpp
scummvm/trunk/engines/agi/op_dbg.cpp
scummvm/trunk/engines/agi/op_test.cpp
scummvm/trunk/engines/agi/opcodes.h
scummvm/trunk/engines/agi/patches.cpp
scummvm/trunk/engines/agi/picture.cpp
scummvm/trunk/engines/agi/picture.h
scummvm/trunk/engines/agi/predictive.cpp
scummvm/trunk/engines/agi/savegame.cpp
scummvm/trunk/engines/agi/sound.cpp
scummvm/trunk/engines/agi/sound.h
scummvm/trunk/engines/agi/sprite.cpp
scummvm/trunk/engines/agi/sprite.h
scummvm/trunk/engines/agi/text.cpp
scummvm/trunk/engines/agi/view.cpp
scummvm/trunk/engines/agi/view.h
scummvm/trunk/engines/agi/words.cpp
Removed Paths:
-------------
scummvm/trunk/engines/agi/text.h
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/agi.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -50,13 +50,13 @@
namespace Agi {
-static uint32 g_tick_timer;
+static uint32 g_tickTimer;
struct Mouse g_mouse;
-#define key_enqueue(k) do { _key_queue[_key_queue_end++] = (k); \
- _key_queue_end %= KEY_QUEUE_SIZE; } while (0)
-#define key_dequeue(k) do { (k) = _key_queue[_key_queue_start++]; \
- _key_queue_start %= KEY_QUEUE_SIZE; } while (0)
+#define keyEnqueue(k) do { _keyQueue[_keyQueueEnd++] = (k); \
+ _keyQueueEnd %= KEY_QUEUE_SIZE; } while (0)
+#define keyDequeue(k) do { (k) = _keyQueue[_keyQueueStart++]; \
+ _keyQueueStart %= KEY_QUEUE_SIZE; } while (0)
void AgiEngine::processEvents() {
OSystem::Event event;
@@ -72,14 +72,14 @@
case OSystem::EVENT_LBUTTONDOWN:
key = BUTTON_LEFT;
g_mouse.button = 1;
- key_enqueue(key);
+ keyEnqueue(key);
g_mouse.x = event.mouse.x;
g_mouse.y = event.mouse.y;
break;
case OSystem::EVENT_RBUTTONDOWN:
key = BUTTON_RIGHT;
g_mouse.button = 2;
- key_enqueue(key);
+ keyEnqueue(key);
g_mouse.x = event.mouse.x;
g_mouse.y = event.mouse.y;
break;
@@ -92,8 +92,8 @@
g_mouse.button = 0;
break;
case OSystem::EVENT_KEYDOWN:
- _key_control = 0;
- _key_alt = 0;
+ _keyControl = 0;
+ _keyAlt = 0;
if (event.kbd.flags == OSystem::KBD_CTRL && event.kbd.keycode == 'd') {
_console->attach();
@@ -101,10 +101,10 @@
}
if (event.kbd.flags & OSystem::KBD_CTRL)
- _key_control = 1;
+ _keyControl = 1;
if (event.kbd.flags & OSystem::KBD_ALT)
- _key_alt = 1;
+ _keyAlt = 1;
switch (key = event.kbd.keycode) {
case 256 + 20: // left arrow
@@ -201,16 +201,16 @@
key = event.kbd.ascii;
break;
}
- if (_key_control)
+ if (_keyControl)
key = (key & ~0x20) - 0x40;
- else if (_key_alt)
- key = scancode_table[(key & ~0x20) - 0x41] << 8;
+ else if (_keyAlt)
+ key = scancodeTable[(key & ~0x20) - 0x41] << 8;
else if (event.kbd.flags & OSystem::KBD_SHIFT)
key = event.kbd.ascii;
break;
}
if (key)
- key_enqueue(key);
+ keyEnqueue(key);
break;
default:
break;
@@ -220,73 +220,72 @@
int AgiEngine::agiIsKeypressLow() {
processEvents();
- return _key_queue_start != _key_queue_end;
+ return _keyQueueStart != _keyQueueEnd;
}
void AgiEngine::agiTimerLow() {
static uint32 m = 0;
uint32 dm;
- if (g_tick_timer < m)
+ if (g_tickTimer < m)
m = 0;
- while ((dm = g_tick_timer - m) < 5) {
+ while ((dm = g_tickTimer - m) < 5) {
processEvents();
if (_console->isAttached())
_console->onFrame();
g_system->delayMillis(10);
g_system->updateScreen();
}
- m = g_tick_timer;
+ m = g_tickTimer;
}
int AgiEngine::agiGetKeypressLow() {
int k;
- while (_key_queue_start == _key_queue_end) /* block */
+ while (_keyQueueStart == _keyQueueEnd) /* block */
agiTimerLow();
- key_dequeue(k);
+ keyDequeue(k);
return k;
}
void AgiEngine::agiTimerFunctionLow(void *refCon) {
- g_tick_timer++;
+ g_tickTimer++;
}
-void AgiEngine::clear_image_stack(void) {
- image_stack_pointer = 0;
+void AgiEngine::clearImageStack(void) {
+ _imageStackPointer = 0;
}
-void AgiEngine::release_image_stack(void) {
- if (image_stack)
- free(image_stack);
- image_stack = NULL;
- stack_size = image_stack_pointer = 0;
+void AgiEngine::releaseImageStack(void) {
+ if (_imageStack)
+ free(_imageStack);
+ _imageStack = NULL;
+ _stackSize = 0;
+ _imageStackPointer = NULL;
}
-void AgiEngine::record_image_stack_call(uint8 type, int16 p1, int16 p2, int16 p3,
+void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7) {
- struct image_stack_element *pnew;
+ struct ImageStackElement *pnew;
- if (image_stack_pointer == stack_size) {
- if (stack_size == 0) { /* first call */
- image_stack = (struct image_stack_element *)
- malloc(INITIAL_IMAGE_STACK_SIZE * sizeof(struct image_stack_element));
- stack_size = INITIAL_IMAGE_STACK_SIZE;
+ if (_imageStackPointer == _stackSize) {
+ if (_stackSize == 0) { /* first call */
+ _imageStack = (ImageStackElement *)malloc(INITIAL_IMAGE_STACK_SIZE * sizeof(ImageStackElement));
+ _stackSize = INITIAL_IMAGE_STACK_SIZE;
} else { /* has to grow */
- struct image_stack_element *new_stack;
- new_stack = (struct image_stack_element *)
- malloc(2 * stack_size * sizeof(struct image_stack_element));
- memcpy(new_stack, image_stack, stack_size * sizeof(struct image_stack_element));
- free(image_stack);
- image_stack = new_stack;
- stack_size *= 2;
+ struct ImageStackElement *newStack;
+ newStack = (ImageStackElement *)malloc(2 * _stackSize * sizeof(ImageStackElement));
+ memcpy(newStack, _imageStack, _stackSize * sizeof(ImageStackElement));
+ free(_imageStack);
+ _imageStack = newStack;
+ _stackSize *= 2;
}
}
- pnew = &image_stack[image_stack_pointer];
- image_stack_pointer++;
+ pnew = &_imageStack[_imageStackPointer];
+ _imageStackPointer++;
pnew->type = type;
pnew->parm1 = p1;
@@ -298,17 +297,17 @@
pnew->parm7 = p7;
}
-void AgiEngine::replay_image_stack_call(uint8 type, int16 p1, int16 p2, int16 p3,
+void AgiEngine::replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7) {
switch (type) {
case ADD_PIC:
debugC(8, kDebugLevelMain, "--- decoding picture %d ---", p1);
agiLoadResource(rPICTURE, p1);
- _picture->decode_picture(p1, p2);
+ _picture->decodePicture(p1, p2);
break;
case ADD_VIEW:
agiLoadResource(rVIEW, p1);
- _sprites->add_to_pic(p1, p2, p3, p4, p5, p6, p7);
+ _sprites->addToPic(p1, p2, p3, p4, p5, p6, p7);
break;
}
}
@@ -318,7 +317,7 @@
for (p = 1; p < 15; p++) {
for (i = 0; i < 12; i++) {
- game.pri_table[y++] = p < 4 ? 4 : p;
+ _game.priTable[y++] = p < 4 ? 4 : p;
}
}
}
@@ -327,44 +326,44 @@
int ec, i;
debug(2, "initializing");
- debug(2, "game.ver = 0x%x", game.ver);
+ debug(2, "game.ver = 0x%x", _game.ver);
/* reset all flags to false and all variables to 0 */
for (i = 0; i < MAX_FLAGS; i++)
- game.flags[i] = 0;
+ _game.flags[i] = 0;
for (i = 0; i < MAX_VARS; i++)
- game.vars[i] = 0;
+ _game.vars[i] = 0;
/* clear all resources and events */
for (i = 0; i < MAX_DIRS; i++) {
- memset(&game.views[i], 0, sizeof(struct agi_view));
- memset(&game.pictures[i], 0, sizeof(struct agi_picture));
- memset(&game.logics[i], 0, sizeof(struct agi_logic));
- memset(&game.sounds[i], 0, sizeof(struct agi_sound));
- memset(&game.dir_view[i], 0, sizeof(struct agi_dir));
- memset(&game.dir_pic[i], 0, sizeof(struct agi_dir));
- memset(&game.dir_logic[i], 0, sizeof(struct agi_dir));
- memset(&game.dir_sound[i], 0, sizeof(struct agi_dir));
+ memset(&_game.views[i], 0, sizeof(struct AgiView));
+ memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
+ memset(&_game.logics[i], 0, sizeof(struct AgiLogic));
+ memset(&_game.sounds[i], 0, sizeof(struct AgiSound));
+ memset(&_game.dirView[i], 0, sizeof(struct AgiDir));
+ memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
+ memset(&_game.dirLogic[i], 0, sizeof(struct AgiDir));
+ memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
}
/* clear view table */
for (i = 0; i < MAX_VIEWTABLE; i++)
- memset(&game.view_table[i], 0, sizeof(struct vt_entry));
+ memset(&_game.viewTable[i], 0, sizeof(struct VtEntry));
- init_words();
+ initWords();
- if (!menu)
- menu = new Menu(this, _gfx, _picture);
+ if (!_menu)
+ _menu = new Menu(this, _gfx, _picture);
initPriTable();
/* clear string buffer */
for (i = 0; i < MAX_STRINGS; i++)
- game.strings[i][0] = 0;
+ _game.strings[i][0] = 0;
/* setup emulation */
- switch (loader->getIntVersion() >> 12) {
+ switch (_loader->getIntVersion() >> 12) {
case 2:
report("Emulating Sierra AGI v%x.%03x\n",
(int)(agiGetRelease() >> 12) & 0xF,
@@ -377,30 +376,30 @@
break;
}
- game.game_flags |= opt.amigaMode ? ID_AMIGA : 0;
- game.game_flags |= opt.agdsMode ? ID_AGDS : 0;
+ _game.gameFlags |= _opt.amigaMode ? ID_AMIGA : 0;
+ _game.gameFlags |= _opt.agdsMode ? ID_AGDS : 0;
- if (game.game_flags & ID_AMIGA)
+ if (_game.gameFlags & ID_AMIGA)
report("Amiga padded game detected.\n");
- if (game.game_flags & ID_AGDS)
+ if (_game.gameFlags & ID_AGDS)
report("AGDS mode enabled.\n");
- ec = loader->init(); /* load vol files, etc */
+ ec = _loader->init(); /* load vol files, etc */
- if (ec == err_OK)
- ec = loader->load_objects(OBJECTS);
+ if (ec == errOK)
+ ec = _loader->loadObjects(OBJECTS);
/* note: demogs has no words.tok */
- if (ec == err_OK)
- ec = loader->load_words(WORDS);
+ if (ec == errOK)
+ ec = _loader->loadWords(WORDS);
/* FIXME: load IIgs instruments and samples */
/* load_instruments("kq.sys16"); */
/* Load logic 0 into memory */
- if (ec == err_OK)
- ec = loader->load_resource(rLOGIC, 0);
+ if (ec == errOK)
+ ec = _loader->loadResource(rLOGIC, 0);
return ec;
}
@@ -414,76 +413,76 @@
/* Make sure logic 0 is always loaded */
for (i = 1; i < MAX_DIRS; i++) {
- loader->unload_resource(rLOGIC, i);
+ _loader->unloadResource(rLOGIC, i);
}
for (i = 0; i < MAX_DIRS; i++) {
- loader->unload_resource(rVIEW, i);
- loader->unload_resource(rPICTURE, i);
- loader->unload_resource(rSOUND, i);
+ _loader->unloadResource(rVIEW, i);
+ _loader->unloadResource(rPICTURE, i);
+ _loader->unloadResource(rSOUND, i);
}
}
int AgiEngine::agiDeinit() {
int ec;
- clean_input(); /* remove all words from memory */
+ cleanInput(); /* remove all words from memory */
agiUnloadResources(); /* unload resources in memory */
- loader->unload_resource(rLOGIC, 0);
- ec = loader->deinit();
- unload_objects();
- unload_words();
+ _loader->unloadResource(rLOGIC, 0);
+ ec = _loader->deinit();
+ unloadObjects();
+ unloadWords();
- clear_image_stack();
+ clearImageStack();
return ec;
}
int AgiEngine::agiDetectGame() {
- int ec = err_OK;
+ int ec = errOK;
assert(_gameDescription != NULL);
- opt.amigaMode = ((_gameDescription->features & AGI_AMIGA) == AGI_AMIGA);
- opt.agdsMode = ((_gameDescription->features & AGI_AGDS) == AGI_AGDS);
- opt.agimouse = ((_gameDescription->features & AGI_MOUSE) == AGI_MOUSE);
+ _opt.amigaMode = ((_gameDescription->features & AGI_AMIGA) == AGI_AMIGA);
+ _opt.agdsMode = ((_gameDescription->features & AGI_AGDS) == AGI_AGDS);
+ _opt.agimouse = ((_gameDescription->features & AGI_MOUSE) == AGI_MOUSE);
if(_gameDescription->version <= 0x2999) {
- loader = new AgiLoader_v2(this);
+ _loader = new AgiLoader_v2(this);
} else {
- loader = new AgiLoader_v3(this);
+ _loader = new AgiLoader_v3(this);
}
- ec = loader->detect_game();
+ ec = _loader->detectGame();
return ec;
}
int AgiEngine::agiVersion() {
- return loader->version();
+ return _loader->version();
}
int AgiEngine::agiGetRelease() {
- return loader->getIntVersion();
+ return _loader->getIntVersion();
}
void AgiEngine::agiSetRelease(int n) {
- loader->setIntVersion(n);
+ _loader->setIntVersion(n);
}
int AgiEngine::agiLoadResource(int r, int n) {
int i;
- i = loader->load_resource(r, n);
+ i = _loader->loadResource(r, n);
#ifdef PATCH_LOGIC
if (r == rLOGIC)
- patch_logic(n);
+ patchLogic(n);
#endif
return i;
}
int AgiEngine::agiUnloadResource(int r, int n) {
- return loader->unload_resource(r, n);
+ return _loader->unloadResource(r, n);
}
struct GameSettings {
@@ -494,13 +493,11 @@
const char *detectname;
};
-static const GameSettings agi_settings[] = {
+static const GameSettings agiSettings[] = {
{"agi", "AGI game", GID_AGI, MDT_ADLIB, "OBJECT"},
{NULL, NULL, 0, 0, NULL}
};
-Common::RandomSource * rnd;
-
AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) {
// Setup mixer
@@ -516,7 +513,7 @@
const GameSettings *g;
const char *gameid = ConfMan.get("gameid").c_str();
- for (g = agi_settings; g->gameid; ++g)
+ for (g = agiSettings; g->gameid; ++g)
if (!scumm_stricmp(g->gameid, gameid))
_gameId = g->id;
@@ -534,38 +531,40 @@
Common::addSpecialDebugLevel(kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging");
- memset(&game, 0, sizeof(struct agi_game));
- memset(&_debug, 0, sizeof(struct agi_debug));
+ memset(&_game, 0, sizeof(struct AgiGame));
+ memset(&_debug, 0, sizeof(struct AgiDebug));
memset(&g_mouse, 0, sizeof(struct Mouse));
- game.clock_enabled = false;
- game.state = STATE_INIT;
+ _game.clockEnabled = false;
+ _game.state = STATE_INIT;
- _key_queue_start = 0;
- _key_queue_end = 0;
+ _keyQueueStart = 0;
+ _keyQueueEnd = 0;
- _key_control = 0;
- _key_alt = 0;
+ _keyControl = 0;
+ _keyAlt = 0;
- g_tick_timer = 0;
+ g_tickTimer = 0;
- intobj = NULL;
+ _intobj = NULL;
- stack_size = 0;
- image_stack = NULL;
- image_stack_pointer = 0;
+ _stackSize = 0;
+ _imageStack = NULL;
+ _imageStackPointer = 0;
- menu = NULL;
+ _menu = NULL;
- last_sentence[0] = 0;
- memset(&stringdata, 0, sizeof(struct string_data));
+ _lastSentence[0] = 0;
+ memset(&_stringdata, 0, sizeof(struct StringData));
- objects = NULL;
+ _objects = NULL;
+
+ _oldMode = -1;
}
void AgiEngine::initialize() {
- memset(&opt, 0, sizeof(struct agi_options));
- opt.gamerun = GAMERUN_RUNGAME;
+ memset(&_opt, 0, sizeof(struct AgiOptions));
+ _opt.gamerun = GAMERUN_RUNGAME;
// TODO: Some sound emulation modes do not fit our current music
// drivers, and I'm not sure what they are. For now, they might
@@ -573,15 +572,15 @@
switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) {
case MD_PCSPK:
- opt.soundemu = SOUND_EMU_PC;
+ _opt.soundemu = SOUND_EMU_PC;
break;
default:
- opt.soundemu = SOUND_EMU_NONE;
+ _opt.soundemu = SOUND_EMU_NONE;
break;
}
if (ConfMan.hasKey("render_mode"))
- opt.renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
+ _opt.renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
_console = new Console(this);
_gfx = new GfxMgr(this);
@@ -591,27 +590,27 @@
_gfx->initMachine();
- game.game_flags = 0;
+ _game.gameFlags = 0;
- game.color_fg = 15;
- game.color_bg = 0;
+ _game.colorFg = 15;
+ _game.colorBg = 0;
- game.name[0] = '\0';
+ _game.name[0] = '\0';
- game.sbuf = (uint8 *)calloc(_WIDTH, _HEIGHT);
+ _game.sbuf = (uint8 *)calloc(_WIDTH, _HEIGHT);
_gfx->initVideo();
- _sound->init_sound();
+ _sound->initSound();
_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL);
- game.ver = -1; /* Don't display the conf file warning */
+ _game.ver = -1; /* Don't display the conf file warning */
debugC(2, kDebugLevelMain, "Detect game");
- if (agiDetectGame() == err_OK) {
- game.state = STATE_LOADED;
+ if (agiDetectGame() == errOK) {
+ _game.state = STATE_LOADED;
debugC(2, kDebugLevelMain, "game loaded");
} else {
report("Could not open AGI game");
@@ -622,13 +621,13 @@
AgiEngine::~AgiEngine() {
agiDeinit();
- _sound->deinit_sound();
+ _sound->deinitSound();
delete _sound;
_gfx->deinitVideo();
delete _sprites;
- free(game.sbuf);
+ free(_game.sbuf);
_gfx->deinitMachine();
- delete rnd;
+ delete _rnd;
delete _console;
}
@@ -658,15 +657,15 @@
CursorMan.showMouse(true);
report(" \nAGI engine %s is ready.\n", gScummVMVersion);
- if (game.state < STATE_LOADED) {
+ if (_game.state < STATE_LOADED) {
do {
- main_cycle();
- } while (game.state < STATE_RUNNING);
- if (game.ver < 0)
- game.ver = 0; /* Enable conf file warning */
+ mainCycle();
+ } while (_game.state < STATE_RUNNING);
+ if (_game.ver < 0)
+ _game.ver = 0; /* Enable conf file warning */
}
- run_game();
+ runGame();
return 0;
}
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/agi.h 2007-01-16 12:40:51 UTC (rev 25101)
@@ -99,7 +99,6 @@
namespace Agi {
-
enum AgiGameType {
GType_V2 = 1,
GType_V3
@@ -120,29 +119,26 @@
uint16 version;
};
-
-
-
enum {
NO_GAMEDIR = 0,
GAMEDIR
};
enum AGIErrors {
- err_OK = 0,
- err_DoNothing,
- err_BadCLISwitch,
- err_InvalidAGIFile,
- err_BadFileOpen,
- err_NotEnoughMemory,
- err_BadResource,
- err_UnknownAGIVersion,
- err_RestartGame,
- err_NoLoopsInView,
- err_ViewDataError,
- err_NoGameList,
+ errOK = 0,
+ errDoNothing,
+ errBadCLISwitch,
+ errInvalidAGIFile,
+ errBadFileOpen,
+ errNotEnoughMemory,
+ errBadResource,
+ errUnknownAGIVersion,
+ errRestartGame,
+ errNoLoopsInView,
+ errViewDataError,
+ errNoGameList,
- err_Unk = 127
+ errUnk = 127
};
enum kDebugLevels {
@@ -178,8 +174,8 @@
lTEST_MODE
};
-struct game_id_list {
- struct game_id_list *next;
+struct gameIdList {
+ gameIdList *next;
uint32 version;
uint32 crc;
char *gName;
@@ -195,7 +191,7 @@
/**
* Command-line options.
*/
-struct agi_options {
+struct AgiOptions {
#define GAMERUN_RUNGAME 0
#define GAMERUN_PICVIEW 1
#define GAMERUN_WORDS 2
@@ -225,74 +221,74 @@
* AGI variables.
*/
enum {
- V_cur_room = 0, /* 0 */
- V_prev_room,
- V_border_touch_ego,
- V_score,
- V_border_code,
- V_border_touch_obj, /* 5 */
- V_ego_dir,
- V_max_score,
- V_free_pages,
- V_word_not_found,
- V_time_delay, /* 10 */
- V_seconds,
- V_minutes,
- V_hours,
- V_days,
- V_joystick_sensitivity, /* 15 */
- V_ego_view_resource,
- V_agi_err_code,
- V_agi_err_code_info,
- V_key,
- V_computer, /* 20 */
- V_window_reset,
- V_soundgen,
- V_volume,
- V_max_input_chars,
- V_sel_item, /* 25 */
- V_monitor
+ vCurRoom = 0, /* 0 */
+ vPrevRoom,
+ vBorderTouchEgo,
+ vScore,
+ vBorderCode,
+ vBorderTouchObj, /* 5 */
+ vEgoDir,
+ vMaxScore,
+ vFreePages,
+ vWordNotFound,
+ vTimeDelay, /* 10 */
+ vSeconds,
+ vMinutes,
+ vHours,
+ vDays,
+ vJoystickSensitivity, /* 15 */
+ vEgoViewResource,
+ vAgiErrCode,
+ vAgiErrCodeInfo,
+ vKey,
+ vComputer, /* 20 */
+ vWindowReset,
+ vSoundgen,
+ vVolume,
+ vMaxInputChars,
+ vSelItem, /* 25 */
+ vMonitor
};
/**
* AGI flags
*/
enum {
- F_ego_water = 0, /* 0 */
- F_ego_invisible,
- F_entered_cli,
- F_ego_touched_p2,
- F_said_accepted_input,
- F_new_room_exec, /* 5 */
- F_restart_game,
- F_script_blocked,
- F_joy_sensitivity,
- F_sound_on,
- F_debugger_on, /* 10 */
- F_logic_zero_firsttime,
- F_restore_just_ran,
- F_status_selects_items,
- F_menus_work,
- F_output_mode, /* 15 */
- F_auto_restart
+ fEgoWater = 0, /* 0 */
+ fEgoInvisible,
+ fEnteredCli,
+ fEgoTouchedP2,
+ fSaidAcceptedInput,
+ fNewRoomExec, /* 5 */
+ fRestartGame,
+ fScriptBlocked,
+ fJoySensitivity,
+ fSoundOn,
+ fDebuggerOn, /* 10 */
+ fLogicZeroFirsttime,
+ fRestoreJustRan,
+ fStatusSelectsItems,
+ fMenusWork,
+ fOutputMode, /* 15 */
+ fAutoRestart
};
-struct agi_event {
+struct AgiEvent {
uint16 data;
uint8 occured;
};
-struct agi_object {
+struct AgiObject {
int location;
char *name;
};
-struct agi_word {
+struct AgiWord {
int id;
char *word;
};
-struct agi_dir {
+struct AgiDir {
uint8 volume;
uint32 offset;
uint32 len;
@@ -306,7 +302,7 @@
*/
};
-struct agi_block {
+struct AgiBlock {
int active;
int x1, y1;
int x2, y2;
@@ -323,7 +319,7 @@
* This structure contains all global data of an AGI game executed
* by the interpreter.
*/
-struct agi_game {
+struct AgiGame {
#define STATE_INIT 0x00
#define STATE_LOADED 0x01
#define STATE_RUNNING 0x02
@@ -339,80 +335,80 @@
/* internal variables */
int horizon; /**< horizon y coordinate */
- int line_status; /**< line number to put status on */
- int line_user_input; /**< line to put user input on */
- int line_min_print; /**< num lines to print on */
- int cursor_pos; /**< column where the input cursor is */
- uint8 input_buffer[40]; /**< buffer for user input */
- uint8 echo_buffer[40]; /**< buffer for echo.line */
+ int lineStatus; /**< line number to put status on */
+ int lineUserInput; /**< line to put user input on */
+ int lineMinPrint; /**< num lines to print on */
+ int cursorPos; /**< column where the input cursor is */
+ uint8 inputBuffer[40]; /**< buffer for user input */
+ uint8 echoBuffer[40]; /**< buffer for echo.line */
int keypress;
#define INPUT_NORMAL 0x01
#define INPUT_GETSTRING 0x02
#define INPUT_MENU 0x03
#define INPUT_NONE 0x04
- int input_mode; /**< keyboard input mode */
- int input_enabled; /**< keyboard input enabled */
+ int inputMode; /**< keyboard input mode */
+ int inputEnabled; /**< keyboard input enabled */
int lognum; /**< current logic number */
/* internal flags */
- int player_control; /**< player is in control */
- int quit_prog_now; /**< quit now */
- int status_line; /**< status line on/off */
- int clock_enabled; /**< clock is on/off */
- int exit_all_logics; /**< break cycle after new.room */
- int picture_shown; /**< show.pic has been issued */
- int has_prompt; /**< input prompt has been printed */
+ int playerControl; /**< player is in control */
+ int quitProgNow; /**< quit now */
+ int statusLine; /**< status line on/off */
+ int clockEnabled; /**< clock is on/off */
+ int exitAllLogics; /**< break cycle after new.room */
+ int pictureShown; /**< show.pic has been issued */
+ int hasPrompt; /**< input prompt has been printed */
#define ID_AGDS 0x00000001
#define ID_AMIGA 0x00000002
- int game_flags; /**< agi options flags */
+ int gameFlags; /**< agi options flags */
- uint8 pri_table[_HEIGHT];/**< priority table */
+ uint8 priTable[_HEIGHT];/**< priority table */
/* windows */
- uint32 msg_box_ticks; /**< timed message box tick counter */
- struct agi_block block;
- struct agi_block window;
- int has_window;
+ uint32 msgBoxTicks; /**< timed message box tick counter */
+ AgiBlock block;
+ AgiBlock window;
+ int hasWindow;
/* graphics & text */
- int gfx_mode;
- char cursor_char;
- unsigned int color_fg;
- unsigned int color_bg;
+ int gfxMode;
+ char cursorChar;
+ unsigned int colorFg;
+ unsigned int colorBg;
uint8 *sbuf; /**< 160x168 AGI screen buffer */
/* player command line */
- struct agi_word ego_words[MAX_WORDS];
- int num_ego_words;
+ AgiWord egoWords[MAX_WORDS];
+ int numEgoWords;
- unsigned int num_objects;
+ unsigned int numObjects;
- struct agi_event ev_keyp[MAX_DIRS]; /**< keyboard keypress events */
+ AgiEvent evKeyp[MAX_DIRS]; /**< keyboard keypress events */
char strings[MAX_STRINGS + 1][MAX_STRINGLEN]; /**< strings */
/* directory entries for resources */
- struct agi_dir dir_logic[MAX_DIRS];
- struct agi_dir dir_pic[MAX_DIRS];
- struct agi_dir dir_view[MAX_DIRS];
- struct agi_dir dir_sound[MAX_DIRS];
+ AgiDir dirLogic[MAX_DIRS];
+ AgiDir dirPic[MAX_DIRS];
+ AgiDir dirView[MAX_DIRS];
+ AgiDir dirSound[MAX_DIRS];
/* resources */
- struct agi_picture pictures[MAX_DIRS]; /**< AGI picture resources */
- struct agi_logic logics[MAX_DIRS]; /**< AGI logic resources */
- struct agi_view views[MAX_DIRS]; /**< AGI view resources */
- struct agi_sound sounds[MAX_DIRS]; /**< AGI sound resources */
+ AgiPicture pictures[MAX_DIRS]; /**< AGI picture resources */
+ AgiLogic logics[MAX_DIRS]; /**< AGI logic resources */
+ AgiView views[MAX_DIRS]; /**< AGI view resources */
+ AgiSound sounds[MAX_DIRS]; /**< AGI sound resources */
/* view table */
- struct vt_entry view_table[MAX_VIEWTABLE];
+ struct VtEntry viewTable[MAX_VIEWTABLE];
int32 ver; /**< detected game version */
- int simple_save; /**< select simple savegames */
+ int simpleSave; /**< select simple savegames */
};
class AgiLoader {
private:
- int int_version;
+ int intVersion;
AgiEngine *_vm;
public:
@@ -422,11 +418,11 @@
virtual int init() = 0;
virtual int deinit() = 0;
- virtual int detect_game() = 0;
- virtual int load_resource(int, int) = 0;
- virtual int unload_resource(int, int) = 0;
- virtual int load_objects(const char *) = 0;
- virtual int load_words(const char *) = 0;
+ virtual int detectGame() = 0;
+ virtual int loadResource(int, int) = 0;
+ virtual int unloadResource(int, int) = 0;
+ virtual int loadObjects(const char *) = 0;
+ virtual int loadWords(const char *) = 0;
virtual int version() = 0;
virtual void setIntVersion(int) = 0;
virtual int getIntVersion() = 0;
@@ -434,26 +430,26 @@
class AgiLoader_v2 : public AgiLoader {
private:
- int int_version;
+ int _intVersion;
AgiEngine *_vm;
- int load_dir(struct agi_dir *agid, const char *fname);
- uint8 *load_vol_res(struct agi_dir *agid);
+ int loadDir(AgiDir *agid, const char *fname);
+ uint8 *loadVolRes(AgiDir *agid);
public:
AgiLoader_v2(AgiEngine *vm) {
_vm = vm;
- int_version = 0;
+ _intVersion = 0;
}
virtual int init();
virtual int deinit();
- virtual int detect_game();
- virtual int load_resource(int, int);
- virtual int unload_resource(int, int);
- virtual int load_objects(const char *);
- virtual int load_words(const char *);
+ virtual int detectGame();
+ virtual int loadResource(int, int);
+ virtual int unloadResource(int, int);
+ virtual int loadObjects(const char *);
+ virtual int loadWords(const char *);
virtual int version();
virtual void setIntVersion(int);
virtual int getIntVersion();
@@ -461,26 +457,26 @@
class AgiLoader_v3 : public AgiLoader {
private:
- int int_version;
+ int _intVersion;
AgiEngine *_vm;
- int load_dir(agi_dir *agid, Common::File *fp, uint32 offs, uint32 len);
- uint8 *load_vol_res(agi_dir *agid);
+ int loadDir(AgiDir *agid, Common::File *fp, uint32 offs, uint32 len);
+ uint8 *loadVolRes(AgiDir *agid);
public:
AgiLoader_v3(AgiEngine *vm) {
_vm = vm;
- int_version = 0;
+ _intVersion = 0;
}
virtual int init();
virtual int deinit();
- virtual int detect_game();
- virtual int load_resource(int, int);
- virtual int unload_resource(int, int);
- virtual int load_objects(const char *);
- virtual int load_words(const char *);
+ virtual int detectGame();
+ virtual int loadResource(int, int);
+ virtual int unloadResource(int, int);
+ virtual int loadObjects(const char *);
+ virtual int loadWords(const char *);
virtual int version();
virtual void setIntVersion(int);
virtual int getIntVersion();
@@ -493,7 +489,7 @@
extern struct Mouse g_mouse;
/* Image stack support */
-struct image_stack_element {
+struct ImageStackElement {
uint8 type;
uint8 pad;
int16 parm1;
@@ -505,7 +501,7 @@
int16 parm7;
};
-struct string_data {
+struct StringData {
int x;
int y;
int len;
@@ -538,23 +534,23 @@
private:
- int _key_queue[KEY_QUEUE_SIZE];
- int _key_queue_start;
- int _key_queue_end;
+ int _keyQueue[KEY_QUEUE_SIZE];
+ int _keyQueueStart;
+ int _keyQueueEnd;
- int check_priority(struct vt_entry *v);
- int check_collision(struct vt_entry *v);
- int check_position(struct vt_entry *v);
+ int checkPriority(VtEntry *v);
+ int checkCollision(VtEntry *v);
+ int checkPosition(VtEntry *v);
- uint32 match_version(uint32 crc);
+ uint32 matchVersion(uint32 crc);
public:
- struct agi_game game;
- struct agi_object *objects; /* objects in the game */
+ AgiGame _game;
+ AgiObject *_objects; /* objects in the game */
- struct string_data stringdata;
+ StringData _stringdata;
- AgiLoader *loader; /* loader */
+ AgiLoader *_loader; /* loader */
Common::RandomSource *_rnd;
const char *_savePath;
@@ -568,13 +564,14 @@
int loadGameDialog();
int loadGameSimple();
- volatile uint32 clock_count;
+ volatile uint32 _clockCount;
- uint8 *intobj;
+ uint8 *_intobj;
+ int _oldMode;
- Menu* menu;
+ Menu* _menu;
- char last_sentence[40];
+ char _lastSentence[40];
SpritesMgr *_sprites;
GfxMgr *_gfx;
@@ -583,22 +580,22 @@
#define INITIAL_IMAGE_STACK_SIZE 32
- int stack_size;
- struct image_stack_element *image_stack;
- int image_stack_pointer;
+ int _stackSize;
+ ImageStackElement *_imageStack;
+ int _imageStackPointer;
- void clear_image_stack();
- void record_image_stack_call(uint8 type, int16 p1, int16 p2, int16 p3,
+ void clearImageStack();
+ void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7);
- void replay_image_stack_call(uint8 type, int16 p1, int16 p2, int16 p3,
+ void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7);
- void release_image_stack();
+ void releaseImageStack();
- struct agi_debug _debug;
- struct agi_options opt;
+ AgiDebug _debug;
+ AgiOptions _opt;
- int _key_control;
- int _key_alt;
+ int _keyControl;
+ int _keyAlt;
Console *_console;
@@ -618,8 +615,8 @@
static void agiTimerFunctionLow(void *refCon);
void initPriTable();
- void new_input_mode(int);
- void old_input_mode();
+ void newInputMode(int);
+ void oldInputMode();
int getflag(int);
void setflag(int, int);
@@ -627,27 +624,27 @@
int getvar(int);
void setvar(int, int);
void decrypt(uint8 * mem, int len);
- void release_sprites();
- int main_cycle();
- int view_pictures();
- int parse_cli(int, char **);
- int run_game();
+ void releaseSprites();
+ int mainCycle();
+ int viewPictures();
+ int parseCli(int, char **);
+ int runGame();
void inventory();
- void list_games();
- uint32 match_crc(uint32, char *, int);
- int v2id_game();
- int v3id_game();
- int v4id_game(uint32 ver);
- void update_timer();
- int get_app_dir(char *app_dir, unsigned int size);
+ void listGames();
+ uint32 matchCrc(uint32, char *, int);
+ int v2IdGame();
+ int v3IdGame();
+ int v4IdGame(uint32 ver);
+ void updateTimer();
+ int getAppDir(char *appDir, unsigned int size);
- int setup_v2_game(int ver, uint32 crc);
- int setup_v3_game(int ver, uint32 crc);
+ int setupV2Game(int ver, uint32 crc);
+ int setupV3Game(int ver, uint32 crc);
- void new_room(int n);
- void reset_controllers();
- void interpret_cycle();
- int play_game();
+ void newRoom(int n);
+ void resetControllers();
+ void interpretCycle();
+ int playGame();
void printItem(int n, int fg, int bg);
int findItem();
@@ -657,82 +654,82 @@
void processEvents();
// Objects
- int show_objects();
- int decode_objects(uint8 *mem, uint32 flen);
- int load_objects(const char *fname);
- int alloc_objects(int);
- void unload_objects();
- const char *object_name(unsigned int);
- int object_get_location(unsigned int);
- void object_set_location(unsigned int, int);
+ int showObjects();
+ int decodeObjects(uint8 *mem, uint32 flen);
+ int loadObjects(const char *fname);
+ int allocObjects(int);
+ void unloadObjects();
+ const char *objectName(unsigned int);
+ int objectGetLocation(unsigned int);
+ void objectSetLocation(unsigned int, int);
// Logic
- int decode_logic(int);
- void unload_logic(int);
- int run_logic(int);
- void patch_logic(int n);
+ int decodeLogic(int);
+ void unloadLogic(int);
+ int runLogic(int);
+ void patchLogic(int n);
- void debug_console(int, int, const char *);
- int test_if_code(int);
- void execute_agi_command(uint8, uint8 *);
+ void debugConsole(int, int, const char *);
+ int testIfCode(int);
+ void executeAgiCommand(uint8, uint8 *);
// View
private:
- void _set_cel(vt_entry *v, int n);
- void _set_loop(vt_entry *v, int n);
- void update_view(vt_entry *v);
+ void lSetCel(VtEntry *v, int n);
+ void lSetLoop(VtEntry *v, int n);
+ void updateView(VtEntry *v);
public:
- void set_cel(vt_entry *, int);
- void set_loop(vt_entry *, int);
- void set_view(vt_entry *, int);
- void start_update(vt_entry *);
- void stop_update(vt_entry *);
- void update_viewtable();
- void unload_view(int);
- int decode_view(int);
- void add_to_pic(int, int, int, int, int, int, int);
- void draw_obj(int);
- bool is_ego_view(const vt_entry *v);
+ void setCel(VtEntry *, int);
+ void setLoop(VtEntry *, int);
+ void setView(VtEntry *, int);
+ void startUpdate(VtEntry *);
+ void stopUpdate(VtEntry *);
+ void updateViewtable();
+ void unloadView(int);
+ int decodeView(int);
+ void addToPic(int, int, int, int, int, int, int);
+ void drawObj(int);
+ bool isEgoView(const VtEntry *v);
// Words
- int show_words();
- int load_words(const char *);
- void unload_words();
- int find_word(char *word, int *flen);
- void dictionary_words(char *);
+ int showWords();
+ int loadWords(const char *);
+ void unloadWords();
+ int findWord(char *word, int *flen);
+ void dictionaryWords(char *);
// Motion
private:
- int check_step(int delta, int step);
- int check_block(int x, int y);
- void changepos(struct vt_entry *v);
- void motion_wander(struct vt_entry *v);
- void motion_followego(struct vt_entry *v);
- void motion_moveobj(struct vt_entry *v);
- void check_motion(struct vt_entry *v);
+ int checkStep(int delta, int step);
+ int checkBlock(int x, int y);
+ void changePos(VtEntry *v);
+ void motionWander(VtEntry *v);
+ void motionFollowEgo(VtEntry *v);
+ void motionMoveObj(VtEntry *v);
+ void checkMotion(VtEntry *v);
public:
- void check_all_motions();
- void move_obj(vt_entry *);
- void in_destination(vt_entry *);
- void fix_position(int);
- void update_position();
- int get_direction(int x0, int y0, int x, int y, int s);
+ void checkAllMotions();
+ void moveObj(VtEntry *);
+ void inDestination(VtEntry *);
+ void fixPosition(int);
+ void updatePosition();
+ int getDirection(int x0, int y0, int x, int y, int s);
// Keyboard
- void init_words();
- void clean_input();
- int do_poll_keyboard();
- void clean_keyboard();
- void handle_keys(int);
- void handle_getstring(int);
- int handle_controller(int);
- void get_string(int, int, int, int);
- uint16 agi_get_keypress();
- int wait_key();
- int wait_any_key();
+ void initWords();
+ void cleanInput();
+ int doPollKeyboard();
+ void cleanKeyboard();
+ void handleKeys(int);
+ void handleGetstring(int);
+ int handleController(int);
+ void getString(int, int, int, int);
+ uint16 agiGetKeypress();
+ int waitKey();
+ int waitAnyKey();
// Text
public:
@@ -740,27 +737,27 @@
typedef Common::String String;
- int message_box(const char *);
- int selection_box(const char *, const char **);
- void close_window(void);
- void draw_window(int, int, int, int);
- void print_text(const char *, int, int, int, int, int, int, bool checkerboard = false);
- void print_text_console(const char *, int, int, int, int, int);
+ int messageBox(const char *);
+ int selectionBox(const char *, const char **);
+ void closeWindow(void);
+ void drawWindow(int, int, int, int);
+ void printText(const char *, int, int, int, int, int, int, bool checkerboard = false);
+ void printTextConsole(const char *, int, int, int, int, int);
int print(const char *, int, int, int);
- char *word_wrap_string(char *, int *);
- char *agi_sprintf(const char *);
- void write_status(void);
- void write_prompt(void);
- void clear_lines(int, int, int);
- void flush_lines(int, int);
+ char *wordWrapString(char *, int *);
+ char *agiSprintf(const char *);
+ void writeStatus(void);
+ void writePrompt(void);
+ void clearLines(int, int, int);
+ void flushLines(int, int);
bool predictiveDialog(void);
private:
- void print_status(const char *message, ...);
- void print_text2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg, bool checkerboard = false);
- void blit_textbox(const char *p, int y, int x, int len);
- void erase_textbox();
- char *safe_strcat(char *s, const char *t);
+ void printStatus(const char *message, ...);
+ void printText2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg, bool checkerboard = false);
+ void blitTextbox(const char *p, int y, int x, int len);
+ void eraseTextbox();
+ char *safeStrcat(char *s, const char *t);
void loadDict(void);
bool matchWord(void);
Modified: scummvm/trunk/engines/agi/agi_v2.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi_v2.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/agi_v2.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -34,25 +34,25 @@
}
void AgiLoader_v2::setIntVersion(int ver) {
- int_version = ver;
+ _intVersion = ver;
}
int AgiLoader_v2::getIntVersion() {
- return int_version;
+ return _intVersion;
}
-int AgiLoader_v2::detect_game() {
+int AgiLoader_v2::detectGame() {
if (!Common::File::exists(LOGDIR) ||
!Common::File::exists(PICDIR) ||
!Common::File::exists(SNDDIR) ||
!Common::File::exists(VIEWDIR))
- return err_InvalidAGIFile;
+ return errInvalidAGIFile;
- int_version = 0x2917; /* setup for 2.917 */
- return _vm->v2id_game();
+ _intVersion = 0x2917; /* setup for 2.917 */
+ return _vm->v2IdGame();
}
-int AgiLoader_v2::load_dir(struct agi_dir *agid, const char *fname) {
+int AgiLoader_v2::loadDir(AgiDir *agid, const char *fname) {
Common::File fp;
uint8 *mem;
uint32 flen;
@@ -61,7 +61,7 @@
report("Loading directory: %s\n", fname);
if (!fp.open(fname)) {
- return err_BadFileOpen;
+ return errBadFileOpen;
}
fp.seek(0, SEEK_END);
@@ -70,7 +70,7 @@
if ((mem = (uint8 *)malloc(flen + 32)) == NULL) {
fp.close();
- return err_NotEnoughMemory;
+ return errNotEnoughMemory;
}
fp.read(mem, flen);
@@ -91,57 +91,57 @@
free(mem);
fp.close();
- return err_OK;
+ return errOK;
}
int AgiLoader_v2::init() {
- int ec = err_OK;
+ int ec = errOK;
/* load directory files */
- ec = load_dir(_vm->game.dir_logic, LOGDIR);
- if (ec == err_OK)
- ec = load_dir(_vm->game.dir_pic, PICDIR);
- if (ec == err_OK)
- ec = load_dir(_vm->game.dir_view, VIEWDIR);
- if (ec == err_OK)
- ec = load_dir(_vm->game.dir_sound, SNDDIR);
+ ec = loadDir(_vm->_game.dirLogic, LOGDIR);
+ if (ec == errOK)
+ ec = loadDir(_vm->_game.dirPic, PICDIR);
+ if (ec == errOK)
+ ec = loadDir(_vm->_game.dirView, VIEWDIR);
+ if (ec == errOK)
+ ec = loadDir(_vm->_game.dirSound, SNDDIR);
return ec;
}
int AgiLoader_v2::deinit() {
- int ec = err_OK;
+ int ec = errOK;
#if 0
/* unload words */
- agi_v2_unload_words();
+ agiV2UnloadWords();
/* unload objects */
- agi_v2_unload_objects();
+ agiV2UnloadObjects();
#endif
return ec;
}
-int AgiLoader_v2::unload_resource(int t, int n) {
+int AgiLoader_v2::unloadResource(int t, int n) {
debugC(3, kDebugLevelResources, "unload resource");
switch (t) {
case rLOGIC:
- _vm->unload_logic(n);
+ _vm->unloadLogic(n);
break;
case rPICTURE:
- _vm->_picture->unload_picture(n);
+ _vm->_picture->unloadPicture(n);
break;
case rVIEW:
- _vm->unload_view(n);
+ _vm->unloadView(n);
break;
case rSOUND:
- _vm->_sound->unload_sound(n);
+ _vm->_sound->unloadSound(n);
break;
}
- return err_OK;
+ return errOK;
}
/*
@@ -149,7 +149,7 @@
* if further decoding is required, it must be done by another
* routine. NULL is returned if unsucsessfull.
*/
-uint8 *AgiLoader_v2::load_vol_res(struct agi_dir *agid) {
+uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
uint8 *data = NULL;
char x[MAX_PATH], *path;
Common::File fp;
@@ -176,7 +176,7 @@
/* FIXME: call some panic handler instead of
* deiniting directly
*/
- deinit_video_mode();
+ deinitVideoMode();
#endif
report("Error: bad signature %04x\n", sig);
// fprintf (stderr, "ACK! BAD RESOURCE!!!\n");
@@ -196,33 +196,33 @@
* Loads a resource into memory, a raw resource is loaded in
* with above routine, then further decoded here.
*/
-int AgiLoader_v2::load_resource(int t, int n) {
- int ec = err_OK;
+int AgiLoader_v2::loadResource(int t, int n) {
+ int ec = errOK;
uint8 *data = NULL;
debugC(3, kDebugLevelResources, "(t = %d, n = %d)", t, n);
if (n > MAX_DIRS)
- return err_BadResource;
+ return errBadResource;
switch (t) {
case rLOGIC:
- if (~_vm->game.dir_logic[n].flags & RES_LOADED) {
+ if (~_vm->_game.dirLogic[n].flags & RES_LOADED) {
debugC(3, kDebugLevelResources, "loading logic resource %d", n);
- unload_resource(rLOGIC, n);
+ unloadResource(rLOGIC, n);
/* load raw resource into data */
- data = load_vol_res(&_vm->game.dir_logic[n]);
+ data = loadVolRes(&_vm->_game.dirLogic[n]);
- _vm->game.logics[n].data = data;
- ec = data ? _vm->decode_logic(n) : err_BadResource;
+ _vm->_game.logics[n].data = data;
+ ec = data ? _vm->decodeLogic(n) : errBadResource;
- _vm->game.logics[n].sIP = 2;
+ _vm->_game.logics[n].sIP = 2;
}
/* if logic was cached, we get here */
/* reset code pointers incase it was cached */
- _vm->game.logics[n].cIP = _vm->game.logics[n].sIP;
+ _vm->_game.logics[n].cIP = _vm->_game.logics[n].sIP;
break;
case rPICTURE:
/* if picture is currently NOT loaded *OR* cacheing is off,
@@ -230,34 +230,34 @@
*/
debugC(3, kDebugLevelResources, "loading picture resource %d", n);
- if (_vm->game.dir_pic[n].flags & RES_LOADED)
+ if (_vm->_game.dirPic[n].flags & RES_LOADED)
break;
/* if loaded but not cached, unload it */
/* if cached but not loaded, etc */
- unload_resource(rPICTURE, n);
- data = load_vol_res(&_vm->game.dir_pic[n]);
+ unloadResource(rPICTURE, n);
+ data = loadVolRes(&_vm->_game.dirPic[n]);
if (data != NULL) {
- _vm->game.pictures[n].rdata = data;
- _vm->game.dir_pic[n].flags |= RES_LOADED;
+ _vm->_game.pictures[n].rdata = data;
+ _vm->_game.dirPic[n].flags |= RES_LOADED;
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
break;
case rSOUND:
debugC(3, kDebugLevelResources, "loading sound resource %d", n);
- if (_vm->game.dir_sound[n].flags & RES_LOADED)
+ if (_vm->_game.dirSound[n].flags & RES_LOADED)
break;
- data = load_vol_res(&_vm->game.dir_sound[n]);
+ data = loadVolRes(&_vm->_game.dirSound[n]);
if (data != NULL) {
- _vm->game.sounds[n].rdata = data;
- _vm->game.dir_sound[n].flags |= RES_LOADED;
- _vm->_sound->decode_sound(n);
+ _vm->_game.sounds[n].rdata = data;
+ _vm->_game.dirSound[n].flags |= RES_LOADED;
+ _vm->_sound->decodeSound(n);
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
break;
case rVIEW:
@@ -266,34 +266,34 @@
* can we cache the view? or must we reload it all
* the time?
*/
- if (_vm->game.dir_view[n].flags & RES_LOADED)
+ if (_vm->_game.dirView[n].flags & RES_LOADED)
break;
debugC(3, kDebugLevelResources, "loading view resource %d", n);
- unload_resource(rVIEW, n);
- data = load_vol_res(&_vm->game.dir_view[n]);
+ unloadResource(rVIEW, n);
+ data = loadVolRes(&_vm->_game.dirView[n]);
if (data) {
- _vm->game.views[n].rdata = data;
- _vm->game.dir_view[n].flags |= RES_LOADED;
- ec = _vm->decode_view(n);
+ _vm->_game.views[n].rdata = data;
+ _vm->_game.dirView[n].flags |= RES_LOADED;
+ ec = _vm->decodeView(n);
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
break;
default:
- ec = err_BadResource;
+ ec = errBadResource;
break;
}
return ec;
}
-int AgiLoader_v2::load_objects(const char *fname) {
- return _vm->load_objects(fname);
+int AgiLoader_v2::loadObjects(const char *fname) {
+ return _vm->loadObjects(fname);
}
-int AgiLoader_v2::load_words(const char *fname) {
- return _vm->load_words(fname);
+int AgiLoader_v2::loadWords(const char *fname) {
+ return _vm->loadWords(fname);
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/agi_v3.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi_v3.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/agi_v3.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -37,24 +37,23 @@
}
void AgiLoader_v3::setIntVersion(int ver) {
- int_version = ver;
+ _intVersion = ver;
}
int AgiLoader_v3::getIntVersion() {
- return int_version;
+ return _intVersion;
}
-int AgiLoader_v3::detect_game() {
- int ec = err_Unk;
+int AgiLoader_v3::detectGame() {
+ int ec = errUnk;
bool found = false;
FSList fslist;
FilesystemNode dir(ConfMan.get("path"));
if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
- warning("AgiEngine: invalid game path '%s'",
- dir.path().c_str());
- return err_InvalidAGIFile;
+ warning("AgiEngine: invalid game path '%s'", dir.path().c_str());
+ return errInvalidAGIFile;
}
for (FSList::const_iterator file = fslist.begin();
@@ -63,10 +62,10 @@
f.toLowercase();
if (f.hasSuffix("vol.0")) {
- strncpy(_vm->game.name, f.c_str(), f.size() > 5 ? f.size() - 5 : f.size());
- debugC(3, kDebugLevelMain, "game.name = %s", _vm->game.name);
- int_version = 0x3149; // setup for 3.002.149
- ec = _vm->v3id_game();
+ strncpy(_vm->_game.name, f.c_str(), f.size() > 5 ? f.size() - 5 : f.size());
+ debugC(3, kDebugLevelMain, "game.name = %s", _vm->_game.name);
+ _intVersion = 0x3149; // setup for 3.002.149
+ ec = _vm->v3IdGame();
found = true;
}
@@ -74,20 +73,20 @@
if (!found) {
debugC(3, kDebugLevelMain, "not found");
- ec = err_InvalidAGIFile;
+ ec = errInvalidAGIFile;
}
return ec;
}
-int AgiLoader_v3::load_dir(struct agi_dir *agid, Common::File *fp,
+int AgiLoader_v3::loadDir(struct AgiDir *agid, Common::File *fp,
uint32 offs, uint32 len) {
- int ec = err_OK;
+ int ec = errOK;
uint8 *mem;
unsigned int i;
fp->seek(offs, SEEK_SET);
- if ((mem = (uint8 *) malloc(len + 32)) != NULL) {
+ if ((mem = (uint8 *)malloc(len + 32)) != NULL) {
fp->read(mem, len);
/* set all directory resources to gone */
@@ -104,7 +103,7 @@
free(mem);
} else {
- ec = err_NotEnoughMemory;
+ ec = errNotEnoughMemory;
}
return ec;
@@ -116,86 +115,85 @@
};
int AgiLoader_v3::init() {
- int ec = err_OK;
- struct agi3vol agi_vol3[4];
+ int ec = errOK;
+ struct agi3vol agiVol3[4];
int i;
uint16 xd[4];
Common::File fp;
Common::String path;
- path = Common::String(_vm->game.name) + DIR_;
+ path = Common::String(_vm->_game.name) + DIR_;
if (!fp.open(path)) {
printf("Failed to open \"%s\"\n", path.c_str());
- return err_BadFileOpen;
+ return errBadFileOpen;
}
/* build offset table for v3 directory format */
fp.read(&xd, 8);
fp.seek(0, SEEK_END);
for (i = 0; i < 4; i++)
- agi_vol3[i].sddr = READ_LE_UINT16((uint8 *) & xd[i]);
+ agiVol3[i].sddr = READ_LE_UINT16((uint8 *) & xd[i]);
- agi_vol3[0].len = agi_vol3[1].sddr - agi_vol3[0].sddr;
- agi_vol3[1].len = agi_vol3[2].sddr - agi_vol3[1].sddr;
- agi_vol3[2].len = agi_vol3[3].sddr - agi_vol3[2].sddr;
- agi_vol3[3].len = fp.pos() - agi_vol3[3].sddr;
+ agiVol3[0].len = agiVol3[1].sddr - agiVol3[0].sddr;
+ agiVol3[1].len = agiVol3[2].sddr - agiVol3[1].sddr;
+ agiVol3[2].len = agiVol3[3].sddr - agiVol3[2].sddr;
+ agiVol3[3].len = fp.pos() - agiVol3[3].sddr;
- if (agi_vol3[3].len > 256 * 3)
- agi_vol3[3].len = 256 * 3;
+ if (agiVol3[3].len > 256 * 3)
+ agiVol3[3].len = 256 * 3;
fp.seek(0, SEEK_SET);
/* read in directory files */
- ec = load_dir(_vm->game.dir_logic, &fp, agi_vol3[0].sddr,
- agi_vol3[0].len);
+ ec = loadDir(_vm->_game.dirLogic, &fp, agiVol3[0].sddr, agiVol3[0].len);
- if (ec == err_OK) {
- ec = load_dir(_vm->game.dir_pic, &fp, agi_vol3[1].sddr, agi_vol3[1].len);
+ if (ec == errOK) {
+ ec = loadDir(_vm->_game.dirPic, &fp, agiVol3[1].sddr, agiVol3[1].len);
}
- if (ec == err_OK) {
- ec = load_dir(_vm->game.dir_view, &fp, agi_vol3[2].sddr, agi_vol3[2].len);
+ if (ec == errOK) {
+ ec = loadDir(_vm->_game.dirView, &fp, agiVol3[2].sddr, agiVol3[2].len);
}
- if (ec == err_OK) {
- ec = load_dir(_vm->game.dir_sound, &fp, agi_vol3[3].sddr, agi_vol3[3].len);
+ if (ec == errOK) {
+ ec = loadDir(_vm->_game.dirSound, &fp, agiVol3[3].sddr, agiVol3[3].len);
}
return ec;
}
int AgiLoader_v3::deinit() {
- int ec = err_OK;
+ int ec = errOK;
#if 0
/* unload words */
- agi_v3_unload_words();
+ agiV3UnloadWords();
/* unload objects */
- agi_v3_unload_objects();
+ agiV3UnloadObjects();
#endif
return ec;
}
-int AgiLoader_v3::unload_resource(int t, int n) {
+int AgiLoader_v3::unloadResource(int t, int n) {
switch (t) {
case rLOGIC:
- _vm->unload_logic(n);
+ _vm->unloadLogic(n);
break;
case rPICTURE:
- _vm->_picture->unload_picture(n);
+ _vm->_picture->unloadPicture(n);
break;
case rVIEW:
- _vm->unload_view(n);
+ _vm->unloadView(n);
break;
case rSOUND:
- _vm->_sound->unload_sound(n);
+ _vm->_sound->unloadSound(n);
break;
}
- return err_OK;
+ return errOK;
}
/*
@@ -205,15 +203,15 @@
*
* NULL is returned if unsucsessful.
*/
-uint8 *AgiLoader_v3::load_vol_res(struct agi_dir *agid) {
+uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) {
char x[MAX_PATH];
- uint8 *data = NULL, *comp_buffer;
+ uint8 *data = NULL, *compBuffer;
Common::File fp;
Common::String path;
debugC(3, kDebugLevelResources, "(%p)", (void *)agid);
sprintf(x, "vol.%i", agid->volume);
- path = Common::String(_vm->game.name) + x;
+ path = Common::String(_vm->_game.name) + x;
if (agid->offset != _EMPTY && fp.open(path)) {
fp.seek(agid->offset, SEEK_SET);
@@ -222,7 +220,7 @@
if (READ_BE_UINT16((uint8 *) x) != 0x1234) {
#if 0
/* FIXME */
- deinit_video_mode();
+ deinitVideoMode();
#endif
debugC(3, kDebugLevelResources, "path = %s", path.c_str());
debugC(3, kDebugLevelResources, "offset = %d", agid->offset);
@@ -235,12 +233,12 @@
agid->len = READ_LE_UINT16((uint8 *) x + 3); /* uncompressed size */
agid->clen = READ_LE_UINT16((uint8 *) x + 5); /* compressed len */
- comp_buffer = (uint8 *)calloc(1, agid->clen + 32);
- fp.read(comp_buffer, agid->clen);
+ compBuffer = (uint8 *)calloc(1, agid->clen + 32);
+ fp.read(compBuffer, agid->clen);
if (x[2] & 0x80 || agid->len == agid->clen) {
/* do not decompress */
- data = comp_buffer;
+ data = compBuffer;
#if 0
/* CM: added to avoid problems in
@@ -255,8 +253,8 @@
} else {
/* it is compressed */
data = (uint8 *)calloc(1, agid->len + 32);
- LZW_expand(comp_buffer, data, agid->len);
- free(comp_buffer);
+ lzwExpand(compBuffer, data, agid->len);
+ free(compBuffer);
agid->flags |= RES_COMPRESSED;
}
@@ -274,74 +272,74 @@
* Loads a resource into memory, a raw resource is loaded in
* with above routine, then further decoded here.
*/
-int AgiLoader_v3::load_resource(int t, int n) {
- int ec = err_OK;
+int AgiLoader_v3::loadResource(int t, int n) {
+ int ec = errOK;
uint8 *data = NULL;
if (n > MAX_DIRS)
- return err_BadResource;
+ return errBadResource;
switch (t) {
case rLOGIC:
/* load resource into memory, decrypt messages at the end
* and build the message list (if logic is in memory)
*/
- if (~_vm->game.dir_logic[n].flags & RES_LOADED) {
+ if (~_vm->_game.dirLogic[n].flags & RES_LOADED) {
/* if logic is already in memory, unload it */
- unload_resource(rLOGIC, n);
+ unloadResource(rLOGIC, n);
/* load raw resource into data */
- data = load_vol_res(&_vm->game.dir_logic[n]);
- _vm->game.logics[n].data = data;
+ data = loadVolRes(&_vm->_game.dirLogic[n]);
+ _vm->_game.logics[n].data = data;
/* uncompressed logic files need to be decrypted */
if (data != NULL) {
/* resloaded flag gets set by decode logic */
/* needed to build string table */
- ec = _vm->decode_logic(n);
- _vm->game.logics[n].sIP = 2;
+ ec = _vm->decodeLogic(n);
+ _vm->_game.logics[n].sIP = 2;
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
/*logics[n].sIP=2; *//* saved IP = 2 */
/*logics[n].cIP=2; *//* current IP = 2 */
- _vm->game.logics[n].cIP = _vm->game.logics[n].sIP;
+ _vm->_game.logics[n].cIP = _vm->_game.logics[n].sIP;
}
/* if logic was cached, we get here */
/* reset code pointers incase it was cached */
- _vm->game.logics[n].cIP = _vm->game.logics[n].sIP;
+ _vm->_game.logics[n].cIP = _vm->_game.logics[n].sIP;
break;
case rPICTURE:
/* if picture is currently NOT loaded *OR* cacheing is off,
* unload the resource (caching==off) and reload it
*/
- if (~_vm->game.dir_pic[n].flags & RES_LOADED) {
- unload_resource(rPICTURE, n);
- data = load_vol_res(&_vm->game.dir_pic[n]);
+ if (~_vm->_game.dirPic[n].flags & RES_LOADED) {
+ unloadResource(rPICTURE, n);
+ data = loadVolRes(&_vm->_game.dirPic[n]);
if (data != NULL) {
- data = _vm->_picture->convert_v3_pic(data, _vm->game.dir_pic[n].len);
- _vm->game.pictures[n].rdata = data;
- _vm->game.dir_pic[n].flags |= RES_LOADED;
+ data = _vm->_picture->convertV3Pic(data, _vm->_game.dirPic[n].len);
+ _vm->_game.pictures[n].rdata = data;
+ _vm->_game.dirPic[n].flags |= RES_LOADED;
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
}
break;
case rSOUND:
- if (_vm->game.dir_sound[n].flags & RES_LOADED)
+ if (_vm->_game.dirSound[n].flags & RES_LOADED)
break;
- data = load_vol_res(&_vm->game.dir_sound[n]);
+ data = loadVolRes(&_vm->_game.dirSound[n]);
if (data != NULL) {
- _vm->game.sounds[n].rdata = data;
- _vm->game.dir_sound[n].flags |= RES_LOADED;
- _vm->_sound->decode_sound(n);
+ _vm->_game.sounds[n].rdata = data;
+ _vm->_game.dirSound[n].flags |= RES_LOADED;
+ _vm->_sound->decodeSound(n);
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
break;
case rVIEW:
@@ -350,33 +348,33 @@
* cache the view? or must we reload it all the time?
*/
/* load a raw view from a VOL file into data */
- if (_vm->game.dir_view[n].flags & RES_LOADED)
+ if (_vm->_game.dirView[n].flags & RES_LOADED)
break;
- unload_resource(rVIEW, n);
- data = load_vol_res(&_vm->game.dir_view[n]);
+ unloadResource(rVIEW, n);
+ data = loadVolRes(&_vm->_game.dirView[n]);
if (data != NULL) {
- _vm->game.views[n].rdata = data;
- _vm->game.dir_view[n].flags |= RES_LOADED;
- ec = _vm->decode_view(n);
+ _vm->_game.views[n].rdata = data;
+ _vm->_game.dirView[n].flags |= RES_LOADED;
+ ec = _vm->decodeView(n);
} else {
- ec = err_BadResource;
+ ec = errBadResource;
}
break;
default:
- ec = err_BadResource;
+ ec = errBadResource;
break;
}
return ec;
}
-int AgiLoader_v3::load_objects(const char *fname) {
- return _vm->load_objects(fname);
+int AgiLoader_v3::loadObjects(const char *fname) {
+ return _vm->loadObjects(fname);
}
-int AgiLoader_v3::load_words(const char *fname) {
- return _vm->load_words(fname);
+int AgiLoader_v3::loadWords(const char *fname) {
+ return _vm->loadWords(fname);
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/checks.cpp
===================================================================
--- scummvm/trunk/engines/agi/checks.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/checks.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -27,22 +27,22 @@
namespace Agi {
-int AgiEngine::check_position(struct vt_entry *v) {
- debugC(4, kDebugLevelSprites, "check position @ %d, %d", v->x_pos, v->y_pos);
+int AgiEngine::checkPosition(struct VtEntry *v) {
+ debugC(4, kDebugLevelSprites, "check position @ %d, %d", v->xPos, v->yPos);
- if (v->x_pos < 0 ||
- v->x_pos + v->x_size > _WIDTH ||
- v->y_pos - v->y_size + 1 < 0 ||
- v->y_pos >= _HEIGHT ||
- ((~v->flags & IGNORE_HORIZON) && v->y_pos <= game.horizon)) {
+ if (v->xPos < 0 ||
+ v->xPos + v->xSize > _WIDTH ||
+ v->yPos - v->ySize + 1 < 0 ||
+ v->yPos >= _HEIGHT ||
+ ((~v->flags & IGNORE_HORIZON) && v->yPos <= _game.horizon)) {
debugC(4, kDebugLevelSprites, "check position failed: x=%d, y=%d, h=%d, w=%d",
- v->x_pos, v->y_pos, v->x_size, v->y_size);
+ v->xPos, v->yPos, v->xSize, v->ySize);
return 0;
}
/* MH1 needs this, but it breaks LSL1 */
if (agiGetRelease() >= 0x3000) {
- if (v->y_pos < v->y_size)
+ if (v->yPos < v->ySize)
return 0;
}
@@ -52,13 +52,13 @@
/**
* Check if there's another object on the way
*/
-int AgiEngine::check_collision(struct vt_entry *v) {
- struct vt_entry *u;
+int AgiEngine::checkCollision(struct VtEntry *v) {
+ struct VtEntry *u;
if (v->flags & IGNORE_OBJECTS)
return 0;
- for (u = game.view_table; u < &game.view_table[MAX_VIEWTABLE]; u++) {
+ for (u = _game.viewTable; u < &_game.viewTable[MAX_VIEWTABLE]; u++) {
if ((u->flags & (ANIMATED | DRAWN)) != (ANIMATED | DRAWN))
continue;
@@ -70,17 +70,16 @@
continue;
/* No horizontal overlap, check next */
- if (v->x_pos + v->x_size < u->x_pos ||
- v->x_pos > u->x_pos + u->x_size)
+ if (v->xPos + v->xSize < u->xPos || v->xPos > u->xPos + u->xSize)
continue;
/* Same y, return error! */
- if (v->y_pos == u->y_pos)
+ if (v->yPos == u->yPos)
goto return_1;
/* Crossed the baseline, return error! */
- if ((v->y_pos > u->y_pos && v->y_pos2 < u->y_pos2) ||
- (v->y_pos < u->y_pos && v->y_pos2 > u->y_pos2)) {
+ if ((v->yPos > u->yPos && v->yPos2 < u->yPos2) ||
+ (v->yPos < u->yPos && v->yPos2 > u->yPos2)) {
goto return_1;
}
}
@@ -92,13 +91,13 @@
return 1;
}
-int AgiEngine::check_priority(struct vt_entry *v) {
+int AgiEngine::checkPriority(VtEntry *v) {
int i, trigger, water, pass, pri;
uint8 *p0;
if (~v->flags & FIXED_PRIORITY) {
/* Priority bands */
- v->priority = game.pri_table[v->y_pos];
+ v->priority = _game.priTable[v->yPos];
}
trigger = 0;
@@ -106,13 +105,13 @@
pass = 1;
if (v->priority == 0x0f)
- goto _check_ego;
+ goto check_ego;
water = 1;
- p0 = &game.sbuf[v->x_pos + v->y_pos * _WIDTH];
+ p0 = &_game.sbuf[v->xPos + v->yPos * _WIDTH];
- for (i = 0; i < v->x_size; i++, p0++) {
+ for (i = 0; i < v->xSize; i++, p0++) {
pri = *p0 >> 4;
if (pri == 0) { /* unconditional black. no go at all! */
@@ -148,10 +147,10 @@
pass = 0;
}
- _check_ego:
+check_ego:
if (v->entry == 0) {
- setflag(F_ego_touched_p2, trigger ? true : false);
- setflag(F_ego_water, water ? true : false);
+ setflag(fEgoTouchedP2, trigger ? true : false);
+ setflag(fEgoWater, water ? true : false);
}
return pass;
@@ -168,35 +167,35 @@
* new position must be valid according to the sprite positioning
* rules, otherwise the previous position will be kept.
*/
-void AgiEngine::update_position() {
- struct vt_entry *v;
- int x, y, old_x, old_y, border;
+void AgiEngine::updatePosition() {
+ struct VtEntry *v;
+ int x, y, oldX, oldY, border;
- game.vars[V_border_code] = 0;
- game.vars[V_border_touch_ego] = 0;
- game.vars[V_border_touch_obj] = 0;
+ _game.vars[vBorderCode] = 0;
+ _game.vars[vBorderTouchEgo] = 0;
+ _game.vars[vBorderTouchObj] = 0;
- for (v = game.view_table; v < &game.view_table[MAX_VIEWTABLE]; v++) {
+ for (v = _game.viewTable; v < &_game.viewTable[MAX_VIEWTABLE]; v++) {
if ((v->flags & (ANIMATED | UPDATE | DRAWN)) != (ANIMATED | UPDATE | DRAWN)) {
continue;
}
- if (v->step_time_count != 0) {
- if (--v->step_time_count != 0)
+ if (v->stepTimeCount != 0) {
+ if (--v->stepTimeCount != 0)
continue;
}
- v->step_time_count = v->step_time;
+ v->stepTimeCount = v->stepTime;
- x = old_x = v->x_pos;
- y = old_y = v->y_pos;
+ x = oldX = v->xPos;
+ y = oldY = v->yPos;
/* If object has moved, update its position */
if (~v->flags & UPDATE_POS) {
int dx[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
int dy[9] = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };
- x += v->step_size * dx[v->direction];
- y += v->step_size * dy[v->direction];
+ x += v->stepSize * dx[v->direction];
+ y += v->stepSize * dy[v->direction];
}
/* Now check if it touched the borders */
@@ -213,43 +212,43 @@
/* Extra test to walk west clicking the mouse */
x = 0;
border = 4;
- } else if (x + v->x_size > _WIDTH) {
- x = _WIDTH - v->x_size;
+ } else if (x + v->xSize > _WIDTH) {
+ x = _WIDTH - v->xSize;
border = 2;
}
/* Check top/bottom borders. */
- if (y - v->y_size + 1 < 0) {
- y = v->y_size - 1;
+ if (y - v->ySize + 1 < 0) {
+ y = v->ySize - 1;
border = 1;
} else if (y > _HEIGHT - 1) {
y = _HEIGHT - 1;
border = 3;
- } else if ((~v->flags & IGNORE_HORIZON) && y <= game.horizon) {
- debugC(4, kDebugLevelSprites, "y = %d, horizon = %d", y, game.horizon);
- y = game.horizon + 1;
+ } else if ((~v->flags & IGNORE_HORIZON) && y <= _game.horizon) {
+ debugC(4, kDebugLevelSprites, "y = %d, horizon = %d", y, _game.horizon);
+ y = _game.horizon + 1;
border = 1;
}
/* Test new position. rollback if test fails */
- v->x_pos = x;
- v->y_pos = y;
- if (check_collision(v) || !check_priority(v)) {
- v->x_pos = old_x;
- v->y_pos = old_y;
+ v->xPos = x;
+ v->yPos = y;
+ if (checkCollision(v) || !checkPriority(v)) {
+ v->xPos = oldX;
+ v->yPos = oldY;
border = 0;
- fix_position(v->entry);
+ fixPosition(v->entry);
}
if (border != 0) {
- if (is_ego_view(v)) {
- game.vars[V_border_touch_ego] = border;
+ if (isEgoView(v)) {
+ _game.vars[vBorderTouchEgo] = border;
} else {
- game.vars[V_border_code] = v->entry;
- game.vars[V_border_touch_obj] = border;
+ _game.vars[vBorderCode] = v->entry;
+ _game.vars[vBorderTouchObj] = border;
}
if (v->motion == MOTION_MOVE_OBJ) {
- in_destination(v);
+ inDestination(v);
}
}
@@ -266,42 +265,42 @@
*
* @param n view table entry number
*/
-void AgiEngine::fix_position(int n) {
- struct vt_entry *v = &game.view_table[n];
+void AgiEngine::fixPosition(int n) {
+ VtEntry *v = &_game.viewTable[n];
int count, dir, size;
- debugC(4, kDebugLevelSprites, "adjusting view table entry #%d (%d,%d)", n, v->x_pos, v->y_pos);
+ debugC(4, kDebugLevelSprites, "adjusting view table entry #%d (%d,%d)", n, v->xPos, v->yPos);
/* test horizon */
- if ((~v->flags & IGNORE_HORIZON) && v->y_pos <= game.horizon)
- v->y_pos = game.horizon + 1;
+ if ((~v->flags & IGNORE_HORIZON) && v->yPos <= _game.horizon)
+ v->yPos = _game.horizon + 1;
dir = 0;
count = size = 1;
- while (!check_position(v) || check_collision(v) || !check_priority(v)) {
+ while (!checkPosition(v) || checkCollision(v) || !checkPriority(v)) {
switch (dir) {
case 0: /* west */
- v->x_pos--;
+ v->xPos--;
if (--count)
continue;
dir = 1;
break;
case 1: /* south */
- v->y_pos++;
+ v->yPos++;
if (--count)
continue;
dir = 2;
size++;
break;
case 2: /* east */
- v->x_pos++;
+ v->xPos++;
if (--count)
continue;
dir = 3;
break;
case 3: /* north */
- v->y_pos--;
+ v->yPos--;
if (--count)
continue;
dir = 0;
@@ -312,7 +311,7 @@
count = size;
}
- debugC(4, kDebugLevelSprites, "view table entry #%d position adjusted to (%d,%d)", n, v->x_pos, v->y_pos);
+ debugC(4, kDebugLevelSprites, "view table entry #%d position adjusted to (%d,%d)", n, v->xPos, v->yPos);
}
} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/console.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -94,17 +94,17 @@
}
int p1 = (int)atoi(argv[1]);
int p2 = (int)atoi(argv[2]);
- _vm->object_set_location(p1, p2);
+ _vm->objectSetLocation(p1, p2);
return true;
}
bool Console::Cmd_RunOpcode(int argc, const char **argv) {
- for (int i = 0; logic_names_cmd[i].name; i++) {
- if (!strcmp(argv[1], logic_names_cmd[i].name)) {
+ for (int i = 0; logicNamesCmd[i].name; i++) {
+ if (!strcmp(argv[1], logicNamesCmd[i].name)) {
uint8 p[16];
- if ((argc - 2)!= logic_names_cmd[i].num_args) {
- DebugPrintf("AGI command wants %d arguments\n", logic_names_cmd[i].num_args);
+ if ((argc - 2)!= logicNamesCmd[i].numArgs) {
+ DebugPrintf("AGI command wants %d arguments\n", logicNamesCmd[i].numArgs);
return 0;
}
p[0] = argv[2] ? (char)strtoul(argv[2], NULL, 0) : 0;
@@ -113,9 +113,9 @@
p[3] = argv[5] ? (char)strtoul(argv[5], NULL, 0) : 0;
p[4] = argv[6] ? (char)strtoul(argv[6], NULL, 0) : 0;
- debugC(5, kDebugLevelMain, "Opcode: %s %s %s %s", logic_names_cmd[i].name, argv[1], argv[2], argv[3]);
+ debugC(5, kDebugLevelMain, "Opcode: %s %s %s %s", logicNamesCmd[i].name, argv[1], argv[2], argv[3]);
- _vm->execute_agi_command(i, p);
+ _vm->executeAgiCommand(i, p);
return true;
}
@@ -177,8 +177,8 @@
bool Console::Cmd_Objs(int argc, const char **argv) {
unsigned int i;
- for (i = 0; i < _vm->game.num_objects; i++) {
- DebugPrintf("%3d]%-24s(%3d)\n", i, _vm->object_name(i), _vm->object_get_location(i));
+ for (i = 0; i < _vm->_game.numObjects; i++) {
+ DebugPrintf("%3d]%-24s(%3d)\n", i, _vm->objectName(i), _vm->objectGetLocation(i));
}
return true;
@@ -243,4 +243,4 @@
return true;
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/console.h
===================================================================
--- scummvm/trunk/engines/agi/console.h 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/console.h 2007-01-16 12:40:51 UTC (rev 25101)
@@ -31,7 +31,7 @@
class AgiEngine;
-struct agi_debug {
+struct AgiDebug {
int enabled;
int opcodes;
int logic0;
@@ -73,4 +73,4 @@
} // End of namespace Agi
-#endif /* AGI_CONSOLE_H */
+#endif /* AGI_CONSOLE_H */
Modified: scummvm/trunk/engines/agi/cycle.cpp
===================================================================
--- scummvm/trunk/engines/agi/cycle.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/cycle.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -38,108 +38,108 @@
* This function is called when ego enters a new room.
* @param n room number
*/
-void AgiEngine::new_room(int n) {
- struct vt_entry *v;
+void AgiEngine::newRoom(int n) {
+ VtEntry *v;
int i;
debugC(4, kDebugLevelMain, "*** room %d ***", n);
- _sound->stop_sound();
+ _sound->stopSound();
i = 0;
- for (v = game.view_table; v < &game.view_table[MAX_VIEWTABLE]; v++) {
+ for (v = _game.viewTable; v < &_game.viewTable[MAX_VIEWTABLE]; v++) {
v->entry = i++;
v->flags &= ~(ANIMATED | DRAWN);
v->flags |= UPDATE;
- v->step_time = 1;
- v->step_time_count = 1;
- v->cycle_time = 1;
- v->cycle_time_count = 1;
- v->step_size = 1;
+ v->stepTime = 1;
+ v->stepTimeCount = 1;
+ v->cycleTime = 1;
+ v->cycleTimeCount = 1;
+ v->stepSize = 1;
}
agiUnloadResources();
- game.player_control = true;
- game.block.active = false;
- game.horizon = 36;
- game.vars[V_prev_room] = game.vars[V_cur_room];
- game.vars[V_cur_room] = n;
- game.vars[V_border_touch_obj] = 0;
- game.vars[V_border_code] = 0;
- game.vars[V_ego_view_resource] = game.view_table[0].current_view;
+ _game.playerControl = true;
+ _game.block.active = false;
+ _game.horizon = 36;
+ _game.vars[vPrevRoom] = _game.vars[vCurRoom];
+ _game.vars[vCurRoom] = n;
+ _game.vars[vBorderTouchObj] = 0;
+ _game.vars[vBorderCode] = 0;
+ _game.vars[vEgoViewResource] = _game.viewTable[0].currentView;
agiLoadResource(rLOGIC, n);
/* Reposition ego in the new room */
- switch (game.vars[V_border_touch_ego]) {
+ switch (_game.vars[vBorderTouchEgo]) {
case 1:
- game.view_table[0].y_pos = _HEIGHT - 1;
+ _game.viewTable[0].yPos = _HEIGHT - 1;
break;
case 2:
- game.view_table[0].x_pos = 0;
+ _game.viewTable[0].xPos = 0;
break;
case 3:
- game.view_table[0].y_pos = HORIZON + 1;
+ _game.viewTable[0].yPos = HORIZON + 1;
break;
case 4:
- game.view_table[0].x_pos = _WIDTH - game.view_table[0].x_size;
+ _game.viewTable[0].xPos = _WIDTH - _game.viewTable[0].xSize;
break;
}
- game.vars[V_border_touch_ego] = 0;
- setflag(F_new_room_exec, true);
+ _game.vars[vBorderTouchEgo] = 0;
+ setflag(fNewRoomExec, true);
- game.exit_all_logics = true;
+ _game.exitAllLogics = true;
- write_status();
- write_prompt();
+ writeStatus();
+ writePrompt();
}
-void AgiEngine::reset_controllers() {
+void AgiEngine::resetControllers() {
int i;
for (i = 0; i < MAX_DIRS; i++) {
- game.ev_keyp[i].occured = false;
+ _game.evKeyp[i].occured = false;
}
}
-void AgiEngine::interpret_cycle() {
- int old_sound, old_score;
+void AgiEngine::interpretCycle() {
+ int oldSound, oldScore;
- if (game.player_control)
- game.vars[V_ego_dir] = game.view_table[0].direction;
+ if (_game.playerControl)
+ _game.vars[vEgoDir] = _game.viewTable[0].direction;
else
- game.view_table[0].direction = game.vars[V_ego_dir];
+ _game.viewTable[0].direction = _game.vars[vEgoDir];
- check_all_motions();
+ checkAllMotions();
- old_score = game.vars[V_score];
- old_sound = getflag(F_sound_on);
+ oldScore = _game.vars[vScore];
+ oldSound = getflag(fSoundOn);
- game.exit_all_logics = false;
- while (run_logic(0) == 0 && !game.quit_prog_now) {
- game.vars[V_word_not_found] = 0;
- game.vars[V_border_touch_obj] = 0;
- game.vars[V_border_code] = 0;
- old_score = game.vars[V_score];
- setflag(F_entered_cli, false);
- game.exit_all_logics = false;
- reset_controllers();
+ _game.exitAllLogics = false;
+ while (runLogic(0) == 0 && !_game.quitProgNow) {
+ _game.vars[vWordNotFound] = 0;
+ _game.vars[vBorderTouchObj] = 0;
+ _game.vars[vBorderCode] = 0;
+ oldScore = _game.vars[vScore];
+ setflag(fEnteredCli, false);
+ _game.exitAllLogics = false;
+ resetControllers();
}
- reset_controllers();
+ resetControllers();
- game.view_table[0].direction = game.vars[V_ego_dir];
+ _game.viewTable[0].direction = _game.vars[vEgoDir];
- if (game.vars[V_score] != old_score || getflag(F_sound_on) != old_sound)
- write_status();
+ if (_game.vars[vScore] != oldScore || getflag(fSoundOn) != oldSound)
+ writeStatus();
- game.vars[V_border_touch_obj] = 0;
- game.vars[V_border_code] = 0;
- setflag(F_new_room_exec, false);
- setflag(F_restart_game, false);
- setflag(F_restore_just_ran, false);
+ _game.vars[vBorderTouchObj] = 0;
+ _game.vars[vBorderCode] = 0;
+ setflag(fNewRoomExec, false);
+ setflag(fRestartGame, false);
+ setflag(fRestoreJustRan, false);
- if (game.gfx_mode) {
- update_viewtable();
+ if (_game.gfxMode) {
+ updateViewtable();
_gfx->doUpdate();
}
}
@@ -147,101 +147,101 @@
/**
* Update AGI interpreter timer.
*/
-void AgiEngine::update_timer() {
- clock_count++;
- if (clock_count <= TICK_SECONDS)
+void AgiEngine::updateTimer() {
+ _clockCount++;
+ if (_clockCount <= TICK_SECONDS)
return;
- clock_count -= TICK_SECONDS;
+ _clockCount -= TICK_SECONDS;
- if (!game.clock_enabled)
+ if (!_game.clockEnabled)
return;
- setvar(V_seconds, getvar(V_seconds) + 1);
- if (getvar(V_seconds) < 60)
+ setvar(vSeconds, getvar(vSeconds) + 1);
+ if (getvar(vSeconds) < 60)
return;
- setvar(V_seconds, 0);
- setvar(V_minutes, getvar(V_minutes) + 1);
- if (getvar(V_minutes) < 60)
+ setvar(vSeconds, 0);
+ setvar(vMinutes, getvar(vMinutes) + 1);
+ if (getvar(vMinutes) < 60)
return;
- setvar(V_minutes, 0);
- setvar(V_hours, getvar(V_hours) + 1);
- if (getvar(V_hours) < 24)
+ setvar(vMinutes, 0);
+ setvar(vHours, getvar(vHours) + 1);
+ if (getvar(vHours) < 24)
return;
- setvar(V_hours, 0);
- setvar(V_days, getvar(V_days) + 1);
+ setvar(vHours, 0);
+ setvar(vDays, getvar(vDays) + 1);
}
-static int old_mode = -1;
-
-void AgiEngine::new_input_mode(int i) {
- old_mode = game.input_mode;
- game.input_mode = i;
+void AgiEngine::newInputMode(int i) {
+ _oldMode = _game.inputMode;
+ _game.inputMode = i;
}
-void AgiEngine::old_input_mode() {
- game.input_mode = old_mode;
+void AgiEngine::oldInputMode() {
+ _game.inputMode = _oldMode;
}
/* If main_cycle returns false, don't process more events! */
-int AgiEngine::main_cycle() {
+int AgiEngine::mainCycle() {
unsigned int key, kascii;
- struct vt_entry *v = &game.view_table[0];
+ struct VtEntry *v = &_game.viewTable[0];
_gfx->pollTimer(); /* msdos driver -> does nothing */
- update_timer();
+ updateTimer();
- if (game.ver == 0) {
- message_box("Warning: game CRC not listed, assuming AGI version 2.917.");
- game.ver = -1;
+ if (_game.ver == 0) {
+ messageBox("Warning: game CRC not listed, assuming AGI version 2.917.");
+ _game.ver = -1;
}
- key = do_poll_keyboard();
+ key = doPollKeyboard();
/* In AGI Mouse emulation mode we must update the mouse-related
* vars in every interpreter cycle.
*/
- if (opt.agimouse) {
- game.vars[28] = g_mouse.x / 2;
- game.vars[29] = g_mouse.y;
+ if (_opt.agimouse) {
+ _game.vars[28] = g_mouse.x / 2;
+ _game.vars[29] = g_mouse.y;
}
if (key == KEY_PRIORITY) {
- _sprites->erase_both();
+ _sprites->eraseBoth();
_debug.priority = !_debug.priority;
- _picture->show_pic();
- _sprites->blit_both();
- _sprites->commit_both();
+ _picture->showPic();
+ _sprites->blitBoth();
+ _sprites->commitBoth();
key = 0;
}
if (key == KEY_STATUSLN) {
_debug.statusline = !_debug.statusline;
- write_status();
+ writeStatus();
key = 0;
}
/* Click-to-walk mouse interface */
- if (game.player_control && v->flags & ADJ_EGO_XY) {
- v->direction = get_direction(v->x_pos, v->y_pos, v->parm1, v->parm2, v->step_size);
+ if (_game.playerControl && v->flags & ADJ_EGO_XY) {
+ v->direction = getDirection(v->xPos, v->yPos, v->parm1, v->parm2, v->stepSize);
if (v->direction == 0)
- in_destination(v);
+ inDestination(v);
}
kascii = KEY_ASCII(key);
if (kascii)
- setvar(V_key, kascii);
- process_key:
- switch (game.input_mode) {
+ setvar(vKey, kascii);
+
+process_key:
+
+ switch (_game.inputMode) {
case INPUT_NORMAL:
- if (!handle_controller(key)) {
- if (key == 0 || !game.input_enabled)
+ if (!handleController(key)) {
+ if (key == 0 || !_game.inputEnabled)
break;
- handle_keys(key);
+ handleKeys(key);
/* if ESC pressed, activate menu before
* accept.input from the interpreter cycle
@@ -259,129 +259,129 @@
}
break;
case INPUT_GETSTRING:
- handle_controller(key);
- handle_getstring(key);
- setvar(V_key, 0); /* clear ENTER key */
+ handleController(key);
+ handleGetstring(key);
+ setvar(vKey, 0); /* clear ENTER key */
break;
case INPUT_MENU:
- menu->keyhandler(key);
+ _menu->keyhandler(key);
_gfx->doUpdate();
return false;
case INPUT_NONE:
- handle_controller(key);
+ handleController(key);
if (key)
- game.keypress = key;
+ _game.keypress = key;
break;
}
_gfx->doUpdate();
- if (game.msg_box_ticks > 0)
- game.msg_box_ticks--;
+ if (_game.msgBoxTicks > 0)
+ _game.msgBoxTicks--;
return true;
}
-int AgiEngine::play_game() {
- int ec = err_OK;
+int AgiEngine::playGame() {
+ int ec = errOK;
debugC(2, kDebugLevelMain, "initializing...");
- debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
+ debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
- _sound->stop_sound();
+ _sound->stopSound();
_gfx->clearScreen(0);
- game.horizon = HORIZON;
- game.player_control = false;
+ _game.horizon = HORIZON;
+ _game.playerControl = false;
- setflag(F_logic_zero_firsttime, true); /* not in 2.917 */
- setflag(F_new_room_exec, true); /* needed for MUMG and SQ2! */
- setflag(F_sound_on, true); /* enable sound */
- setvar(V_time_delay, 2); /* "normal" speed */
+ setflag(fLogicZeroFirsttime, true); /* not in 2.917 */
+ setflag(fNewRoomExec, true); /* needed for MUMG and SQ2! */
+ setflag(fSoundOn, true); /* enable sound */
+ setvar(vTimeDelay, 2); /* "normal" speed */
- game.gfx_mode = true;
- game.quit_prog_now = false;
- game.clock_enabled = true;
- game.line_user_input = 22;
+ _game.gfxMode = true;
+ _game.quitProgNow = false;
+ _game.clockEnabled = true;
+ _game.lineUserInput = 22;
- if (opt.agimouse)
+ if (_opt.agimouse)
report("Using AGI Mouse 1.0 protocol\n");
report("Running AGI script.\n");
- setflag(F_entered_cli, false);
- setflag(F_said_accepted_input, false);
- game.vars[V_word_not_found] = 0;
- game.vars[V_key] = 0;
+ setflag(fEnteredCli, false);
+ setflag(fSaidAcceptedInput, false);
+ _game.vars[vWordNotFound] = 0;
+ _game.vars[vKey] = 0;
debugC(2, kDebugLevelMain, "Entering main loop");
do {
- if (!main_cycle())
+ if (!mainCycle())
continue;
- if (getvar(V_time_delay) == 0 || (1 + clock_count) % getvar(V_time_delay) == 0) {
- if (!game.has_prompt && game.input_mode == INPUT_NORMAL) {
- write_prompt();
- game.has_prompt = 1;
- } else if (game.has_prompt && game.input_mode == INPUT_NONE) {
- write_prompt();
- game.has_prompt = 0;
+ if (getvar(vTimeDelay) == 0 || (1 + _clockCount) % getvar(vTimeDelay) == 0) {
+ if (!_game.hasPrompt && _game.inputMode == INPUT_NORMAL) {
+ writePrompt();
+ _game.hasPrompt = 1;
+ } else if (_game.hasPrompt && _game.inputMode == INPUT_NONE) {
+ writePrompt();
+ _game.hasPrompt = 0;
}
- interpret_cycle();
+ interpretCycle();
- setflag(F_entered_cli, false);
- setflag(F_said_accepted_input, false);
- game.vars[V_word_not_found] = 0;
- game.vars[V_key] = 0;
+ setflag(fEnteredCli, false);
+ setflag(fSaidAcceptedInput, false);
+ _game.vars[vWordNotFound] = 0;
+ _game.vars[vKey] = 0;
}
- if (game.quit_prog_now == 0xff)
- ec = err_RestartGame;
+ if (_game.quitProgNow == 0xff)
+ ec = errRestartGame;
- } while (game.quit_prog_now == 0);
+ } while (_game.quitProgNow == 0);
- _sound->stop_sound();
+ _sound->stopSound();
return ec;
}
-int AgiEngine::run_game() {
- int i, ec = err_OK;
+int AgiEngine::runGame() {
+ int i, ec = errOK;
for (i = 0; i < MAX_DIRS; i++)
- memset(&game.ev_keyp[i], 0, sizeof(struct agi_event));
+ memset(&_game.evKeyp[i], 0, sizeof(struct AgiEvent));
/* Execute the game */
do {
debugC(2, kDebugLevelMain, "game loop");
- debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
+ debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
- if (agiInit() != err_OK)
+ if (agiInit() != errOK)
break;
- if (ec == err_RestartGame)
- setflag(F_restart_game, true);
+ if (ec == errRestartGame)
+ setflag(fRestartGame, true);
- setvar(V_computer, 0); /* IBM PC (4 = Atari ST) */
- setvar(V_soundgen, 1); /* IBM PC SOUND */
- setvar(V_monitor, 0x3); /* EGA monitor */
- setvar(V_max_input_chars, 38);
- game.input_mode = INPUT_NONE;
- game.input_enabled = 0;
- game.has_prompt = 0;
+ setvar(vComputer, 0); /* IBM PC (4 = Atari ST) */
+ setvar(vSoundgen, 1); /* IBM PC SOUND */
+ setvar(vMonitor, 0x3); /* EGA monitor */
+ setvar(vMaxInputChars, 38);
+ _game.inputMode = INPUT_NONE;
+ _game.inputEnabled = 0;
+ _game.hasPrompt = 0;
- game.state = STATE_RUNNING;
- ec = play_game();
- game.state = STATE_LOADED;
+ _game.state = STATE_RUNNING;
+ ec = playGame();
+ _game.state = STATE_LOADED;
agiDeinit();
- } while (ec == err_RestartGame);
+ } while (ec == errRestartGame);
- delete menu;
- menu = 0;
+ delete _menu;
+ _menu = NULL;
- release_image_stack();
+ releaseImageStack();
return ec;
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/font.h
===================================================================
--- scummvm/trunk/engines/agi/font.h 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/font.h 2007-01-16 12:40:51 UTC (rev 25101)
@@ -29,7 +29,7 @@
namespace Agi {
/* 8x8 font patterns */
-static const uint8 cur_font[] = {
+static const uint8 curFont[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7E, /* cursor hollow */
0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, /* cursor solid */
@@ -290,4 +290,4 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x7E, 0x00
};
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/global.cpp
===================================================================
--- scummvm/trunk/engines/agi/global.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/global.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -29,14 +29,14 @@
namespace Agi {
int AgiEngine::getflag(int n) {
- uint8 *set = (uint8 *) &game.flags;
+ uint8 *set = (uint8 *)&_game.flags;
set += n >> 3;
return (*set & (1 << (n & 0x07))) != 0;
}
void AgiEngine::setflag(int n, int v) {
- uint8 *set = (uint8 *) &game.flags;
+ uint8 *set = (uint8 *)&_game.flags;
set += n >> 3;
if (v)
@@ -46,25 +46,25 @@
}
void AgiEngine::flipflag(int n) {
- uint8 *set = (uint8 *) & game.flags;
+ uint8 *set = (uint8 *)&_game.flags;
set += n >> 3;
*set ^= 1 << (n & 0x07); /* flip bit */
}
void AgiEngine::setvar(int var, int val) {
- game.vars[var] = val;
+ _game.vars[var] = val;
}
int AgiEngine::getvar(int var) {
- return game.vars[var];
+ return _game.vars[var];
}
void AgiEngine::decrypt(uint8 *mem, int len) {
const uint8 *key;
int i;
- key = opt.agdsMode ? (const uint8 *)CRYPT_KEY_AGDS
+ key = _opt.agdsMode ? (const uint8 *)CRYPT_KEY_AGDS
: (const uint8 *)CRYPT_KEY_SIERRA;
for (i = 0; i < len; i++)
Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/graphics.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -46,7 +46,7 @@
* This array contains the 6-bit RGB values of the EGA palette exported
* to the console drivers.
*/
-uint8 ega_palette[16 * 3] = {
+uint8 egaPalette[16 * 3] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x2a,
0x00, 0x2a, 0x00,
@@ -68,7 +68,7 @@
/**
* 16 color amiga-ish palette.
*/
-uint8 new_palette[16 * 3] = {
+uint8 newPalette[16 * 3] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x3f,
0x00, 0x2A, 0x00,
@@ -87,7 +87,7 @@
0x3F, 0x3F, 0x3F
};
-static uint16 cga_map[16] = {
+static uint16 cgaMap[16] = {
0x0000, /* 0 - black */
0x0d00, /* 1 - blue */
0x0b00, /* 2 - green */
@@ -106,12 +106,12 @@
0x0f0f /* 15 - white */
};
-struct update_block {
+struct UpdateBlock {
int x1, y1;
int x2, y2;
};
-static struct update_block update = {
+static struct UpdateBlock update = {
MAX_INT, MAX_INT, 0, 0
};
@@ -134,20 +134,20 @@
void GfxMgr::shakeStart() {
int i;
- if ((shake_h = (uint8 *)malloc(GFX_WIDTH * SHAKE_MAG)) == NULL)
+ if ((_shakeH = (uint8 *)malloc(GFX_WIDTH * SHAKE_MAG)) == NULL)
return;
- if ((shake_v = (uint8 *)malloc(SHAKE_MAG * (GFX_HEIGHT - SHAKE_MAG))) == NULL) {
- free(shake_h);
+ if ((_shakeV = (uint8 *)malloc(SHAKE_MAG * (GFX_HEIGHT - SHAKE_MAG))) == NULL) {
+ free(_shakeH);
return;
}
for (i = 0; i < GFX_HEIGHT - SHAKE_MAG; i++) {
- memcpy(shake_v + i * SHAKE_MAG, agi_screen + i * GFX_WIDTH, SHAKE_MAG);
+ memcpy(_shakeV + i * SHAKE_MAG, _agiScreen + i * GFX_WIDTH, SHAKE_MAG);
}
for (i = 0; i < SHAKE_MAG; i++) {
- memcpy(shake_h + i * GFX_WIDTH, agi_screen + i * GFX_WIDTH, GFX_WIDTH);
+ memcpy(_shakeH + i * GFX_WIDTH, _agiScreen + i * GFX_WIDTH, GFX_WIDTH);
}
}
@@ -156,14 +156,14 @@
if (n == 0) {
for (i = 0; i < (GFX_HEIGHT - SHAKE_MAG); i++) {
- memmove(&agi_screen[GFX_WIDTH * i],
- &agi_screen[GFX_WIDTH * (i + SHAKE_MAG) + SHAKE_MAG],
+ memmove(&_agiScreen[GFX_WIDTH * i],
+ &_agiScreen[GFX_WIDTH * (i + SHAKE_MAG) + SHAKE_MAG],
GFX_WIDTH - SHAKE_MAG);
}
} else {
for (i = GFX_HEIGHT - SHAKE_MAG - 1; i >= 0; i--) {
- memmove(&agi_screen[GFX_WIDTH * (i + SHAKE_MAG) + SHAKE_MAG],
- &agi_screen[GFX_WIDTH * i], GFX_WIDTH - SHAKE_MAG);
+ memmove(&_agiScreen[GFX_WIDTH * (i + SHAKE_MAG) + SHAKE_MAG],
+ &_agiScreen[GFX_WIDTH * i], GFX_WIDTH - SHAKE_MAG);
}
}
}
@@ -172,30 +172,30 @@
int i;
for (i = 0; i < GFX_HEIGHT - SHAKE_MAG; i++) {
- memcpy(agi_screen + i * GFX_WIDTH, shake_v + i * SHAKE_MAG, SHAKE_MAG);
+ memcpy(_agiScreen + i * GFX_WIDTH, _shakeV + i * SHAKE_MAG, SHAKE_MAG);
}
for (i = 0; i < SHAKE_MAG; i++) {
- memcpy(agi_screen + i * GFX_WIDTH, shake_h + i * GFX_WIDTH, GFX_WIDTH);
+ memcpy(_agiScreen + i * GFX_WIDTH, _shakeH + i * GFX_WIDTH, GFX_WIDTH);
}
flushBlock(0, 0, GFX_WIDTH - 1, GFX_HEIGHT - 1);
- free(shake_v);
- free(shake_h);
+ free(_shakeV);
+ free(_shakeH);
}
void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int bg, bool checkerboard) {
int x1, y1, xx, yy, cc;
const uint8 *p;
- p = Agi::cur_font + ((unsigned int)c * CHAR_LINES);
+ p = Agi::curFont + ((unsigned int)c * CHAR_LINES);
for (y1 = 0; y1 < CHAR_LINES; y1++) {
for (x1 = 0; x1 < CHAR_COLS; x1++) {
xx = x + x1;
yy = y + y1;
cc = (*p & (1 << (7 - x1))) ? fg : bg;
- agi_screen[xx + yy * GFX_WIDTH] = cc;
+ _agiScreen[xx + yy * GFX_WIDTH] = cc;
}
p++;
@@ -207,7 +207,7 @@
if (checkerboard) {
for (yy = y; yy < y + CHAR_LINES; yy++)
for (xx = x + (~yy & 1); xx < x + CHAR_COLS; xx += 2)
- agi_screen[xx + yy * GFX_WIDTH] = 15;
+ _agiScreen[xx + yy * GFX_WIDTH] = 15;
}
/* FIXME: we don't want this when we're writing on the
@@ -231,7 +231,7 @@
w = x2 - x1 + 1;
h = y2 - y1 + 1;
- p0 = &agi_screen[x1 + y1 * GFX_WIDTH];
+ p0 = &_agiScreen[x1 + y1 * GFX_WIDTH];
for (y = 0; y < h; y++) {
memset(p0, c, w);
p0 += GFX_WIDTH;
@@ -244,17 +244,17 @@
/* top line */
w = x2 - x1 + 1;
- p0 = &agi_screen[x1 + y1 * GFX_WIDTH];
+ p0 = &_agiScreen[x1 + y1 * GFX_WIDTH];
memset(p0, c1, w);
/* bottom line */
- p0 = &agi_screen[x1 + y2 * GFX_WIDTH];
+ p0 = &_agiScreen[x1 + y2 * GFX_WIDTH];
memset(p0, c2, w);
/* side lines */
for (y = y1; y <= y2; y++) {
- agi_screen[x1 + y * GFX_WIDTH] = c1;
- agi_screen[x2 + y * GFX_WIDTH] = c2;
+ _agiScreen[x1 + y * GFX_WIDTH] = c1;
+ _agiScreen[x2 + y * GFX_WIDTH] = c2;
}
}
@@ -357,8 +357,8 @@
int i;
for (i = 0; i < 48; i++) {
- palette[i] = p[i];
- palette[i + 48] = (p[i] + 0x30) >> 2;
+ _palette[i] = p[i];
+ _palette[i + 48] = (p[i] + 0x30) >> 2;
}
}
@@ -367,9 +367,9 @@
byte pal[32 * 4];
for (i = 0; i < 32; i++) {
- pal[i * 4 + 0] = palette[i * 3 + 0] << 2;
- pal[i * 4 + 1] = palette[i * 3 + 1] << 2;
- pal[i * 4 + 2] = palette[i * 3 + 2] << 2;
+ pal[i * 4 + 0] = _palette[i * 3 + 0] << 2;
+ pal[i * 4 + 1] = _palette[i * 3 + 1] << 2;
+ pal[i * 4 + 2] = _palette[i * 3 + 2] << 2;
pal[i * 4 + 3] = 0;
}
g_system->setPalette(pal, 0, 32);
@@ -386,7 +386,7 @@
if (y2 >= GFX_HEIGHT)
y2 = GFX_HEIGHT - 1;
- g_system->copyRectToScreen(screen + y1 * 320 + x1, 320, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ g_system->copyRectToScreen(_screen + y1 * 320 + x1, 320, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
}
static const byte mouseCursorArrow[] = {
@@ -406,13 +406,13 @@
* @see deinit_video()
*/
int GfxMgr::initVideo() {
- if (_vm->opt.renderMode == Common::kRenderEGA)
- initPalette(ega_palette);
+ if (_vm->_opt.renderMode == Common::kRenderEGA)
+ initPalette(egaPalette);
else
- initPalette(new_palette);
+ initPalette(newPalette);
- if ((agi_screen = (uint8 *)calloc(GFX_WIDTH, GFX_HEIGHT)) == NULL)
- return err_NotEnoughMemory;
+ if ((_agiScreen = (uint8 *)calloc(GFX_WIDTH, GFX_HEIGHT)) == NULL)
+ return errNotEnoughMemory;
gfxSetPalette();
@@ -434,7 +434,7 @@
}
CursorMan.replaceCursor(mouseCursor, 16, 16, 1, 1);
- return err_OK;
+ return errOK;
}
/**
@@ -443,22 +443,22 @@
* @see init_video()
*/
int GfxMgr::deinitVideo() {
- free(agi_screen);
+ free(_agiScreen);
- return err_OK;
+ return errOK;
}
int GfxMgr::initMachine() {
- screen = (unsigned char *)malloc(320 * 200);
- _vm->clock_count = 0;
+ _screen = (unsigned char *)malloc(320 * 200);
+ _vm->_clockCount = 0;
- return err_OK;
+ return errOK;
}
int GfxMgr::deinitMachine() {
- free(screen);
+ free(_screen);
- return err_OK;
+ return errOK;
}
/**
@@ -472,19 +472,19 @@
* @param p pointer to the row start in the AGI screen
*/
void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
- if (_vm->opt.renderMode == Common::kRenderCGA) {
+ if (_vm->_opt.renderMode == Common::kRenderCGA) {
for (x *= 2; n--; p++, x += 2) {
- register uint16 q = (cga_map[(*p & 0xf0) >> 4] << 4) | cga_map[*p & 0x0f];
+ register uint16 q = (cgaMap[(*p & 0xf0) >> 4] << 4) | cgaMap[*p & 0x0f];
if (_vm->_debug.priority)
q >>= 4;
- *(uint16 *)&agi_screen[x + y * GFX_WIDTH] = q & 0x0f0f;
+ *(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = q & 0x0f0f;
}
} else {
for (x *= 2; n--; p++, x += 2) {
register uint16 q = ((uint16) * p << 8) | *p;
if (_vm->_debug.priority)
q >>= 4;
- *(uint16 *)&agi_screen[x + y * GFX_WIDTH] = q & 0x0f0f;
+ *(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = q & 0x0f0f;
}
}
}
@@ -547,11 +547,11 @@
scheduleUpdate(x1, y1, x2, y2);
- p0 = &agi_screen[x1 + y1 * GFX_WIDTH];
+ p0 = &_agiScreen[x1 + y1 * GFX_WIDTH];
w = x2 - x1 + 1;
for (y = y1; y <= y2; y++) {
- memcpy(screen + 320 * y + x1, p0, w);
+ memcpy(_screen + 320 * y + x1, p0, w);
p0 += GFX_WIDTH;
}
}
@@ -589,7 +589,7 @@
* @param c color to clear the screen
*/
void GfxMgr::clearScreen(int c) {
- memset(agi_screen, c, GFX_WIDTH * GFX_HEIGHT);
+ memset(_agiScreen, c, GFX_WIDTH * GFX_HEIGHT);
flushScreen();
}
@@ -600,7 +600,7 @@
uint8 *p0;
int w, h;
- p0 = &agi_screen[x1 + GFX_WIDTH * y1];
+ p0 = &_agiScreen[x1 + GFX_WIDTH * y1];
w = x2 - x1 + 1;
h = y2 - y1 + 1;
while (h--) {
@@ -617,7 +617,7 @@
uint8 *p0;
int w, h;
- p0 = &agi_screen[x1 + GFX_WIDTH * y1];
+ p0 = &_agiScreen[x1 + GFX_WIDTH * y1];
w = x2 - x1 + 1;
h = y2 - y1 + 1;
while (h--) {
Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/graphics.h 2007-01-16 12:40:51 UTC (rev 25101)
@@ -40,17 +40,17 @@
private:
AgiEngine *_vm;
- uint8 palette[32 * 3];
- uint8 *agi_screen;
- unsigned char *screen;
+ uint8 _palette[32 * 3];
+ uint8 *_agiScreen;
+ unsigned char *_screen;
- uint8 *shake_h, *shake_v;
+ uint8 *_shakeH, *_shakeV;
public:
GfxMgr(AgiEngine *vm) {
_vm = vm;
- shake_h = NULL;
- shake_v = NULL;
+ _shakeH = NULL;
+ _shakeV = NULL;
}
void gfxPutBlock(int x1, int y1, int x2, int y2);
@@ -96,4 +96,4 @@
} // End of namespace Agi
-#endif /* AGI_GRAPHICS_H */
+#endif /* AGI_GRAPHICS_H */
Modified: scummvm/trunk/engines/agi/id.cpp
===================================================================
--- scummvm/trunk/engines/agi/id.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/id.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -29,15 +29,15 @@
namespace Agi {
-int AgiEngine::v2id_game() {
+int AgiEngine::v2IdGame() {
int ver;
- ver = this->_gameDescription->version;
- game.ver = ver;
- debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
+ ver = _gameDescription->version;
+ _game.ver = ver;
+ debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
agiSetRelease(ver);
- return setup_v2_game(ver, 0);
+ return setupV2Game(ver, 0);
}
/*
@@ -48,22 +48,22 @@
* 0x0149
*/
-int AgiEngine::v3id_game() {
+int AgiEngine::v3IdGame() {
int ver;
- ver = this->_gameDescription->version;
- game.ver = ver;
- debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);
+ ver = _gameDescription->version;
+ _game.ver = ver;
+ debugC(2, kDebugLevelMain, "game.ver = 0x%x", _game.ver);
agiSetRelease(ver);
- return setup_v3_game(ver, 0);
+ return setupV3Game(ver, 0);
}
/**
*
*/
-int AgiEngine::setup_v2_game(int ver, uint32 crc) {
- int ec = err_OK;
+int AgiEngine::setupV2Game(int ver, uint32 crc) {
+ int ec = errOK;
if (ver == 0) {
report("Unknown v2 Sierra game: %08x\n\n", crc);
@@ -73,26 +73,26 @@
/* setup the differences in the opcodes and other bits in the
* AGI v2 specs
*/
- if (opt.emuversion)
- agiSetRelease(ver = opt.emuversion);
+ if (_opt.emuversion)
+ agiSetRelease(ver = _opt.emuversion);
// Should this go above the previous lines, so we can force emulation versions
// even for AGDS games? -- dsymonds
- if (opt.agdsMode)
+ if (_opt.agdsMode)
agiSetRelease(ver = 0x2440); /* ALL AGDS games built for 2.440 */
report("Seting up for version 0x%04X\n", ver);
// 'quit' takes 0 args for 2.089
if (ver == 0x2089)
- logic_names_cmd[0x86].num_args = 0;
+ logicNamesCmd[0x86].numArgs = 0;
// 'print.at' and 'print.at.v' take 3 args before 2.272
// This is documented in the specs as only < 2.440, but it seems
// that KQ3 (2.272) needs a 'print.at' taking 4 args.
if (ver < 0x2272) {
- logic_names_cmd[0x97].num_args = 3;
- logic_names_cmd[0x98].num_args = 3;
+ logicNamesCmd[0x97].numArgs = 3;
+ logicNamesCmd[0x98].numArgs = 3;
}
return ec;
@@ -101,16 +101,16 @@
/**
*
*/
-int AgiEngine::setup_v3_game(int ver, uint32 crc) {
- int ec = err_OK;
+int AgiEngine::setupV3Game(int ver, uint32 crc) {
+ int ec = errOK;
if (ver == 0) {
report("Unknown v3 Sierra game: %08x\n\n", crc);
agiSetRelease(ver = 0x3149);
}
- if (opt.emuversion)
- agiSetRelease(ver = opt.emuversion);
+ if (_opt.emuversion)
+ agiSetRelease(ver = _opt.emuversion);
report("Seting up for version 0x%04X\n", ver);
@@ -118,11 +118,11 @@
// 'unknown173' also takes 1 arg for 3.002.068, not 0 args.
// Is this actually used anywhere? -- dsymonds
if (ver == 0x3086) {
- logic_names_cmd[0xb0].num_args = 1;
- logic_names_cmd[0xad].num_args = 1;
+ logicNamesCmd[0xb0].numArgs = 1;
+ logicNamesCmd[0xad].numArgs = 1;
}
return ec;
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/inv.cpp
===================================================================
--- scummvm/trunk/engines/agi/inv.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/inv.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -54,7 +54,7 @@
#define SELECT_MSG "Press ENTER to select, ESC to cancel"
void AgiEngine::printItem(int n, int fg, int bg) {
- print_text(object_name(intobj[n]), 0, n % 2 ? 39 - strlen(object_name(intobj[n])) : 1,
+ printText(objectName(_intobj[n]), 0, n % 2 ? 39 - strlen(objectName(_intobj[n])) : 1,
(n / 2) + 2, 40, fg, bg);
}
@@ -75,17 +75,17 @@
int AgiEngine::showItems() {
unsigned int x, i;
- for (x = i = 0; x < game.num_objects; x++) {
- if (object_get_location(x) == EGO_OWNED) {
+ for (x = i = 0; x < _game.numObjects; x++) {
+ if (objectGetLocation(x) == EGO_OWNED) {
/* add object to our list! */
- intobj[i] = x;
+ _intobj[i] = x;
printItem(i, STATUS_FG, STATUS_BG);
i++;
}
}
if (i == 0) {
- print_text(NOTHING_MSG, 0, NOTHING_X, NOTHING_Y, 40, STATUS_FG, STATUS_BG);
+ printText(NOTHING_MSG, 0, NOTHING_X, NOTHING_Y, 40, STATUS_FG, STATUS_BG);
}
return i;
@@ -98,12 +98,12 @@
if (n > 0)
printItem(fsel, STATUS_BG, STATUS_FG);
- switch (wait_any_key()) {
+ switch (waitAnyKey()) {
case KEY_ENTER:
- setvar(V_sel_item, intobj[fsel]);
+ setvar(vSelItem, _intobj[fsel]);
goto exit_select;
case KEY_ESCAPE:
- setvar(V_sel_item, 0xff);
+ setvar(vSelItem, 0xff);
goto exit_select;
case KEY_UP:
if (fsel >= 2)
@@ -124,7 +124,7 @@
case BUTTON_LEFT:{
int i = findItem();
if (i >= 0 && i < n) {
- setvar(V_sel_item, intobj[fsel = i]);
+ setvar(vSelItem, _intobj[fsel = i]);
debugC(6, kDebugLevelInventory, "item found: %d", fsel);
showItems();
printItem(fsel, STATUS_BG, STATUS_FG);
@@ -153,29 +153,29 @@
* Display inventory items.
*/
void AgiEngine::inventory() {
- int old_fg, old_bg;
+ int oldFg, oldBg;
int n;
/* screen is white with black text */
- old_fg = game.color_fg;
- old_bg = game.color_bg;
- game.color_fg = 0;
- game.color_bg = 15;
- _gfx->clearScreen(game.color_bg);
+ oldFg = _game.colorFg;
+ oldBg = _game.colorBg;
+ _game.colorFg = 0;
+ _game.colorBg = 15;
+ _gfx->clearScreen(_game.colorBg);
- print_text(YOUHAVE_MSG, 0, YOUHAVE_X, YOUHAVE_Y, 40, STATUS_FG, STATUS_BG);
+ printText(YOUHAVE_MSG, 0, YOUHAVE_X, YOUHAVE_Y, 40, STATUS_FG, STATUS_BG);
/* FIXME: doesn't check if objects overflow off screen... */
- intobj = (uint8 *) malloc(4 + game.num_objects);
- memset(intobj, 0, (4 + game.num_objects));
+ _intobj = (uint8 *)malloc(4 + _game.numObjects);
+ memset(_intobj, 0, (4 + _game.numObjects));
n = showItems();
- if (getflag(F_status_selects_items)) {
- print_text(SELECT_MSG, 0, SELECT_X, SELECT_Y, 40, STATUS_FG, STATUS_BG);
+ if (getflag(fStatusSelectsItems)) {
+ printText(SELECT_MSG, 0, SELECT_X, SELECT_Y, 40, STATUS_FG, STATUS_BG);
} else {
- print_text(ANY_KEY_MSG, 0, ANY_KEY_X, ANY_KEY_Y, 40, STATUS_FG, STATUS_BG);
+ printText(ANY_KEY_MSG, 0, ANY_KEY_X, ANY_KEY_Y, 40, STATUS_FG, STATUS_BG);
}
_gfx->flushScreen();
@@ -185,21 +185,21 @@
* var 25 = 0xff.
*/
- if (getflag(F_status_selects_items))
+ if (getflag(fStatusSelectsItems))
selectItems(n);
- free(intobj);
+ free(_intobj);
- if (!getflag(F_status_selects_items))
- wait_any_key();
+ if (!getflag(fStatusSelectsItems))
+ waitAnyKey();
_gfx->clearScreen(0);
- write_status();
- _picture->show_pic();
- game.color_fg = old_fg;
- game.color_bg = old_bg;
- game.has_prompt = 0;
- flush_lines(game.line_user_input, 24);
+ writeStatus();
+ _picture->showPic();
+ _game.colorFg = oldFg;
+ _game.colorBg = oldBg;
+ _game.hasPrompt = 0;
+ flushLines(_game.lineUserInput, 24);
}
-} // End of namespace Agi
+} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp 2007-01-16 09:24:13 UTC (rev 25100)
+++ scummvm/trunk/engines/agi/keyboard.cpp 2007-01-16 12:40:51 UTC (rev 25101)
@@ -35,7 +35,7 @@
/*
* IBM-PC keyboard scancodes
*/
-uint8 scancode_table[26] = {
+uint8 scancodeTable[26] = {
30, /* A */
48, /* B */
46, /* C */
@@ -64,21 +64,21 @@
44 /* Z */
};
-void AgiEngine::init_words() {
- game.num_ego_words = 0;
+void AgiEngine::initWords() {
+ _game.numEgoWords = 0;
}
-void AgiEngine::clean_input() {
- while (game.num_ego_words)
- free(game.ego_words[--game.num_ego_words].word);
+void AgiEngine::cleanInput() {
+ while (_game.numEgoWords)
+ free(_game.egoWords[--_game.numEgoWords].word);
}
-void AgiEngine::get_string(int x, int y, int len, int str) {
- new_input_mode(INPUT_GETSTRING);
- stringdata.x = x;
- stringdata.y = y;
- stringdata.len = len;
- stringdata.str = str;
+void AgiEngine::getString(int x, int y, int len, int str) {
+ newInputMode(INPUT_GETSTRING);
+ _stringdata.x = x;
+ _stringdata.y = y;
+ _stringdata.len = len;
+ _stringdata.str = str;
}
/**
@@ -87,7 +87,7 @@
* It handles console keys and insulates AGI from the console. In the main
* loop, handle_keys() handles keyboard input and ego movement.
*/
-int AgiEngine::do_poll_keyboard() {
+int AgiEngine::doPollKeyboard() {
int key = 0;
/* If a key is ready, rip it */
@@ -99,8 +99,8 @@
return key;
}
-int AgiEngine::handle_controller(int key) {
- struct vt_entry *v = &game.view_table[0];
+int AgiEngine::handleController(int key) {
+ struct VtEntry *v = &_game.viewTable[0];
int i;
/* The Black Cauldron needs KEY_ESCAPE to use menus */
@@ -110,22 +110,22 @@
debugC(3, kDebugLevelInput, "key = %04x", key);
for (i = 0; i < MAX_DIRS; i++) {
- if (game.ev_keyp[i].data == key) {
+ if (_game.evKeyp[i].data == key) {
debugC(3, kDebugLevelInput, "event %d: key press", i);
- game.ev_keyp[i].occured = true;
+ _game.evKeyp[i].occured = true;
report("event AC:%i occured\n", i);
return true;
}
}
if (key == BUTTON_LEFT) {
- if (getflag(F_menus_work) && g_mouse.y <= CHAR_LINES) {
- new_input_mode(INPUT_MENU);
+ if (getflag(fMenusWork) && g_mouse.y <= CHAR_LINES) {
+ newInputMode(INPUT_MENU);
return true;
}
}
- if (game.player_control) {
+ if (_game.playerControl) {
int d = 0;
if (!KEY_ASCII(key)) {
@@ -158,16 +158,16 @@
}
if (key == BUTTON_LEFT &&
- (int)g_mouse.y >= game.line_user_input * CHAR_LINES &&
- (int)g_mouse.y <= (game.line_user_input + 1) * CHAR_LINES) {
+ (int)g_mouse.y >= _game.lineUserInput * CHAR_LINES &&
+ (int)g_mouse.y <= (_game.lineUserInput + 1) * CHAR_LINES) {
if (predictiveDialog()) {
- strcpy((char *)game.input_buffer, _predictiveResult);
- handle_keys(KEY_ENTER);
+ strcpy((char *)_game.inputBuffer, _predictiveResult);
+ handleKeys(KEY_ENTER);
}
return true;
}
- if (!opt.agimouse) {
+ if (!_opt.agimouse) {
/* Handle mouse button events */
if (key == BUTTON_LEFT) {
v->flags |= ADJ_EGO_XY;
@@ -188,7 +188,7 @@
return false;
}
-void AgiEngine::handle_getstring(int key) {
+void AgiEngine::handleGetstring(int key) {
static int pos = 0; /* Cursor position */
static char buf[40];
@@ -199,42 +199,42 @@
switch (key) {
case BUTTON_LEFT:
- if ((int)g_mouse.y >= stringdata.y * CHAR_LINES &&
- (int)g_mouse.y <= (stringdata.y + 1) * CHAR_LINES) {
+ if ((int)g_mouse.y >= _stringdata.y * CHAR_LINES &&
+ (int)g_mouse.y <= (_stringdata.y + 1) * CHAR_LINES) {
if (predictiveDialog()) {
- strcpy(game.strings[stringdata.str], _predictiveResult);
- new_input_mode(INPUT_NORMAL);
- _gfx->printCharacter(stringdata.x + strlen(game.strings[stringdata.str]) + 1,
- stringdata.y, ' ', game.color_fg, game.color_bg);
+ strcpy(_game.strings[_stringdata.str], _predictiveResult);
+ newInputMode(INPUT_NORMAL);
+ _gfx->printCharacter(_stringdata.x + strlen(_game.strings[_stringdata.str]) + 1,
+ _stringdata.y, ' ', _game.colorFg, _game.colorBg);
return;
}
}
break;
case KEY_ENTER:
debugC(3, kDebugLevelInput, "KEY_ENTER");
- game.has_prompt = 0;
+ _game.hasPrompt = 0;
buf[pos] = 0;
- strcpy(game.strings[stringdata.str], buf);
+ strcpy(_game.strings[_stringdata.str], buf);
debugC(3, kDebugLevelInput, "buffer=[%s]", buf);
buf[pos = 0] = 0;
- new_input_mode(INPUT_NORMAL);
- _gfx->printCharacter(stringdata.x + strlen(game.strings[stringdata.str]) + 1,
- stringdata.y, ' ', game.color_fg, game.color_bg);
+ newInputMode(INPUT_NORMAL);
+ _gfx->printCharacter(_stringdata.x + strlen(_game.strings[_stringdata.str]) + 1,
+ _stringdata.y, ' ', _game.colorFg, _game.colorBg);
return;
case KEY_ESCAPE:
debugC(3, kDebugLevelInput, "KEY_ESCAPE");
- game.has_prompt = 0;
+ _game.hasPrompt = 0;
buf[pos = 0] = 0;
- strcpy(game.strings[stringdata.str], buf);
- new_input_mode(INPUT_NORMAL);
- /* new_input_mode (INPUT_MENU); */
+ strcpy(_game.strings[_stringdata.str], buf);
+ newInputMode(INPUT_NORMAL);
+ /* newInputMode(INPUT_MENU); */
break;
case KEY_BACKSPACE: /*0x08: */
if (!pos)
break;
- _gfx->printCharacter(stringdata.x + (pos + 1), stringdata.y,
- ' ', game.color_fg, game.color_bg);
+ _gfx->printCharacter(_stringdata.x + (pos + 1), _stringdata.y,
+ ' ', _game.colorFg, _game.colorBg);
pos--;
buf[pos] = 0;
break;
@@ -242,42 +242,42 @@
if (key < 0x20 || key > 0x7f)
break;
- if (pos >= stringdata.len)
+ if (pos >= _stringdata.len)
break;
buf[pos++] = key;
buf[pos] = 0;
/* Echo */
- _gfx->printCharacter(stringdata.x + pos, stringdata.y, buf[pos - 1],
- game.color_fg, game.color_bg);
+ _gfx->printCharacter(_stringdata.x + pos, _stringdata.y, buf[pos - 1],
+ _game.colorFg, _game.colorBg);
break;
}
/* print cursor */
- _gfx->printCharacter(stringdata.x + pos + 1, stringdata.y,
- (char)game.cursor_char, game.color_fg, game.color_bg);
+ _gfx->printCharacter(_stringdata.x + pos + 1, _stringdata.y,
+ (char)_game.cursorChar, _game.colorFg, _game.colorBg);
}
-void AgiEngine::handle_keys(int key) {
+void AgiEngine::handleKeys(int key) {
uint8 *p = NULL;
int c = 0;
- static uint8 formated_entry[256];
- int l = game.line_user_input;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list