diff options
46 files changed, 546 insertions, 547 deletions
diff --git a/sword2/anims.cpp b/sword2/anims.cpp index 530b13b45b..fe57177af8 100644 --- a/sword2/anims.cpp +++ b/sword2/anims.cpp @@ -74,21 +74,21 @@ int32 Logic::animate(int32 *params, bool reverse) { // 1 pointer to object's graphic structure // 2 resource id of animation file - Object_logic *ob_logic; - Object_graphic *ob_graphic; + ObjectLogic *ob_logic; + ObjectGraphic *ob_graphic; uint8 *anim_file; - _animHeader *anim_head; + AnimHeader *anim_head; int32 res = params[2]; #ifdef _SWORD2_DEBUG // for animation testing & checking for correct file type - _standardHeader *head; + StandardHeader *head; #endif // read the main parameters - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); - ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[1]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); + ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[1]); if (ob_logic->looping == 0) { // This is the start of the anim - set up the first frame @@ -107,7 +107,7 @@ int32 Logic::animate(int32 *params, bool reverse) { if (_resman->Res_check_valid(res)) { // Open the resource. Can close it immediately. // We've got a pointer to the header. - head = (_standardHeader *) _resman->openResource(res); + head = (StandardHeader *) _resman->openResource(res); _resman->closeResource(res); // if it's not an animation file @@ -142,7 +142,7 @@ int32 Logic::animate(int32 *params, bool reverse) { #ifdef _SWORD2_DEBUG // check this this resource is actually an animation file! - head = (_standardHeader *) anim_file; + head = (StandardHeader *) anim_file; if (head->fileType != ANIMATION_FILE) error("animate: %s (%d) is not an anim!", _vm->fetchObjectName(res), res); #endif @@ -209,18 +209,18 @@ int32 Logic::megaTableAnimate(int32 *params, bool reverse) { // 2 pointer to object's mega structure // 3 pointer to animation table - Object_logic *ob_logic; - Object_mega *ob_mega; + ObjectLogic *ob_logic; + ObjectMega *ob_mega; uint32 *anim_table; int32 pars[5]; // if this is the start of the anim, read the anim table to get the // appropriate anim resource - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); anim_table = (uint32 *) _vm->_memory->intToPtr(params[3]); // appropriate anim resource is in 'table[direction]' @@ -243,14 +243,14 @@ int32 Logic::fnSetFrame(int32 *params) { // 1 resource id of animation file // 2 frame flag (0=first 1=last) - Object_graphic *ob_graphic; + ObjectGraphic *ob_graphic; uint8 *anim_file; - _animHeader *anim_head; + AnimHeader *anim_head; int32 res = params[1]; #ifdef _SWORD2_DEBUG // for checking for correct file type - _standardHeader *head; + StandardHeader *head; #endif #ifdef _SWORD2_DEBUG @@ -265,7 +265,7 @@ int32 Logic::fnSetFrame(int32 *params) { #ifdef _SWORD2_DEBUG // check this this resource is actually an animation file! - head = (_standardHeader *) anim_file; + head = (StandardHeader *) anim_file; if (head->fileType != ANIMATION_FILE) error("fnSetFrame: %s (%d) is not an anim!", _vm->fetchObjectName(res), res); #endif @@ -281,7 +281,7 @@ int32 Logic::fnSetFrame(int32 *params) { // set up anim resource in graphic object - ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); ob_graphic->anim_resource = res; if (params[2]) @@ -298,7 +298,7 @@ int32 Logic::fnSetFrame(int32 *params) { int32 Logic::fnNoSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -311,7 +311,7 @@ int32 Logic::fnNoSprite(int32 *params) { int32 Logic::fnBackPar0Sprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -324,7 +324,7 @@ int32 Logic::fnBackPar0Sprite(int32 *params) { int32 Logic::fnBackPar1Sprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -337,7 +337,7 @@ int32 Logic::fnBackPar1Sprite(int32 *params) { int32 Logic::fnBackSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -350,7 +350,7 @@ int32 Logic::fnBackSprite(int32 *params) { int32 Logic::fnSortSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -363,7 +363,7 @@ int32 Logic::fnSortSprite(int32 *params) { int32 Logic::fnForeSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -376,7 +376,7 @@ int32 Logic::fnForeSprite(int32 *params) { int32 Logic::fnForePar0Sprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -389,7 +389,7 @@ int32 Logic::fnForePar0Sprite(int32 *params) { int32 Logic::fnForePar1Sprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0xffff0000; @@ -402,7 +402,7 @@ int32 Logic::fnForePar1Sprite(int32 *params) { int32 Logic::fnShadedSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0x0000ffff; @@ -418,7 +418,7 @@ int32 Logic::fnShadedSprite(int32 *params) { int32 Logic::fnUnshadedSprite(int32 *params) { // params: 0 pointer to object's graphic structure - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); // remove previous status (but don't affect the shading upper-word) ob_graphic->type &= 0x0000ffff; @@ -432,16 +432,16 @@ int32 Logic::fnUnshadedSprite(int32 *params) { // 1st param is filename of sequence file // 2nd param is a pointer to a null-terminated array of pointers to -// _movieTextObject structures +// MovieTextObject structures -//int32 PlaySmacker(char *filename, _movieTextObject *textObjects[]); +//int32 PlaySmacker(char *filename, MovieTextObject *textObjects[]); -// typedef struct { +// struct MovieTextObject { // uint16 startFrame; // uint16 endFrame; -// _spriteInfo *textSprite; +// SpriteInfo *textSprite; // _wavHeader *speech; -// } _movieTextObject; +// }; int32 Logic::fnAddSequenceText(int32 *params) { // params: 0 text number @@ -459,9 +459,9 @@ int32 Logic::fnAddSequenceText(int32 *params) { return IR_CONT; } -void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { +void Logic::createSequenceSpeech(MovieTextObject *sequenceText[]) { uint32 line; - _frameHeader *frame; + FrameHeader *frame; uint32 local_text; uint32 text_res; uint8 *text; @@ -472,7 +472,7 @@ void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { // for each sequence text line that's been logged for (line = 0; line < _sequenceTextLines; line++) { // allocate this structure - sequenceText[line] = new _movieTextObject; + sequenceText[line] = new MovieTextObject; sequenceText[line]->startFrame = _sequenceTextList[line].startFrame; sequenceText[line]->endFrame = _sequenceTextList[line].endFrame; @@ -549,7 +549,7 @@ void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { } // for drivers: NULL-terminate the array of pointers to - // _movieTextObject's + // MovieTextObject's sequenceText[_sequenceTextLines] = NULL; // now lock all the memory blocks containing text sprites & speech @@ -561,12 +561,12 @@ void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { if (_sequenceTextList[line].text_mem) { _vm->_memory->lockMemory(_sequenceTextList[line].text_mem); - // now fill out the _spriteInfo structure in the - // _movieTextObjectStructure + // now fill out the SpriteInfo structure in the + // MovieTextObjectStructure - frame = (_frameHeader *) _sequenceTextList[line].text_mem->ad; + frame = (FrameHeader *) _sequenceTextList[line].text_mem->ad; - sequenceText[line]->textSprite = new _spriteInfo; + sequenceText[line]->textSprite = new SpriteInfo; // center text at bottom of screen sequenceText[line]->textSprite->x = 320 - frame->width / 2; @@ -574,7 +574,7 @@ void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { sequenceText[line]->textSprite->w = frame->width; sequenceText[line]->textSprite->h = frame->height; sequenceText[line]->textSprite->type = RDSPR_DISPLAYALIGN | RDSPR_NOCOMPRESSION; - sequenceText[line]->textSprite->data = _sequenceTextList[line].text_mem->ad + sizeof(_frameHeader); + sequenceText[line]->textSprite->data = _sequenceTextList[line].text_mem->ad + sizeof(FrameHeader); } // if we've loaded a speech sample for this line... @@ -589,11 +589,11 @@ void Logic::createSequenceSpeech(_movieTextObject *sequenceText[]) { } } -void Logic::clearSequenceSpeech(_movieTextObject *sequenceText[]) { +void Logic::clearSequenceSpeech(MovieTextObject *sequenceText[]) { uint32 line; for (line = 0; line < _sequenceTextLines; line++) { - // free up the memory used by this _movieTextObject + // free up the memory used by this MovieTextObject delete sequenceText[line]; // free up the mem block containing this text sprite @@ -613,7 +613,7 @@ int32 Logic::fnSmackerLeadIn(int32 *params) { uint8 *leadIn; uint32 rv; #ifdef _SWORD2_DEBUG - _standardHeader *header; + StandardHeader *header; #endif // params: 0 id of lead-in music @@ -621,12 +621,12 @@ int32 Logic::fnSmackerLeadIn(int32 *params) { leadIn = _vm->_resman->openResource(params[0]); #ifdef _SWORD2_DEBUG - header = (_standardHeader *) leadIn; + header = (StandardHeader *) leadIn; if (header->fileType != WAV_FILE) error("fnSmackerLeadIn() given invalid resource"); #endif - leadIn += sizeof(_standardHeader); + leadIn += sizeof(StandardHeader); // wav data gets copied to sound memory rv = _vm->_sound->playFx(0, leadIn, 0, 0, RDSE_FXLEADIN); @@ -658,11 +658,11 @@ int32 Logic::fnPlaySequence(int32 *params) { char filename[30]; uint32 rv; - _movieTextObject *sequenceSpeechArray[MAX_SEQUENCE_TEXT_LINES + 1]; + MovieTextObject *sequenceSpeechArray[MAX_SEQUENCE_TEXT_LINES + 1]; uint8 *leadOut = NULL; #ifdef _SWORD2_DEBUG - _standardHeader *header; + StandardHeader *header; #endif // The original code had some #ifdef blocks for skipping or muting the @@ -696,12 +696,12 @@ int32 Logic::fnPlaySequence(int32 *params) { leadOut = _vm->_resman->openResource(_smackerLeadOut); #ifdef _SWORD2_DEBUG - header = (_standardHeader *) leadOut; + header = (StandardHeader *) leadOut; if (header->fileType != WAV_FILE) error("fnSmackerLeadOut() given invalid resource"); #endif - leadOut += sizeof(_standardHeader); + leadOut += sizeof(StandardHeader); } // play the smacker @@ -745,9 +745,9 @@ int32 Logic::fnPlaySequence(int32 *params) { // zero the entire palette in case we're about to fade up! - _palEntry pal[256]; + PalEntry pal[256]; - memset(pal, 0, 256 * sizeof(_palEntry)); + memset(pal, 0, 256 * sizeof(PalEntry)); _vm->_graphics->setPalette(0, 256, (uint8 *) pal, RDPAL_INSTANT); debug(5, "fnPlaySequence FINISHED"); diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index fe611781cd..709f221012 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -30,7 +30,7 @@ namespace Sword2 { void Sword2Engine::buildDisplay(void) { uint8 *file; - _multiScreenHeader *screenLayerTable; + MultiScreenHeader *screenLayerTable; if (_thisScreen.new_palette) { // start the layer palette fading up @@ -63,7 +63,7 @@ void Sword2Engine::buildDisplay(void) { // open the screen resource file = _resman->openResource(_thisScreen.background_layer_id); - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); if (screenLayerTable->bg_parallax[0]) { _graphics->renderParallax(fetchBackgroundParallaxLayer(file, 0), 0); @@ -80,7 +80,7 @@ void Sword2Engine::buildDisplay(void) { // open the screen resource file = _resman->openResource(_thisScreen.background_layer_id); - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); if (screenLayerTable->bg_parallax[1]) { _graphics->renderParallax(fetchBackgroundParallaxLayer(file, 1), 1); @@ -112,7 +112,7 @@ void Sword2Engine::buildDisplay(void) { // open the screen resource file = _resman->openResource(_thisScreen.background_layer_id); - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); if (screenLayerTable->fg_parallax[0]) { _graphics->renderParallax(fetchForegroundParallaxLayer(file, 0), 3); @@ -129,7 +129,7 @@ void Sword2Engine::buildDisplay(void) { // open the screen resource file = _resman->openResource(_thisScreen.background_layer_id); - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); if (screenLayerTable->fg_parallax[1]) { _graphics->renderParallax(fetchForegroundParallaxLayer(file, 1), 4); @@ -188,11 +188,11 @@ void Sword2Engine::buildDisplay(void) { // void Sword2Engine::displayMsg(uint8 *text, int time) { - mem *text_spr; - _frameHeader *frame; - _spriteInfo spriteInfo; - _palEntry pal[256]; - _palEntry oldPal[256]; + Memory *text_spr; + FrameHeader *frame; + SpriteInfo spriteInfo; + PalEntry pal[256]; + PalEntry oldPal[256]; uint32 rv; // drivers error return value debug(2, "DisplayMsg: %s", (char *) text); @@ -210,7 +210,7 @@ void Sword2Engine::displayMsg(uint8 *text, int time) { text_spr = _fontRenderer->makeTextSprite(text, 640, 187, _speechFontId); - frame = (_frameHeader *) text_spr->ad; + frame = (FrameHeader *) text_spr->ad; spriteInfo.x = _graphics->_screenWide / 2 - frame->width / 2; if (!time) @@ -224,16 +224,16 @@ void Sword2Engine::displayMsg(uint8 *text, int time) { spriteInfo.scaledHeight = 0; spriteInfo.type = RDSPR_DISPLAYALIGN | RDSPR_NOCOMPRESSION | RDSPR_TRANS; spriteInfo.blend = 0; - spriteInfo.data = text_spr->ad + sizeof(_frameHeader); + spriteInfo.data = text_spr->ad + sizeof(FrameHeader); spriteInfo.colourTable = 0; rv = _graphics->drawSprite(&spriteInfo); if (rv) error("Driver Error %.8x (in DisplayMsg)", rv); - memcpy((char *) oldPal, (char *) _graphics->_palCopy, 256 * sizeof(_palEntry)); + memcpy((char *) oldPal, (char *) _graphics->_palCopy, 256 * sizeof(PalEntry)); - memset(pal, 0, 256 * sizeof(_palEntry)); + memset(pal, 0, 256 * sizeof(PalEntry)); pal[187].red = 255; pal[187].green = 255; pal[187].blue = 255; @@ -298,9 +298,9 @@ void Sword2Engine::sendSortFrames(void) { // could be none at all - theoretically at least for (uint i = 0; i < _curSort; i++) { if (_sortList[_sortOrder[i]].layer_number) { - // its a layer - minus 1 for true layer number - // we need to know from the buildit because the layers - // will have been sorted in random order + // it's a layer - minus 1 for true layer number + // we need to know from the BuildUnit because the + // layers will have been sorted in random order processLayer(_sortList[_sortOrder[i]].layer_number - 1); } else { // sprite @@ -334,8 +334,8 @@ void Sword2Engine::sendForePar1Frames(void) { void Sword2Engine::processLayer(uint32 layer_number) { uint8 *file; - _layerHeader *layer_head; - _spriteInfo spriteInfo; + LayerHeader *layer_head; + SpriteInfo spriteInfo; uint32 rv; uint32 current_layer_area = 0; @@ -355,7 +355,7 @@ void Sword2Engine::processLayer(uint32 layer_number) { spriteInfo.h = layer_head->height; spriteInfo.type = RDSPR_TRANS | RDSPR_RLE256FAST; spriteInfo.blend = 0; - spriteInfo.data = file + sizeof(_standardHeader) + layer_head->offset; + spriteInfo.data = file + sizeof(StandardHeader) + layer_head->offset; spriteInfo.colourTable = 0; // check for largest layer for debug info @@ -377,12 +377,12 @@ void Sword2Engine::processLayer(uint32 layer_number) { _resman->closeResource(_thisScreen.background_layer_id); } -void Sword2Engine::processImage(buildit *build_unit) { +void Sword2Engine::processImage(BuildUnit *build_unit) { uint8 *file, *colTablePtr = NULL; - _animHeader *anim_head; - _frameHeader *frame_head; - _cdtEntry *cdt_entry; - _spriteInfo spriteInfo; + AnimHeader *anim_head; + FrameHeader *frame_head; + CdtEntry *cdt_entry; + SpriteInfo spriteInfo; uint32 spriteType; uint32 rv; @@ -431,7 +431,7 @@ void Sword2Engine::processImage(buildit *build_unit) { spriteType |= RDSPR_RLE16; // points to just after last cdt_entry, ie. // start of colour table - colTablePtr = (uint8 *) (anim_head + 1) + anim_head->noAnimFrames * sizeof(_cdtEntry); + colTablePtr = (uint8 *) (anim_head + 1) + anim_head->noAnimFrames * sizeof(CdtEntry); break; } } @@ -544,24 +544,24 @@ void Sword2Engine::sortTheSortList(void) { } } -void Sword2Engine::registerFrame(int32 *params, buildit *build_unit) { +void Sword2Engine::registerFrame(int32 *params, BuildUnit *build_unit) { // params: 0 pointer to mouse structure or NULL for no write to mouse // list (non-zero means write sprite-shape to mouse list) // 1 pointer to graphic structure // 2 pointer to mega structure - Object_mega *ob_mega; - Object_graphic *ob_graph; - Object_mouse *ob_mouse; + ObjectMega *ob_mega; + ObjectGraphic *ob_graph; + ObjectMouse *ob_mouse; uint8 *file; - _frameHeader *frame_head; - _animHeader *anim_head; - _cdtEntry *cdt_entry; + FrameHeader *frame_head; + AnimHeader *anim_head; + CdtEntry *cdt_entry; int scale = 0; // open animation file & set up the necessary pointers - ob_graph = (Object_graphic *) _memory->intToPtr(params[1]); + ob_graph = (ObjectGraphic *) _memory->intToPtr(params[1]); assert(ob_graph->anim_resource); @@ -580,7 +580,7 @@ void Sword2Engine::registerFrame(int32 *params, buildit *build_unit) { _debugger->_playerGraphicNoFrames = anim_head->noAnimFrames; } - // fill in the buildit structure for this frame + // fill in the BuildUnit structure for this frame // retrieve the resource build_unit->anim_resource = ob_graph->anim_resource; @@ -599,7 +599,7 @@ void Sword2Engine::registerFrame(int32 *params, buildit *build_unit) { if (cdt_entry->frameType & FRAME_OFFSET) { // param 2 is pointer to mega structure - ob_mega = (Object_mega *) _memory->intToPtr(params[2]); + ob_mega = (ObjectMega *) _memory->intToPtr(params[2]); // calc scale at which to print the sprite, based on feet // y-coord & scaling constants (NB. 'scale' is actually @@ -640,7 +640,7 @@ void Sword2Engine::registerFrame(int32 *params, buildit *build_unit) { if (params[0]) { // passed a mouse structure, so add to the _mouseList - ob_mouse = (Object_mouse *) _memory->intToPtr(params[0]); + ob_mouse = (ObjectMouse *) _memory->intToPtr(params[0]); // only if 'pointer' isn't NULL if (ob_mouse->pointer) { @@ -691,7 +691,7 @@ int32 Logic::fnRegisterFrame(int32 *params) { } int32 Sword2Engine::registerFrame(int32 *params) { - Object_graphic *ob_graph = (Object_graphic *) _memory->intToPtr(params[1]); + ObjectGraphic *ob_graph = (ObjectGraphic *) _memory->intToPtr(params[1]); // check low word for sprite type switch (ob_graph->type & 0x0000ffff) { @@ -773,7 +773,7 @@ int32 Logic::fnUpdatePlayerStats(int32 *params) { // params: 0 pointer to mega structure - Object_mega *ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[0]); + ObjectMega *ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[0]); _vm->_thisScreen.player_feet_x = ob_mega->feet_x; _vm->_thisScreen.player_feet_y = ob_mega->feet_y; @@ -823,7 +823,7 @@ int32 Logic::fnSetPalette(int32 *params) { void Sword2Engine::setFullPalette(int32 palRes) { uint8 *file; - _standardHeader *head; + StandardHeader *head; // fudge for hut interior // - unpausing should restore last palette as normal (could be screen @@ -857,7 +857,7 @@ void Sword2Engine::setFullPalette(int32 palRes) { // non-zero: set palette to this separate palette file if (palRes) { // open the palette file - head = (_standardHeader *) _resman->openResource(palRes); + head = (StandardHeader *) _resman->openResource(palRes); assert(head->fileType == PALETTE_FILE); diff --git a/sword2/console.h b/sword2/console.h index c35c251db6..1614fc438d 100644 --- a/sword2/console.h +++ b/sword2/console.h @@ -67,7 +67,7 @@ public: int32 _textNumber; - Object_graphic _playerGraphic; + ObjectGraphic _playerGraphic; uint32 _playerGraphicNoFrames; void buildDebugText(void); diff --git a/sword2/controls.cpp b/sword2/controls.cpp index a2c3c8e684..f06977b0dd 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -69,7 +69,7 @@ class Widget { protected: Dialog *_parent; - _spriteInfo *_sprites; + SpriteInfo *_sprites; struct WidgetSurface { uint8 *_surface; @@ -108,7 +108,7 @@ public: virtual void onMouseUp(int x, int y) {} virtual void onWheelUp(int x, int y) {} virtual void onWheelDown(int x, int y) {} - virtual void onKey(_keyboardEvent *ke) {} + virtual void onKey(KeyboardEvent *ke) {} virtual void onTick() {} virtual void releaseMouse(int x, int y) {} @@ -154,13 +154,13 @@ public: FontRendererGui::FontRendererGui(Gui *gui, int fontId) : _gui(gui), _fontId(fontId) { uint8 *font = _gui->_vm->_resman->openResource(fontId); - _frameHeader *head; - _spriteInfo sprite; + FrameHeader *head; + SpriteInfo sprite; sprite.type = RDSPR_NOCOMPRESSION | RDSPR_TRANS; for (int i = 0; i < SIZE_OF_CHAR_SET; i++) { - head = (_frameHeader *) _gui->_vm->fetchFrameHeader(font, i); + head = (FrameHeader *) _gui->_vm->fetchFrameHeader(font, i); sprite.data = (uint8 *) (head + 1); sprite.w = head->width; sprite.h = head->height; @@ -206,7 +206,7 @@ int FontRendererGui::getTextWidth(int textId) { } void FontRendererGui::drawText(char *text, int x, int y, int alignment) { - _spriteInfo sprite; + SpriteInfo sprite; int i; if (alignment != kAlignLeft) { @@ -288,8 +288,8 @@ int Dialog::run() { int16 newMouseX = _gui->_vm->_input->_mouseX; int16 newMouseY = _gui->_vm->_input->_mouseY + 40; - _mouseEvent *me = _gui->_vm->_input->mouseEvent(); - _keyboardEvent ke; + MouseEvent *me = _gui->_vm->_input->mouseEvent(); + KeyboardEvent ke; int32 keyboardStatus = _gui->_vm->_input->readKey(&ke); if (keyboardStatus == RD_OK) { @@ -381,7 +381,7 @@ int Dialog::run() { Widget::Widget(Dialog *parent, int states) : _parent(parent), _numStates(states), _state(0) { - _sprites = (_spriteInfo *) calloc(states, sizeof(_spriteInfo)); + _sprites = (SpriteInfo *) calloc(states, sizeof(SpriteInfo)); _surfaces = (WidgetSurface *) calloc(states, sizeof(WidgetSurface)); _hitRect.left = _hitRect.right = _hitRect.top = _hitRect.bottom = -1; @@ -398,9 +398,9 @@ Widget::~Widget() { void Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc) { uint8 *file, *colTablePtr = NULL; - _animHeader *anim_head; - _frameHeader *frame_head; - _cdtEntry *cdt_entry; + AnimHeader *anim_head; + FrameHeader *frame_head; + CdtEntry *cdt_entry; uint32 spriteType = RDSPR_TRANS; // open anim resource file, point to base @@ -430,7 +430,7 @@ void Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc) // Points to just after last cdt_entry, i.e. start of colour // table colTablePtr = (uint8 *) (anim_head + 1) + - anim_head->noAnimFrames * sizeof(_cdtEntry); + anim_head->noAnimFrames * sizeof(CdtEntry); break; } @@ -1077,7 +1077,7 @@ public: _parent->onAction(this, kWheelDown); } - virtual void onKey(_keyboardEvent *ke) { + virtual void onKey(KeyboardEvent *ke) { if (_editable) { if (ke->keycode == 8) _parent->onAction(this, 8); @@ -1415,7 +1415,7 @@ public: } else { // Prime system with a game cycle - // Reset the graphic 'buildit' list before a + // Reset the graphic 'BuildUnit' list before a // new logic list (see fnRegisterFrame) _gui->_vm->resetRenderLists(); @@ -1438,12 +1438,12 @@ void SaveLoadDialog::saveLoadError(char* text) { // Wait for ESC or mouse click while (1) { - _mouseEvent *me; + MouseEvent *me; _gui->_vm->_graphics->updateDisplay(); if (_gui->_vm->_input->keyWaiting()) { - _keyboardEvent ke; + KeyboardEvent ke; _gui->_vm->_input->readKey(&ke); if (ke.keycode == 27) @@ -1566,7 +1566,7 @@ void Gui::restartControl(void) { // Reopen global variables resource & send address to interpreter - // it won't be moving - _vm->_logic->setGlobalInterpreterVariables((int32 *) (_vm->_resman->openResource(1) + sizeof(_standardHeader))); + _vm->_logic->setGlobalInterpreterVariables((int32 *) (_vm->_resman->openResource(1) + sizeof(StandardHeader))); _vm->_resman->closeResource(1); DEMO = temp_demo_flag; @@ -1579,7 +1579,7 @@ void Gui::restartControl(void) { // Prime system with a game cycle - // Reset the graphic 'buildit' list before a new logic list + // Reset the graphic 'BuildUnit' list before a new logic list // (see fnRegisterFrame) _vm->resetRenderLists(); diff --git a/sword2/debug.cpp b/sword2/debug.cpp index e8351b54ea..e76423181a 100644 --- a/sword2/debug.cpp +++ b/sword2/debug.cpp @@ -268,7 +268,7 @@ void Debugger::buildDebugText(void) { showVarPos = 115; // y-coord for first showVar // res 1 is the global variables resource - varTable = (int32 *) (_vm->_resman->openResource(1) + sizeof(_standardHeader)); + varTable = (int32 *) (_vm->_resman->openResource(1) + sizeof(StandardHeader)); for (showVarNo = 0; showVarNo < MAX_SHOWVARS; showVarNo++) { varNo = _showVar[showVarNo]; // get variable number diff --git a/sword2/defs.h b/sword2/defs.h index 29f7022d20..4b6bbf9eff 100644 --- a/sword2/defs.h +++ b/sword2/defs.h @@ -26,7 +26,7 @@ // global variable references // NB. 4 * <number from linc's Global Variables list> -#define VAR(n) (*(uint32 *) (g_sword2->_resman->_resList[1]->ad + sizeof(_standardHeader) + 4 * (n))) +#define VAR(n) (*(uint32 *) (g_sword2->_resman->_resList[1]->ad + sizeof(StandardHeader) + 4 * (n))) #define ID VAR(0) #define RESULT VAR(1) diff --git a/sword2/driver/_mouse.cpp b/sword2/driver/_mouse.cpp index a53feb448c..a5743609a5 100644 --- a/sword2/driver/_mouse.cpp +++ b/sword2/driver/_mouse.cpp @@ -48,8 +48,8 @@ bool Input::checkForMouseEvents(void) { * @return a pointer to the mouse event, or NULL of there is none */ -_mouseEvent *Input::mouseEvent(void) { - _mouseEvent *me; +MouseEvent *Input::mouseEvent(void) { + MouseEvent *me; if (_mouseBacklog) { me = &_mouseLog[_mouseLogPos]; @@ -211,12 +211,12 @@ int32 Graphics::setMouseAnim(uint8 *ma, int32 size, int32 mouseFlash) { else _mouseFrame = MOUSEFLASHFRAME; - _mouseAnim = (struct _mouseAnim *) malloc(size); + _mouseAnim = (MouseAnim *) malloc(size); if (!_mouseAnim) return RDERR_OUTOFMEMORY; memcpy((uint8 *) _mouseAnim, ma, size); - _mouseOffsets = (int32 *) ((uint8 *) _mouseAnim + sizeof(struct _mouseAnim)); + _mouseOffsets = (int32 *) ((uint8 *) _mouseAnim + sizeof(MouseAnim)); animateMouse(); drawMouse(); @@ -246,12 +246,12 @@ int32 Graphics::setLuggageAnim(uint8 *ma, int32 size) { } if (ma) { - _luggageAnim = (struct _mouseAnim *) malloc(size); + _luggageAnim = (MouseAnim *) malloc(size); if (!_luggageAnim) return RDERR_OUTOFMEMORY; memcpy((uint8 *) _luggageAnim, ma, size); - _luggageOffset = (int32 *) ((uint8 *) _luggageAnim + sizeof(struct _mouseAnim)); + _luggageOffset = (int32 *) ((uint8 *) _luggageAnim + sizeof(MouseAnim)); animateMouse(); drawMouse(); diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index 928de7bf71..28e57a2709 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -92,19 +92,19 @@ void Graphics::clearScene(void) { memset(_buffer + MENUDEEP * _screenWide, 0, _screenWide * RENDERDEEP); } -void MoviePlayer::openTextObject(_movieTextObject *obj) { +void MoviePlayer::openTextObject(MovieTextObject *obj) { if (obj->textSprite) _vm->_graphics->createSurface(obj->textSprite, &_textSurface); } -void MoviePlayer::closeTextObject(_movieTextObject *obj) { +void MoviePlayer::closeTextObject(MovieTextObject *obj) { if (_textSurface) { _vm->_graphics->deleteSurface(_textSurface); _textSurface = NULL; } } -void MoviePlayer::drawTextObject(_movieTextObject *obj) { +void MoviePlayer::drawTextObject(MovieTextObject *obj) { if (obj->textSprite && _textSurface) _vm->_graphics->drawSurface(obj->textSprite, _textSurface); } @@ -116,7 +116,7 @@ void MoviePlayer::drawTextObject(_movieTextObject *obj) { * @param musicOut lead-out music */ -int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOut) { +int32 MoviePlayer::play(char *filename, MovieTextObject *text[], uint8 *musicOut) { warning("semi-stub PlaySmacker %s", filename); // WORKAROUND: For now, we just do the voice-over parts of the @@ -136,9 +136,9 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu memset(_vm->_graphics->_buffer, 0, _vm->_graphics->_screenWide * MENUDEEP); uint8 msg[] = "Cutscene - Press ESC to exit"; - mem *data = _vm->_fontRenderer->makeTextSprite(msg, 640, 255, _vm->_speechFontId); - _frameHeader *frame = (_frameHeader *) data->ad; - _spriteInfo msgSprite; + Memory *data = _vm->_fontRenderer->makeTextSprite(msg, 640, 255, _vm->_speechFontId); + FrameHeader *frame = (FrameHeader *) data->ad; + SpriteInfo msgSprite; uint8 *msgSurface; msgSprite.x = _vm->_graphics->_screenWide / 2 - frame->width / 2; @@ -146,7 +146,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu msgSprite.w = frame->width; msgSprite.h = frame->height; msgSprite.type = RDSPR_NOCOMPRESSION; - msgSprite.data = data->ad + sizeof(_frameHeader); + msgSprite.data = data->ad + sizeof(FrameHeader); _vm->_graphics->createSurface(&msgSprite, &msgSurface); _vm->_graphics->drawSurface(&msgSprite, msgSurface); @@ -206,7 +206,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu _vm->_graphics->updateDisplay(); - _keyboardEvent ke; + KeyboardEvent ke; if (_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) { _vm->_mixer->stopHandle(handle); diff --git a/sword2/driver/d_draw.h b/sword2/driver/d_draw.h index 387ffdb355..edcd220ac8 100644 --- a/sword2/driver/d_draw.h +++ b/sword2/driver/d_draw.h @@ -45,7 +45,7 @@ namespace Sword2 { #pragma START_PACK_STRUCTS #endif -struct _mouseAnim { +struct MouseAnim { uint8 runTimeComp; // type of runtime compression used for the // frame data uint8 noAnimFrames; // number of frames in the anim @@ -64,19 +64,19 @@ private: Sword2Engine *_vm; uint8 *_textSurface; - void openTextObject(_movieTextObject *obj); - void closeTextObject(_movieTextObject *obj); - void drawTextObject(_movieTextObject *obj); + void openTextObject(MovieTextObject *obj); + void closeTextObject(MovieTextObject *obj); + void drawTextObject(MovieTextObject *obj); public: MoviePlayer(Sword2Engine *vm) : _vm(vm), _textSurface(NULL) {} - int32 play(char *filename, _movieTextObject *text[], uint8 *musicOut); + int32 play(char *filename, MovieTextObject *text[], uint8 *musicOut); }; -typedef struct { +struct BlockSurface { byte data[BLOCKWIDTH * BLOCKHEIGHT]; bool transparent; -} BlockSurface; +}; class Graphics { friend class MoviePlayer; @@ -109,8 +109,8 @@ private: uint8 _mouseFrame; uint8 *_mouseSprite; - struct _mouseAnim *_mouseAnim; - struct _mouseAnim *_luggageAnim; + struct MouseAnim *_mouseAnim; + struct MouseAnim *_luggageAnim; int32 *_mouseOffsets; int32 *_luggageOffset; @@ -222,19 +222,19 @@ public: void initialiseRenderCycle(void); void startRenderCycle(void); bool endRenderCycle(void); - void renderParallax(_parallax *p, int16 layer); + void renderParallax(Parallax *p, int16 layer); void setLocationMetrics(uint16 w, uint16 h); - int32 initialiseBackgroundLayer(_parallax *p); + int32 initialiseBackgroundLayer(Parallax *p); void closeBackgroundLayer(void); void plotPoint(uint16 x, uint16 y, uint8 colour); void drawLine(int16 x1, int16 y1, int16 x2, int16 y2, uint8 colour); - int32 createSurface(_spriteInfo *s, uint8 **surface); - void drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRect = NULL); + int32 createSurface(SpriteInfo *s, uint8 **surface); + void drawSurface(SpriteInfo *s, uint8 *surface, Common::Rect *clipRect = NULL); void deleteSurface(uint8 *surface); - int32 drawSprite(_spriteInfo *s); - int32 openLightMask(_spriteInfo *s); + int32 drawSprite(SpriteInfo *s); + int32 openLightMask(SpriteInfo *s); int32 closeLightMask(void); }; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 082161f7c9..5398aebb8a 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -529,9 +529,9 @@ void Sound::unpauseSpeech(void) { int32 Sound::openFx(int32 id, uint8 *data) { int32 i, fxi; uint32 *data32 = NULL; - _wavHeader *wav; + WavHeader *wav; - wav = (_wavHeader *) data; + wav = (WavHeader *) data; if (_soundOn) { // Check for a valid id. diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h index 068376164d..a9e97317a6 100644 --- a/sword2/driver/d_sound.h +++ b/sword2/driver/d_sound.h @@ -33,7 +33,7 @@ namespace Sword2 { extern void sword2_sound_handler(void *refCon); -typedef struct { +struct FxHandle { int32 _id; bool _paused; int8 _volume; @@ -42,7 +42,7 @@ typedef struct { uint16 *_buf; int32 _bufSize; PlayingSoundHandle _handle; -} FxHandle; +}; class MusicHandle : public AudioInputStream { public: diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index b30370e3eb..8c836ccecf 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -176,21 +176,21 @@ enum { // Structure definitions -typedef struct { +struct MouseEvent { uint16 buttons; -} _mouseEvent; +}; -typedef struct { +struct KeyboardEvent { uint16 ascii; int keycode; int modifiers; -} _keyboardEvent; +}; #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif -struct _parallax { +struct Parallax { uint16 w; uint16 h; uint32 offset[2]; // 2 is arbitrary @@ -200,11 +200,11 @@ struct _parallax { #pragma END_PACK_STRUCTS #endif -// The _spriteInfo structure is used to tell the driver96 code what attributes +// The SpriteInfo structure is used to tell the driver96 code what attributes // are linked to a sprite for drawing. These include position, scaling and // compression. -typedef struct { +struct SpriteInfo { int16 x; // coords for top-left of sprite int16 y; uint16 w; // dimensions of sprite (before scaling) @@ -216,13 +216,13 @@ typedef struct { uint16 blend; // holds the blending values. uint8 *data; // pointer to the sprite data uint8 *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type -} _spriteInfo; +}; // This is the format of a .WAV file. Somewhere after this header is the // string 'DATA' followed by an int32 size which is the size of the data. // Following the size of the data is the data itself. - typedef struct { +struct WavHeader { uint32 riff; uint32 fileLength; uint32 wavID; @@ -236,19 +236,19 @@ typedef struct { uint16 unknown1; uint16 unknown2; uint16 bitsPerSample; -} _wavHeader; +}; // This is the structure which is passed to the sequence player. It includes // the smack to play, and any text lines which are to be displayed over the top // of the sequence. -typedef struct { +struct MovieTextObject { uint16 startFrame; uint16 endFrame; - _spriteInfo *textSprite; + SpriteInfo *textSprite; uint32 speechBufferSize; uint16 *speech; -} _movieTextObject; +}; // Input handling class @@ -264,7 +264,7 @@ private: uint8 _mouseBacklog; uint8 _mouseLogPos; - _mouseEvent _mouseLog[MAX_MOUSE_EVENTS]; + MouseEvent _mouseLog[MAX_MOUSE_EVENTS]; void logMouseEvent(uint16 buttons); @@ -275,7 +275,7 @@ private: uint8 _keyLogPos; // The keyboard buffer - _keyboardEvent _keyBuffer[MAX_KEY_BUFFER]; + KeyboardEvent _keyBuffer[MAX_KEY_BUFFER]; void writeKey(uint16 ascii, int keycode, int modifiers); @@ -289,11 +289,11 @@ public: void parseEvents(void); - _mouseEvent *mouseEvent(void); + MouseEvent *mouseEvent(void); bool checkForMouseEvents(void); bool keyWaiting(void); - int32 readKey(_keyboardEvent *ev); + int32 readKey(KeyboardEvent *ev); }; } // End of namespace Sword2 diff --git a/sword2/driver/keyboard.cpp b/sword2/driver/keyboard.cpp index 5ddf303fc8..f1dc93ec4a 100644 --- a/sword2/driver/keyboard.cpp +++ b/sword2/driver/keyboard.cpp @@ -24,7 +24,7 @@ namespace Sword2 { void Input::writeKey(uint16 ascii, int keycode, int modifiers) { if (_keyBuffer && _keyBacklog < MAX_KEY_BUFFER) { - _keyboardEvent *slot = &_keyBuffer[(_keyLogPos + _keyBacklog) % MAX_KEY_BUFFER]; + KeyboardEvent *slot = &_keyBuffer[(_keyLogPos + _keyBacklog) % MAX_KEY_BUFFER]; slot->ascii = ascii; slot->keycode = keycode; @@ -46,7 +46,7 @@ bool Input::keyWaiting(void) { * @return RD_OK, or an error code to indicate there is no key waiting. */ -int32 Input::readKey(_keyboardEvent *ev) { +int32 Input::readKey(KeyboardEvent *ev) { if (!_keyBacklog) return RDERR_NOKEYWAITING; diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index 3ef3151744..ff75e4fa25 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -526,7 +526,7 @@ void Graphics::setLocationMetrics(uint16 w, uint16 h) { * parallax can be either foreground, background or the main screen. */ -void Graphics::renderParallax(_parallax *p, int16 l) { +void Graphics::renderParallax(Parallax *p, int16 l) { int16 x, y; Common::Rect r; @@ -675,7 +675,7 @@ void Graphics::setScrollTarget(int16 sx, int16 sy) { * or a NULL pointer in order of background parallax to foreground parallax. */ -int32 Graphics::initialiseBackgroundLayer(_parallax *p) { +int32 Graphics::initialiseBackgroundLayer(Parallax *p) { uint8 *memchunk; uint8 zeros; uint16 count; @@ -683,7 +683,7 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) { uint16 x; uint8 *data; uint8 *dst; - _parallaxLine line; + ParallaxLine line; uint8 *pLine; debug(2, "initialiseBackgroundLayer"); @@ -719,7 +719,7 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) { pLine = (uint8 *) p + FROM_LE_32(p->offset[i]); line.packets = READ_LE_UINT16(pLine); line.offset = READ_LE_UINT16(pLine + 2); - data = pLine + sizeof(_parallaxLine); + data = pLine + sizeof(ParallaxLine); x = line.offset; dst = memchunk + i * p->w + x; diff --git a/sword2/driver/render.h b/sword2/driver/render.h index b112789e9f..ecfad5cf7a 100644 --- a/sword2/driver/render.h +++ b/sword2/driver/render.h @@ -28,10 +28,10 @@ namespace Sword2 { #define ALIGNRENDERDEEP 480 #define RENDERDEEP (ALIGNRENDERDEEP - (MENUDEEP * 2)) -typedef struct { +struct ParallaxLine { uint16 packets; uint16 offset; -} _parallaxLine; +}; } // End of namespace Sword2 diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp index 737fcdbb08..2ec83b7808 100644 --- a/sword2/driver/sprite.cpp +++ b/sword2/driver/sprite.cpp @@ -242,7 +242,7 @@ int32 Graphics::decompressRLE16(uint8 *dest, uint8 *source, int32 decompSize, ui * @return RD_OK, or an error code */ -int32 Graphics::createSurface(_spriteInfo *s, uint8 **sprite) { +int32 Graphics::createSurface(SpriteInfo *s, uint8 **sprite) { *sprite = (uint8 *) malloc(s->w * s->h); if (!*sprite) return RDERR_OUTOFMEMORY; @@ -267,7 +267,7 @@ int32 Graphics::createSurface(_spriteInfo *s, uint8 **sprite) { * @param clipRect the clipping rectangle */ -void Graphics::drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRect) { +void Graphics::drawSurface(SpriteInfo *s, uint8 *surface, Common::Rect *clipRect) { Common::Rect rd, rs; uint16 x, y; uint8 *src, *dst; @@ -352,7 +352,7 @@ void Graphics::deleteSurface(uint8 *surface) { // FIXME: I'm sure this could be optimized. There's plenty of data copying and // mallocing here. -int32 Graphics::drawSprite(_spriteInfo *s) { +int32 Graphics::drawSprite(SpriteInfo *s) { uint8 *src, *dst; uint8 *sprite, *newSprite; uint8 *backbuf = NULL; @@ -623,7 +623,7 @@ int32 Graphics::drawSprite(_spriteInfo *s) { * Opens the light masking sprite for a room. */ -int32 Graphics::openLightMask(_spriteInfo *s) { +int32 Graphics::openLightMask(SpriteInfo *s) { // FIXME: The light mask is only needed on higher graphics detail // settings, so to save memory we could simply ignore it on lower // settings. But then we need to figure out how to ensure that it diff --git a/sword2/events.cpp b/sword2/events.cpp index 621a8be2d5..ea58fe2731 100644 --- a/sword2/events.cpp +++ b/sword2/events.cpp @@ -181,7 +181,7 @@ int32 Logic::fnPauseForEvent(int32 *params) { // params: 0 pointer to object's logic structure // 1 number of game-cycles to pause - Object_logic *ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ObjectLogic *ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); // first, check for an event diff --git a/sword2/function.cpp b/sword2/function.cpp index 9e4e14826e..243f68fdcf 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -139,7 +139,7 @@ int32 Logic::fnPause(int32 *params) { // NB. Pause-value of 0 causes script to continue, 1 causes a 1-cycle // quit, 2 gives 2 cycles, etc. - Object_logic *ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ObjectLogic *ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { // start the pause @@ -168,7 +168,7 @@ int32 Logic::fnRandomPause(int32 *params) { // 1 minimum number of game-cycles to pause // 2 maximum number of game-cycles to pause - Object_logic *ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ObjectLogic *ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); int32 pars[2]; if (ob_logic->looping == 0) { @@ -184,13 +184,13 @@ int32 Logic::fnRandomPause(int32 *params) { } int32 Logic::fnPassGraph(int32 *params) { - // makes an engine local copy of passed Object_graphic - run script 4 + // makes an engine local copy of passed ObjectGraphic - run script 4 // of an object to request this used by fnTurnTo(id) etc // // remember, we cannot simply read a compact any longer but instead // must request it from the object itself - // params: 0 pointer to an Object_graphic structure + // params: 0 pointer to an ObjectGraphic structure warning("fnPassGraph() is a no-op now"); @@ -208,7 +208,7 @@ int32 Logic::fnPassMega(int32 *params) { // params: 0 pointer to a mega structure - memcpy(&_vm->_engineMega, _vm->_memory->intToPtr(params[0]), sizeof(Object_mega)); + memcpy(&_vm->_engineMega, _vm->_memory->intToPtr(params[0]), sizeof(ObjectMega)); // makes no odds return IR_CONT; @@ -223,7 +223,7 @@ int32 Logic::fnSetValue(int32 *params) { // params: 0 pointer to object's mega structure // 1 value to set it to - Object_mega *ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[0]); + ObjectMega *ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[0]); ob_mega->megaset_res = params[1]; @@ -342,11 +342,11 @@ int32 Logic::fnResetGlobals(int32 *params) { uint32 *globals; size = _vm->_resman->fetchLen(1); - size -= sizeof(_standardHeader); + size -= sizeof(StandardHeader); debug(5, "globals size: %d", size); - globals = (uint32 *) ((uint8 *) _vm->_resman->openResource(1) + sizeof(_standardHeader)); + globals = (uint32 *) ((uint8 *) _vm->_resman->openResource(1) + sizeof(StandardHeader)); // blank each global variable memset(globals, 0, size); @@ -418,7 +418,7 @@ int32 Logic::fnPlayCredits(int32 *params) { _vm->_graphics->updateDisplay(); - _keyboardEvent ke; + KeyboardEvent ke; if (_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) break; diff --git a/sword2/header.h b/sword2/header.h index 8bc8333c48..4f6b8f0502 100644 --- a/sword2/header.h +++ b/sword2/header.h @@ -38,7 +38,7 @@ namespace Sword2 { #define NAME_LEN 34 -struct _standardHeader { +struct StandardHeader { uint8 fileType; // Byte to define file type (see below) uint8 compType; // Type of file compression used ie. // on whole file (see below) @@ -106,7 +106,7 @@ enum { // Animation Header -struct _animHeader { +struct AnimHeader { uint8 runTimeComp; // Type of runtime compression used for the // frame data (see below) uint16 noAnimFrames; // Number of frames in the anim (ie. no. of @@ -135,7 +135,7 @@ enum { // CDT Entry -struct _cdtEntry { +struct CdtEntry { int16 x; // sprite x-coord OR offset to add to mega's // feet x-coord to calc sprite y-coord int16 y; // sprite y-coord OR offset to add to mega's @@ -158,7 +158,7 @@ enum { // Frame Header -struct _frameHeader { +struct FrameHeader { uint32 compSize; // Compressed size of frame - NB. compression // type is now in Anim Header uint16 width; // Dimensions of frame @@ -184,7 +184,7 @@ struct _frameHeader { // Goes at the beginning of a screen file after the standard header. // Gives offsets from start of table of each of the components -struct _multiScreenHeader { +struct MultiScreenHeader { uint32 palette; uint32 bg_parallax[2]; uint32 screen; @@ -196,7 +196,7 @@ struct _multiScreenHeader { // Palette Data -struct _palEntry { +struct PalEntry { uint8 red; uint8 green; uint8 blue; @@ -205,7 +205,7 @@ struct _palEntry { // Screen Header -struct _screenHeader { +struct ScreenHeader { uint16 width; // dimensions of the background screen uint16 height; uint16 noLayers; // number of layer areas @@ -216,7 +216,7 @@ struct _screenHeader { // Note that all the layer headers are kept together, rather than being placed // before each layer mask, in order to simplify the sort routine. -struct _layerHeader { +struct LayerHeader { uint16 x; // coordinates of top-left pixel of area uint16 y; uint16 width; @@ -246,7 +246,7 @@ struct _layerHeader { // Walk-Grid Header - taken directly from old "header.h" in STD_INC -struct _walkGridHeader { +struct WalkGridHeader { int32 numBars; // number of bars on the floor int32 numNodes; // number of nodes } GCC_PACK; @@ -264,7 +264,7 @@ struct _walkGridHeader { #define TREE_SIZE 3 -struct _object_hub { +struct ObjectHub { int32 type; // type of object uint32 logic_level; // what level? uint32 logic[TREE_SIZE]; // NOT USED @@ -274,15 +274,15 @@ struct _object_hub { // (6) text module header -struct _textHeader { +struct TextHeader { uint32 noOfLines; // how many lines of text are there in this // module } GCC_PACK; // a text file has: // -// _standardHeader -// _textHeader +// StandardHeader +// TextHeader // look up table, to // line of text,0 // line of text,0 diff --git a/sword2/icons.cpp b/sword2/icons.cpp index 9502f88082..4fb9a4fba2 100644 --- a/sword2/icons.cpp +++ b/sword2/icons.cpp @@ -25,12 +25,12 @@ namespace Sword2 { int32 Logic::fnAddMenuObject(int32 *params) { - // params: 0 pointer to a menu_object structure to copy down + // params: 0 pointer to a MenuObject structure to copy down assert(_vm->_totalTemp < TOTAL_engine_pockets); // copy the structure to our in-the-engine list - memcpy(&_vm->_tempList[_vm->_totalTemp], _vm->_memory->intToPtr(params[0]), sizeof(menu_object)); + memcpy(&_vm->_tempList[_vm->_totalTemp], _vm->_memory->intToPtr(params[0]), sizeof(MenuObject)); _vm->_totalTemp++; // script continue @@ -121,7 +121,7 @@ void Sword2Engine::buildMenu(void) { for (j = 0; j < TOTAL_engine_pockets; j++) { // not current end - meaning out over the end so move down if (_masterMenuList[j].icon_resource && j != _totalMasters) { - memcpy(&_masterMenuList[_totalMasters++], &_masterMenuList[j], sizeof(menu_object)); + memcpy(&_masterMenuList[_totalMasters++], &_masterMenuList[j], sizeof(MenuObject)); // moved down now so kill here _masterMenuList[j].icon_resource = 0; @@ -139,7 +139,7 @@ void Sword2Engine::buildMenu(void) { for (j = 0; j < TOTAL_engine_pockets; j++) { if (_tempList[j].icon_resource) { // here's a new temp - memcpy(&_masterMenuList[_totalMasters++], &_tempList[j], sizeof(menu_object)); + memcpy(&_masterMenuList[_totalMasters++], &_tempList[j], sizeof(MenuObject)); } } @@ -187,7 +187,7 @@ void Sword2Engine::buildMenu(void) { icon_coloured = true; } - icon = _resman->openResource(_masterMenuList[j].icon_resource) + sizeof(_standardHeader); + icon = _resman->openResource(_masterMenuList[j].icon_resource) + sizeof(StandardHeader); // The coloured icon is stored directly after the // greyed out one. @@ -224,7 +224,7 @@ void Sword2Engine::buildSystemMenu(void) { // rest will grey out for (int i = 0; i < ARRAYSIZE(icon_list); i++) { - icon = _resman->openResource(icon_list[i]) + sizeof(_standardHeader); + icon = _resman->openResource(icon_list[i]) + sizeof(StandardHeader); // The only case when an icon is grayed is when the player // is dead. Then SAVE is not available. diff --git a/sword2/icons.h b/sword2/icons.h index 01abc59203..3a6512ad64 100644 --- a/sword2/icons.h +++ b/sword2/icons.h @@ -28,7 +28,7 @@ namespace Sword2 { // define these in a script and then register them with the system -struct menu_object { +struct MenuObject { int32 icon_resource; // icon graphic graphic int32 luggage_resource; // luggage icon resource (for attaching to // mouse pointer) diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp index cf292bd0f5..91e64cced7 100644 --- a/sword2/interpreter.cpp +++ b/sword2/interpreter.cpp @@ -207,8 +207,8 @@ int Logic::runScript(char *scriptData, char *objectData, uint32 *offset) { bool checkPyramidBug = false; - _standardHeader *header = (_standardHeader *) scriptData; - scriptData += sizeof(_standardHeader) + sizeof(_object_hub); + StandardHeader *header = (StandardHeader *) scriptData; + scriptData += sizeof(StandardHeader) + sizeof(ObjectHub); // The script data format: // int32_TYPE 1 Size of variable space in bytes @@ -382,7 +382,7 @@ int Logic::runScript(char *scriptData, char *objectData, uint32 *offset) { case CP_PUSH_DEREFERENCED_STRUCTURE: // Push the address of a dereferenced structure Read32ip(parameter); - ptrval = _vm->_memory->ptrToInt((const uint8 *) (objectData + sizeof(int32) + sizeof(_standardHeader) + sizeof(_object_hub) + parameter)); + ptrval = _vm->_memory->ptrToInt((const uint8 *) (objectData + sizeof(int32) + sizeof(StandardHeader) + sizeof(ObjectHub) + parameter)); debug(5, "Push address of far variable (%x)", ptrval); push(ptrval); break; diff --git a/sword2/layers.cpp b/sword2/layers.cpp index 9da7507506..531fdfdfbe 100644 --- a/sword2/layers.cpp +++ b/sword2/layers.cpp @@ -40,10 +40,10 @@ int32 Logic::fnInitBackground(int32 *params) { } int32 Sword2Engine::initBackground(int32 res, int32 new_palette) { - _multiScreenHeader *screenLayerTable; - _screenHeader *screen_head; - _layerHeader *layer; - _spriteInfo spriteInfo; + MultiScreenHeader *screenLayerTable; + ScreenHeader *screen_head; + LayerHeader *layer; + SpriteInfo spriteInfo; uint8 *file; uint32 rv; @@ -154,7 +154,7 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) { // shading mask - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); if (screenLayerTable->maskOffset) { spriteInfo.x = 0; @@ -192,8 +192,8 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) { // called from fnInitBackground and also from control panel void Sword2Engine::setUpBackgroundLayers(void) { - _multiScreenHeader *screenLayerTable; - _screenHeader *screen_head; + MultiScreenHeader *screenLayerTable; + ScreenHeader *screen_head; uint8 *file; int i; @@ -207,7 +207,7 @@ void Sword2Engine::setUpBackgroundLayers(void) { screen_head = fetchScreenHeader(file); - screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); + screenLayerTable = (MultiScreenHeader *) (file + sizeof(StandardHeader)); // Background parallax layers diff --git a/sword2/layers.h b/sword2/layers.h index 0bc625daf0..5a7a9083dc 100644 --- a/sword2/layers.h +++ b/sword2/layers.h @@ -22,7 +22,7 @@ namespace Sword2 { -typedef struct { +struct ScreenInfo { uint16 scroll_offset_x; // Position x uint16 scroll_offset_y; // Position y uint16 max_scroll_offset_x; // Calc'ed in fnInitBackground @@ -44,7 +44,7 @@ typedef struct { // fading up after a build_display uint8 scroll_flag; // Scroll mode 0 off 1 on uint8 mask_flag; // Using shading mask -} screen_info; +}; } // End of namespace Sword2 diff --git a/sword2/logic.cpp b/sword2/logic.cpp index f82f6d02e9..059071b0bf 100644 --- a/sword2/logic.cpp +++ b/sword2/logic.cpp @@ -39,8 +39,8 @@ int Logic::processSession(void) { char *raw_script_ad; char *raw_data_ad; uint32 null_pc; - _standardHeader *head; - _standardHeader *far_head; + StandardHeader *head; + StandardHeader *far_head; uint32 id; // might change during the session, so take a copy here @@ -53,7 +53,7 @@ int Logic::processSession(void) { // processing on the current list while (_pc != 0xffffffff) { - head = (_standardHeader *) _vm->_resman->openResource(run_list); + head = (StandardHeader *) _vm->_resman->openResource(run_list); if (head->fileType != RUN_LIST) error("Logic_engine %d not a run_list", run_list); @@ -77,12 +77,12 @@ int Logic::processSession(void) { return 0; } - head = (_standardHeader *) _vm->_resman->openResource(ID); + head = (StandardHeader *) _vm->_resman->openResource(ID); if (head->fileType != GAME_OBJECT) error("Logic_engine %d not an object", ID); - _curObjectHub = (_object_hub *) (head + 1); + _curObjectHub = (ObjectHub *) (head + 1); debug(5, " %d id(%d) pc(%d)", LEVEL, @@ -123,12 +123,12 @@ int Logic::processSession(void) { raw_data_ad = (char *) head; - far_head = (_standardHeader *) _vm->_resman->openResource(script / SIZE); + far_head = (StandardHeader *) _vm->_resman->openResource(script / SIZE); if (far_head->fileType != GAME_OBJECT && far_head->fileType != SCREEN_MANAGER) error("Logic_engine %d not a far object (its a %d)", script / SIZE, far_head->fileType); - // raw_script_ad = (char *) (head + 1) + sizeof(_standardHeader); + // raw_script_ad = (char *) (head + 1) + sizeof(StandardHeader); // get our objects data address // raw_data_ad = (char *) (_curObjectHub + 1); @@ -328,16 +328,16 @@ void Logic::logicReplace(uint32 new_script) { void Logic::examineRunList(void) { uint32 *game_object_list; - _standardHeader *file_header; + StandardHeader *file_header; if (_currentRunList) { // open and lock in place - game_object_list = (uint32 *) (_vm->_resman->openResource(_currentRunList) + sizeof(_standardHeader)); + game_object_list = (uint32 *) (_vm->_resman->openResource(_currentRunList) + sizeof(StandardHeader)); Debug_Printf("Runlist number %d\n", _currentRunList); for (int i = 0; game_object_list[i]; i++) { - file_header = (_standardHeader *) _vm->_resman->openResource(game_object_list[i]); + file_header = (StandardHeader *) _vm->_resman->openResource(game_object_list[i]); Debug_Printf("%d %s\n", game_object_list[i], file_header->name); _vm->_resman->closeResource(game_object_list[i]); } diff --git a/sword2/logic.h b/sword2/logic.h index 86d67df318..092c34be5c 100644 --- a/sword2/logic.h +++ b/sword2/logic.h @@ -68,7 +68,7 @@ private: uint32 _pc; // each object has one of these tacked onto the beginning - _object_hub *_curObjectHub; + ObjectHub *_curObjectHub; void processKillList(void); @@ -83,28 +83,28 @@ private: // FOR TEXT LINES IN SEQUENCE PLAYER - struct _sequenceTextInfo { + struct SequenceTextInfo { uint32 textNumber; uint16 startFrame; uint16 endFrame; - mem *text_mem; + Memory *text_mem; uint32 speechBufferSize; uint16 *speech_mem; }; - _sequenceTextInfo _sequenceTextList[MAX_SEQUENCE_TEXT_LINES]; + SequenceTextInfo _sequenceTextList[MAX_SEQUENCE_TEXT_LINES]; - void createSequenceSpeech(_movieTextObject *sequenceText[]); - void clearSequenceSpeech(_movieTextObject *sequenceText[]); + void createSequenceSpeech(MovieTextObject *sequenceText[]); + void clearSequenceSpeech(MovieTextObject *sequenceText[]); // array of these for subject menu build up - struct _subject_unit { + struct SubjectUnit { uint32 res; uint32 ref; }; - _subject_unit _subjectList[MAX_SUBJECT_LIST]; + SubjectUnit _subjectList[MAX_SUBJECT_LIST]; // when not playing a wav we calculate the speech time based upon // length of ascii @@ -138,7 +138,7 @@ private: uint32 _totalScreenManagers; uint32 _startRes; - struct _startup { + struct StartUp { char description[MAX_description]; // id of screen manager object @@ -150,7 +150,7 @@ private: uint32 key; }; - _startup _startList[MAX_starts]; + StartUp _startList[MAX_starts]; uint32 initStartMenu(void); @@ -202,12 +202,12 @@ public: void setGlobalInterpreterVariables(int32 *vars); int runScript(char *scriptData, char *objectData, uint32 *offset); - struct _event_unit { + struct EventUnit { uint32 id; uint32 interact_id; }; - _event_unit _eventList[MAX_events]; + EventUnit _eventList[MAX_events]; void sendEvent(uint32 id, uint32 interact_id); void setPlayerActionEvent(uint32 id, uint32 interact_id); @@ -218,12 +218,12 @@ public: uint32 countEvents(void); - struct _sync_unit { + struct SyncUnit { uint32 id; uint32 sync; }; - _sync_unit _syncList[MAX_syncs]; + SyncUnit _syncList[MAX_syncs]; void clearSyncs(uint32 id); bool getSync(void); diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp index 4918b7a523..5eaaabe1ef 100644 --- a/sword2/maketext.cpp +++ b/sword2/maketext.cpp @@ -54,10 +54,10 @@ namespace Sword2 { // info for each line of words in the output text sprite -mem* FontRenderer::makeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border) { - mem *line; // handle for the memory block which will +Memory *FontRenderer::makeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border) { + Memory *line; // handle for the memory block which will // contain the array of lineInfo structures - mem *textSprite; // handle for the block to contain the text + Memory *textSprite; // handle for the block to contain the text // sprite itself uint16 noOfLines; // no of lines of text required to fit within // a sprite of width 'maxWidth' pixels @@ -185,13 +185,13 @@ uint16 FontRenderer::analyseSentence(uint8 *sentence, uint16 maxWidth, uint32 fo // PC Version of BuildTextSprite -mem* FontRenderer::buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, LineInfo *line, uint16 noOfLines) { +Memory *FontRenderer::buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, LineInfo *line, uint16 noOfLines) { uint8 *linePtr, *spritePtr; uint16 lineNo, pos = 0, posInLine, spriteWidth = 0, spriteHeight; uint16 sizeOfSprite; uint16 char_height = charHeight(fontRes); - _frameHeader *frameHeadPtr, *charPtr; - mem *textSprite; + FrameHeader *frameHeadPtr, *charPtr; + Memory *textSprite; uint8 *charSet; // spriteWidth = width of widest line of output text @@ -210,13 +210,13 @@ mem* FontRenderer::buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, L // allocate memory for sprite, and lock it ready for use // NB. 'textSprite' is the given pointer to the handle to be used - textSprite = _vm->_memory->allocMemory(sizeof(_frameHeader) + sizeOfSprite, MEM_locked, UID_text_sprite); + textSprite = _vm->_memory->allocMemory(sizeof(FrameHeader) + sizeOfSprite, MEM_locked, UID_text_sprite); // the handle (*textSprite) now points to UNMOVABLE memory block // set up the frame header // point to the start of our memory block - frameHeadPtr = (_frameHeader *) textSprite->ad; + frameHeadPtr = (FrameHeader *) textSprite->ad; frameHeadPtr->compSize = 0; frameHeadPtr->width = spriteWidth; @@ -228,7 +228,7 @@ mem* FontRenderer::buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, L // ok, now point to the start (of the first line) of the sprite data // itelf - linePtr = textSprite->ad + sizeof(_frameHeader); + linePtr = textSprite->ad + sizeof(FrameHeader); // start with transparent sprite (no colour) memset(linePtr, NO_COL, sizeOfSprite); @@ -280,7 +280,7 @@ mem* FontRenderer::buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, L // and a pointer to the start of the character set. uint16 FontRenderer::charWidth(uint8 ch, uint32 fontRes) { - _frameHeader *charFrame; + FrameHeader *charFrame; uint8 *charSet; uint16 width; @@ -302,7 +302,7 @@ uint16 FontRenderer::charWidth(uint8 ch, uint32 fontRes) { // and a pointer to the start of the character set. uint16 FontRenderer::charHeight(uint32 fontRes) { - _frameHeader *charFrame; + FrameHeader *charFrame; uint8 *charSet; uint16 height; @@ -323,7 +323,7 @@ uint16 FontRenderer::charHeight(uint32 fontRes) { // Returns a pointer to the header of a character sprite, given the character's // ASCII code and a pointer to the start of the character set. -_frameHeader* FontRenderer::findChar(uint8 ch, uint8 *charSet) { +FrameHeader* FontRenderer::findChar(uint8 ch, uint8 *charSet) { // if 'ch' out of range, print the 'dud' character (chequered flag) if (ch < FIRST_CHAR) ch = DUD; @@ -336,12 +336,12 @@ _frameHeader* FontRenderer::findChar(uint8 ch, uint8 *charSet) { // otherwise it maps pixels of BORDER_COL to '_borderPen', and LETTER_COL to // 'pen'. -void FontRenderer::copyChar(_frameHeader *charPtr, uint8 *spritePtr, uint16 spriteWidth, uint8 pen) { +void FontRenderer::copyChar(FrameHeader *charPtr, uint8 *spritePtr, uint16 spriteWidth, uint8 pen) { uint8 *rowPtr, *source, *dest; uint16 rows, cols; // now pts to sprite data for char 'ch' - source = (uint8 *) charPtr + sizeof(_frameHeader); + source = (uint8 *) charPtr + sizeof(FrameHeader); // pts to start of first row of char within text sprite rowPtr = spritePtr; @@ -395,7 +395,7 @@ void FontRenderer::copyChar(_frameHeader *charPtr, uint8 *spritePtr, uint16 spri uint32 FontRenderer::buildNewBloc(uint8 *ascii, int16 x, int16 y, uint16 width, uint8 pen, uint32 type, uint32 fontRes, uint8 justification) { uint32 j = 0; - _frameHeader *frame_head; + FrameHeader *frame_head; int16 text_left_margin; int16 text_right_margin; int16 text_top_margin; @@ -421,7 +421,7 @@ uint32 FontRenderer::buildNewBloc(uint8 *ascii, int16 x, int16 y, uint16 width, // without margin checking - used for debug text if (justification != NO_JUSTIFICATION) { - frame_head = (_frameHeader *) _blocList[j].text_mem->ad; + frame_head = (FrameHeader *) _blocList[j].text_mem->ad; switch (justification) { // this one is always used for SPEECH TEXT; possibly @@ -490,14 +490,14 @@ uint32 FontRenderer::buildNewBloc(uint8 *ascii, int16 x, int16 y, uint16 width, void FontRenderer::printTextBlocs(void) { //called by build_display - _frameHeader *frame; - _spriteInfo spriteInfo; + FrameHeader *frame; + SpriteInfo spriteInfo; uint32 rv; uint32 j; for (j = 0; j < MAX_text_blocs; j++) { if (_blocList[j].text_mem) { - frame = (_frameHeader *) _blocList[j].text_mem->ad; + frame = (FrameHeader *) _blocList[j].text_mem->ad; spriteInfo.x = _blocList[j].x; spriteInfo.y = _blocList[j].y; @@ -508,7 +508,7 @@ void FontRenderer::printTextBlocs(void) { spriteInfo.scaledHeight = 0; spriteInfo.type = _blocList[j].type; spriteInfo.blend = 0; - spriteInfo.data = _blocList[j].text_mem->ad + sizeof(_frameHeader); + spriteInfo.data = _blocList[j].text_mem->ad + sizeof(FrameHeader); spriteInfo.colourTable = 0; rv = _vm->_graphics->drawSprite(&spriteInfo); diff --git a/sword2/maketext.h b/sword2/maketext.h index 5b870a37bc..476fbfc308 100644 --- a/sword2/maketext.h +++ b/sword2/maketext.h @@ -91,19 +91,19 @@ enum { POLISH_TEXT = 2 }; -typedef struct { +struct TextBloc { int16 x; int16 y; - // RDSPR_ status bits - see defintion of _spriteInfo structure for + // RDSPR_ status bits - see defintion of SpriteInfo structure for // correct size! uint16 type; - mem *text_mem; -} TextBloc; + Memory *text_mem; +}; -typedef struct { +struct LineInfo { uint16 width; // width of line in pixels uint16 length; // length of line in characters -} LineInfo; +}; class FontRenderer { private: @@ -121,11 +121,11 @@ private: uint8 _borderPen; // output pen colour of character borders uint16 analyseSentence(uint8 *sentence, uint16 maxWidth, uint32 fontRes, LineInfo *line); - mem* buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, LineInfo *line, uint16 noOfLines); + Memory *buildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, LineInfo *line, uint16 noOfLines); uint16 charWidth(uint8 ch, uint32 fontRes); uint16 charHeight(uint32 fontRes); - _frameHeader* findChar(uint8 ch, uint8 *charSet); - void copyChar(_frameHeader *charPtr, uint8 *spritePtr, uint16 spriteWidth, uint8 pen); + FrameHeader* findChar(uint8 ch, uint8 *charSet); + void copyChar(FrameHeader *charPtr, uint8 *spritePtr, uint16 spriteWidth, uint8 pen); public: FontRenderer(Sword2Engine *vm) : _vm(vm) { @@ -133,7 +133,7 @@ public: _blocList[i].text_mem = NULL; } - mem* makeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border = BORDER_PEN); + Memory *makeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border = BORDER_PEN); void killTextBloc(uint32 bloc_number); void printTextBlocs(void); diff --git a/sword2/mem_view.cpp b/sword2/mem_view.cpp index 25162c1cd6..2c14f739d4 100644 --- a/sword2/mem_view.cpp +++ b/sword2/mem_view.cpp @@ -26,7 +26,7 @@ namespace Sword2 { void MemoryManager::displayMemory(void) { int pass, found_end, k, j, free = 0; - _standardHeader *file_header; + StandardHeader *file_header; char inf[][20] = { { "M_null " }, @@ -38,7 +38,7 @@ void MemoryManager::displayMemory(void) { j = _baseMemBlock; do { if (_memList[j].uid < 65536) { - file_header = (_standardHeader *) _vm->_resman->openResource(_memList[j].uid); + file_header = (StandardHeader *) _vm->_resman->openResource(_memList[j].uid); // close immediately so give a true count _vm->_resman->closeResource(_memList[j].uid); diff --git a/sword2/memory.cpp b/sword2/memory.cpp index 626764857a..2679176c7e 100644 --- a/sword2/memory.cpp +++ b/sword2/memory.cpp @@ -113,7 +113,7 @@ uint8 *MemoryManager::intToPtr(int32 n) { return &_freeMemman[n]; } -mem *MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) { +Memory *MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) { // allocate a block of memory - locked or float // returns 0 if fails to allocate the memory @@ -247,7 +247,7 @@ mem *MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) { return &_memList[nu_block]; } -void MemoryManager::freeMemory(mem *block) { +void MemoryManager::freeMemory(Memory *block) { // kill a block of memory - which was presumably floating or locked // once you've done this the memory may be recycled @@ -259,7 +259,7 @@ void MemoryManager::freeMemory(mem *block) { #endif } -void MemoryManager::floatMemory(mem *block) { +void MemoryManager::floatMemory(Memory *block) { // set a block to float // wont be trashed but will move around in memory @@ -270,7 +270,7 @@ void MemoryManager::floatMemory(mem *block) { #endif } -void MemoryManager::lockMemory(mem *block) { +void MemoryManager::lockMemory(Memory *block) { // set a block to lock // wont be moved - don't lock memory for any longer than necessary // unless you know the locked memory is at the bottom of the heap @@ -482,13 +482,13 @@ void MemoryManager::debugMemory(void) { } while (j != -1); } -mem *MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) { +Memory *MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) { // the high level allocator // can ask the resman to remove old resources to make space - will // either do it or halt the system - mem *membloc; + Memory *membloc; int j; uint32 free = 0; diff --git a/sword2/memory.h b/sword2/memory.h index 57f972185e..dc8d29d1ec 100644 --- a/sword2/memory.h +++ b/sword2/memory.h @@ -22,7 +22,7 @@ namespace Sword2 { -typedef struct { +struct Memory { uint32 state; uint32 age; // *not used* uint32 size; @@ -32,7 +32,7 @@ typedef struct { // visual display only uint32 uid; uint8 *ad; -} mem; +}; enum { MEM_null = 0, // null @@ -78,7 +78,7 @@ private: // VirtualDefrag. int32 _suggestedStart; - mem *lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id); + Memory *lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id); int32 defragMemory(uint32 req_size); // Used to determine if the required size can be obtained if the @@ -91,7 +91,7 @@ private: public: // List of defined memory handles - each representing a block of memory - mem _memList[MAX_mem_blocks]; + Memory _memList[MAX_mem_blocks]; uint32 _baseMemBlock; MemoryManager(Sword2Engine *vm); @@ -100,10 +100,10 @@ public: int32 ptrToInt(const uint8 *p); uint8 *intToPtr(int32 n); - mem *allocMemory(uint32 size, uint32 type, uint32 unique_id); - void freeMemory(mem *block); - void floatMemory(mem *block); - void lockMemory(mem *block); + Memory *allocMemory(uint32 size, uint32 type, uint32 unique_id); + void freeMemory(Memory *block); + void floatMemory(Memory *block); + void lockMemory(Memory *block); // Debugging function void displayMemory(void); diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp index 2775a0a8b8..c43f98f252 100644 --- a/sword2/mouse.cpp +++ b/sword2/mouse.cpp @@ -122,7 +122,7 @@ int Sword2Engine::menuClick(int menu_items) { void Sword2Engine::systemMenuMouse(void) { uint32 safe_looping_music_id; - _mouseEvent *me; + MouseEvent *me; int hit; uint8 *icon; int32 pars[2]; @@ -167,7 +167,7 @@ void Sword2Engine::systemMenuMouse(void) { for (int i = 0; i < ARRAYSIZE(icon_list); i++) { if (i != hit) { - icon = _resman->openResource(icon_list[i]) + sizeof(_standardHeader); + icon = _resman->openResource(icon_list[i]) + sizeof(StandardHeader); _graphics->setMenuIcon(RDMENU_TOP, i, icon); _resman->closeResource(icon_list[i]); } @@ -260,7 +260,7 @@ void Sword2Engine::systemMenuMouse(void) { } void Sword2Engine::dragMouse(void) { - _mouseEvent *me; + MouseEvent *me; int hit; // We can use dragged object both on other inventory objects, or on @@ -378,7 +378,7 @@ void Sword2Engine::dragMouse(void) { } void Sword2Engine::menuMouse(void) { - _mouseEvent *me; + MouseEvent *me; int hit; // If the mouse is moved off the menu, close it. @@ -461,7 +461,7 @@ void Sword2Engine::normalMouse(void) { // The gane is playing and none of the menus are activated - but, we // need to check if a menu is to start. Note, won't have luggage - _mouseEvent *me; + MouseEvent *me; // Check if the cursor has moved onto the system menu area. No save in // big-object menu lock situation, of if the player is dragging an @@ -773,8 +773,8 @@ void Sword2Engine::setMouse(uint32 res) { _mousePointerRes = res; if (res) { - icon = _resman->openResource(res) + sizeof(_standardHeader); - len = _resman->_resList[res]->size - sizeof(_standardHeader); + icon = _resman->openResource(res) + sizeof(StandardHeader); + len = _resman->_resList[res]->size - sizeof(StandardHeader); // don't pulse the normal pointer - just do the regular anim // loop @@ -798,8 +798,8 @@ void Sword2Engine::setLuggage(uint32 res) { _realLuggageItem = res; if (res) { - icon = _resman->openResource(res) + sizeof(_standardHeader); - len = _resman->_resList[res]->size - sizeof(_standardHeader); + icon = _resman->openResource(res) + sizeof(StandardHeader); + len = _resman->_resList[res]->size - sizeof(StandardHeader); _graphics->setLuggageAnim(icon, len); @@ -1030,7 +1030,7 @@ void Sword2Engine::noHuman(void) { setLuggage(0); } -void Sword2Engine::registerMouse(Object_mouse *ob_mouse) { +void Sword2Engine::registerMouse(ObjectMouse *ob_mouse) { debug(5, "_curMouse = %d", _curMouse); if (!ob_mouse->pointer) @@ -1181,10 +1181,10 @@ int32 Logic::fnRegisterMouse(int32 *params) { // floor or one whose mouse area is manually defined rather than // intended to fit sprite shape - // params: 0 pointer to Object_mouse or 0 for no write to mouse + // params: 0 pointer to ObjectMouse or 0 for no write to mouse // list - _vm->registerMouse((Object_mouse *) _vm->_memory->intToPtr(params[0])); + _vm->registerMouse((ObjectMouse *) _vm->_memory->intToPtr(params[0])); return IR_CONT; } @@ -1209,7 +1209,7 @@ int32 Logic::fnRegisterPointerText(int32 *params) { int32 Logic::fnInitFloorMouse(int32 *params) { // params: 0 pointer to object's mouse structure - Object_mouse *ob_mouse = (Object_mouse *) _vm->_memory->intToPtr(params[0]); + ObjectMouse *ob_mouse = (ObjectMouse *) _vm->_memory->intToPtr(params[0]); // floor is always lowest priority @@ -1228,7 +1228,7 @@ int32 Logic::fnInitFloorMouse(int32 *params) { int32 Logic::fnSetScrollLeftMouse(int32 *params) { // params: 0 pointer to object's mouse structure - Object_mouse *ob_mouse = (Object_mouse *) _vm->_memory->intToPtr(params[0]); + ObjectMouse *ob_mouse = (ObjectMouse *) _vm->_memory->intToPtr(params[0]); // Highest priority @@ -1252,7 +1252,7 @@ int32 Logic::fnSetScrollLeftMouse(int32 *params) { int32 Logic::fnSetScrollRightMouse(int32 *params) { // params: 0 pointer to object's mouse structure - Object_mouse *ob_mouse = (Object_mouse *) _vm->_memory->intToPtr(params[0]); + ObjectMouse *ob_mouse = (ObjectMouse *) _vm->_memory->intToPtr(params[0]); // Highest priority diff --git a/sword2/mouse.h b/sword2/mouse.h index 5faf52b396..3b4cfaed6a 100644 --- a/sword2/mouse.h +++ b/sword2/mouse.h @@ -35,10 +35,10 @@ enum { // The MOUSE_holding mode is entered when the conversation menu is closed, and // exited when the mouse cursor moves off that menu area. I don't know why yet. -// mouse unit - like Object_mouse, but with anim resource & pc (needed if +// mouse unit - like ObjectMouse, but with anim resource & pc (needed if // sprite is to act as mouse detection mask) -struct Mouse_unit { +struct MouseUnit { // Top-left and bottom-right of mouse area. These coords are inclusive int32 x1; int32 y1; @@ -50,7 +50,7 @@ struct Mouse_unit { // type (or resource id?) of pointer used over this area int32 pointer; - // up to here, this is basically a copy of the Object_mouse + // up to here, this is basically a copy of the ObjectMouse // structure, but then we have... // object id, used when checking mouse list diff --git a/sword2/object.h b/sword2/object.h index 2b7e7c38e7..f8ea422a1d 100644 --- a/sword2/object.h +++ b/sword2/object.h @@ -29,25 +29,24 @@ namespace Sword2 { // mouse structure - defines mouse detection area, detection priority & // 'type' flag -typedef struct { +struct ObjectMouse { int32 x1; // Top-left and bottom-right of mouse int32 y1; // area. (These coords are inclusive.) int32 x2; int32 y2; int32 priority; int32 pointer; // type (or resource id?) of pointer used over this area - -} Object_mouse; +}; // logic structure - contains fields used in logic script processing -typedef struct { +struct ObjectLogic { int32 looping; // 0 when first calling fn<function>; // 1 when calling subsequent times in same loop int32 pause; // pause count, used by fnPause() -} Object_logic; +}; -// status bits for 'type' field of Object_graphic) +// status bits for 'type' field of ObjectGraphic) // in low word: @@ -67,15 +66,15 @@ typedef struct { // graphic structure - contains fields appropriate to sprite output -typedef struct { +struct ObjectGraphic { int32 type; // see above int32 anim_resource; // resource id of animation file int32 anim_pc; // current frame number of animation -} Object_graphic; +}; // speech structure - contains fields used by speech scripts & text output -typedef struct { +struct ObjectSpeech { int32 pen; // colour to use for body of characters int32 width; // max width of text sprite int32 command; // speech script command id @@ -85,12 +84,12 @@ typedef struct { int32 ins4; int32 ins5; int32 wait_state; // 0 not waiting, 1 waiting for next speech command -} Object_speech; +}; // mega structure - contains fields used for mega-character & mega-set // processing -typedef struct { +struct ObjectMega { int32 NOT_USED_1; // only free roaming megas need to check this before registering their graphics for drawing int32 NOT_USED_2; // id of floor on which we are standing int32 NOT_USED_3; // id of object which we are getting to @@ -105,12 +104,12 @@ typedef struct { int32 NOT_USED_5; // means were currently avoiding a collision (see fnWalk) int32 megaset_res; // resource id of mega-set file int32 NOT_USED_6; // NOT USED -} Object_mega; +}; // walk-data structure - contains details of layout of frames in the // mega-set, and how they are to be used -typedef struct { +struct ObjectWalkdata { int32 nWalkFrames; // no. of frames per walk-cycle int32 usingStandingTurnFrames; // 0 = no 1 = yes int32 usingWalkingTurnFrames; // 0 = no 1 = yes @@ -120,7 +119,7 @@ typedef struct { int32 leadingLeg[8]; // leading leg for walk in each direction (0 = left 1 = right) int32 dx[8 * (12 + 1)]; // walk step distances in x direction int32 dy[8 * (12 + 1)]; // walk step distances in y direction -} Object_walkdata; +}; } // End of namespace Sword2 diff --git a/sword2/protocol.cpp b/sword2/protocol.cpp index 2154ecfff8..833c2187fa 100644 --- a/sword2/protocol.cpp +++ b/sword2/protocol.cpp @@ -30,7 +30,7 @@ namespace Sword2 { uint8 *Sword2Engine::fetchPalette(uint8 *screenFile) { uint8 *palette; - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); palette = (uint8 *) mscreenHeader + mscreenHeader->palette; @@ -52,7 +52,7 @@ uint8 *Sword2Engine::fetchPalette(uint8 *screenFile) { */ uint8 *Sword2Engine::fetchPaletteMatchTable(uint8 *screenFile) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); return (uint8 *) mscreenHeader + mscreenHeader->paletteTable; } @@ -62,9 +62,9 @@ uint8 *Sword2Engine::fetchPaletteMatchTable(uint8 *screenFile) { * the screen file. */ -_screenHeader *Sword2Engine::fetchScreenHeader(uint8 *screenFile) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); - _screenHeader *screenHeader = (_screenHeader *) ((uint8 *) mscreenHeader + mscreenHeader->screen); +ScreenHeader *Sword2Engine::fetchScreenHeader(uint8 *screenFile) { + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); + ScreenHeader *screenHeader = (ScreenHeader *) ((uint8 *) mscreenHeader + mscreenHeader->screen); return screenHeader; } @@ -75,17 +75,17 @@ _screenHeader *Sword2Engine::fetchScreenHeader(uint8 *screenFile) { * the number of layers on this screen. */ -_layerHeader *Sword2Engine::fetchLayerHeader(uint8 *screenFile, uint16 layerNo) { +LayerHeader *Sword2Engine::fetchLayerHeader(uint8 *screenFile, uint16 layerNo) { #ifdef _SWORD2_DEBUG - _screenHeader *screenHead = fetchScreenHeader(screenFile); + ScreenHeader *screenHead = fetchScreenHeader(screenFile); if (layerNo > screenHead->noLayers - 1) error("fetchLayerHeader(%d) invalid layer number!", layerNo); #endif - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); - _layerHeader *layerHeader = (_layerHeader *) ((uint8 *) mscreenHeader + mscreenHeader->layers + (layerNo * sizeof(_layerHeader))); + LayerHeader *layerHeader = (LayerHeader *) ((uint8 *) mscreenHeader + mscreenHeader->layers + (layerNo * sizeof(LayerHeader))); return layerHeader; } @@ -96,7 +96,7 @@ _layerHeader *Sword2Engine::fetchLayerHeader(uint8 *screenFile, uint16 layerNo) */ uint8 *Sword2Engine::fetchShadingMask(uint8 *screenFile) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); return (uint8 *) mscreenHeader + mscreenHeader->maskOffset; } @@ -106,8 +106,8 @@ uint8 *Sword2Engine::fetchShadingMask(uint8 *screenFile) { * anim file. */ -_animHeader *Sword2Engine::fetchAnimHeader(uint8 *animFile) { - return (_animHeader *) (animFile + sizeof(_standardHeader)); +AnimHeader *Sword2Engine::fetchAnimHeader(uint8 *animFile) { + return (AnimHeader *) (animFile + sizeof(StandardHeader)); } /** @@ -116,15 +116,15 @@ _animHeader *Sword2Engine::fetchAnimHeader(uint8 *animFile) { * number exceeds the number of frames in this anim. */ -_cdtEntry *Sword2Engine::fetchCdtEntry(uint8 *animFile, uint16 frameNo) { - _animHeader *animHead = fetchAnimHeader(animFile); +CdtEntry *Sword2Engine::fetchCdtEntry(uint8 *animFile, uint16 frameNo) { + AnimHeader *animHead = fetchAnimHeader(animFile); #ifdef _SWORD2_DEBUG if (frameNo > animHead->noAnimFrames - 1) error("fetchCdtEntry(animFile,%d) - anim only %d frames", frameNo, animHead->noAnimFrames); #endif - return (_cdtEntry *) ((uint8 *) animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry)); + return (CdtEntry *) ((uint8 *) animHead + sizeof(AnimHeader) + frameNo * sizeof(CdtEntry)); } /** @@ -133,58 +133,58 @@ _cdtEntry *Sword2Engine::fetchCdtEntry(uint8 *animFile, uint16 frameNo) { * exceeds the number of frames in this anim */ -_frameHeader *Sword2Engine::fetchFrameHeader(uint8 *animFile, uint16 frameNo) { +FrameHeader *Sword2Engine::fetchFrameHeader(uint8 *animFile, uint16 frameNo) { // required address = (address of the start of the anim header) + frameOffset - return (_frameHeader *) (animFile + sizeof(_standardHeader) + fetchCdtEntry(animFile, frameNo)->frameOffset); + return (FrameHeader *) (animFile + sizeof(StandardHeader) + fetchCdtEntry(animFile, frameNo)->frameOffset); } /** * Returns a pointer to the requested parallax layer data. */ -_parallax *Sword2Engine::fetchBackgroundParallaxLayer(uint8 *screenFile, int layer) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); +Parallax *Sword2Engine::fetchBackgroundParallaxLayer(uint8 *screenFile, int layer) { + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); #ifdef _SWORD2_DEBUG if (mscreenHeader->bg_parallax[layer] == 0) error("fetchBackgroundParallaxLayer(%d) - No parallax layer exists", layer); #endif - return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]); + return (Parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]); } -_parallax *Sword2Engine::fetchBackgroundLayer(uint8 *screenFile) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); +Parallax *Sword2Engine::fetchBackgroundLayer(uint8 *screenFile) { + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); #ifdef _SWORD2_DEBUG if (mscreenHeader->screen == 0) error("fetchBackgroundLayer (%d) - No background layer exists"); #endif - return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader)); + return (Parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(ScreenHeader)); } -_parallax *Sword2Engine::fetchForegroundParallaxLayer(uint8 *screenFile, int layer) { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader)); +Parallax *Sword2Engine::fetchForegroundParallaxLayer(uint8 *screenFile, int layer) { + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) (screenFile + sizeof(StandardHeader)); #ifdef _SWORD2_DEBUG if (mscreenHeader->fg_parallax[layer] == 0) error("fetchForegroundParallaxLayer(%d) - No parallax layer exists", layer); #endif - return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]); + return (Parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]); } uint8 errorLine[128]; uint8 *Sword2Engine::fetchTextLine(uint8 *file, uint32 text_line) { - _standardHeader *fileHeader; + StandardHeader *fileHeader; uint32 *point; - _textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader)); + TextHeader *text_header = (TextHeader *) (file + sizeof(StandardHeader)); if (text_line >= text_header->noOfLines) { - fileHeader = (_standardHeader *) file; + fileHeader = (StandardHeader *) file; sprintf((char *) errorLine, "xxMissing line %d of %s (only 0..%d)", text_line, fileHeader->name, text_header->noOfLines - 1); @@ -204,15 +204,15 @@ uint8 *Sword2Engine::fetchTextLine(uint8 *file, uint32 text_line) { // Used for testing text & speech (see fnISpeak in speech.cpp) bool Sword2Engine::checkTextLine(uint8 *file, uint32 text_line) { - _textHeader *text_header = (_textHeader *) (file + sizeof(_standardHeader)); + TextHeader *text_header = (TextHeader *) (file + sizeof(StandardHeader)); return text_line < text_header->noOfLines; } uint8 *Sword2Engine::fetchObjectName(int32 resourceId) { - _standardHeader *header; + StandardHeader *header; - header = (_standardHeader *) _resman->openResource(resourceId); + header = (StandardHeader *) _resman->openResource(resourceId); _resman->closeResource(resourceId); // note this pointer is no longer valid, but it should be ok until diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 4fd1dd5478..1826f88285 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -49,7 +49,7 @@ enum { #pragma START_PACK_STRUCTS #endif -struct _cd_inf { +struct CdInf { uint8 clusterName[20]; // Null terminated cluster name. uint8 cd; // Cd cluster is on and whether it is on the local drive or not. } GCC_PACK; @@ -68,7 +68,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { File file; uint32 end; - mem *temp; + Memory *temp; uint32 pos = 0; uint32 j = 0; @@ -140,7 +140,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { error("init cannot *OPEN* cd.inf"); } - _cd_inf *cdInf = new _cd_inf[_totalClusters]; + CdInf *cdInf = new CdInf[_totalClusters]; for (j = 0; j < _totalClusters; j++) { file.read(cdInf[j].clusterName, sizeof(cdInf[j].clusterName)); @@ -172,7 +172,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { debug(5, "filename of cluster %d: -%s", j, _resourceFiles[j]); // create space for a list of pointers to mem's - _resList = (mem **) malloc(_totalResFiles * sizeof(mem *)); + _resList = (Memory **) malloc(_totalResFiles * sizeof(Memory *)); _age = (uint32 *) malloc(_totalResFiles * sizeof(uint32)); _count = (uint16 *) malloc(_totalResFiles * sizeof(uint16)); @@ -201,16 +201,16 @@ ResourceManager::~ResourceManager(void) { void convertEndian(uint8 *file, uint32 len) { int i; - _standardHeader *hdr = (_standardHeader *) file; + StandardHeader *hdr = (StandardHeader *) file; - file += sizeof(_standardHeader); + file += sizeof(StandardHeader); SWAP32(hdr->compSize); SWAP32(hdr->decompSize); switch (hdr->fileType) { case ANIMATION_FILE: { - _animHeader *animHead = (_animHeader *) file; + AnimHeader *animHead = (AnimHeader *) file; SWAP16(animHead->noAnimFrames); SWAP16(animHead->feetStartX); @@ -219,13 +219,13 @@ void convertEndian(uint8 *file, uint32 len) { SWAP16(animHead->feetEndY); SWAP16(animHead->blend); - _cdtEntry *cdtEntry = (_cdtEntry *) (file + sizeof(_animHeader)); + CdtEntry *cdtEntry = (CdtEntry *) (file + sizeof(AnimHeader)); for (i = 0; i < animHead->noAnimFrames; i++, cdtEntry++) { SWAP16(cdtEntry->x); SWAP16(cdtEntry->y); SWAP32(cdtEntry->frameOffset); - _frameHeader *frameHeader = (_frameHeader *) (file + cdtEntry->frameOffset); + FrameHeader *frameHeader = (FrameHeader *) (file + cdtEntry->frameOffset); // Quick trick to prevent us from incorrectly applying the endian // fixes multiple times. This assumes that frames are less than 1 MB // and have height/width less than 4096. @@ -240,7 +240,7 @@ void convertEndian(uint8 *file, uint32 len) { break; } case SCREEN_FILE: { - _multiScreenHeader *mscreenHeader = (_multiScreenHeader *) file; + MultiScreenHeader *mscreenHeader = (MultiScreenHeader *) file; SWAP32(mscreenHeader->palette); SWAP32(mscreenHeader->bg_parallax[0]); @@ -253,14 +253,14 @@ void convertEndian(uint8 *file, uint32 len) { SWAP32(mscreenHeader->maskOffset); // screenHeader - _screenHeader *screenHeader = (_screenHeader *) (file + mscreenHeader->screen); + ScreenHeader *screenHeader = (ScreenHeader *) (file + mscreenHeader->screen); SWAP16(screenHeader->width); SWAP16(screenHeader->height); SWAP16(screenHeader->noLayers); // layerHeader - _layerHeader *layerHeader = (_layerHeader *) (file + mscreenHeader->layers); + LayerHeader *layerHeader = (LayerHeader *) (file + mscreenHeader->layers); for (i = 0; i < screenHeader->noLayers; i++, layerHeader++) { SWAP16(layerHeader->x); SWAP16(layerHeader->y); @@ -271,26 +271,26 @@ void convertEndian(uint8 *file, uint32 len) { } // backgroundParallaxLayer - _parallax *parallax; + Parallax *parallax; int offset; offset = mscreenHeader->bg_parallax[0]; if (offset > 0) { - parallax = (_parallax *) (file + offset); + parallax = (Parallax *) (file + offset); SWAP16(parallax->w); SWAP16(parallax->h); } offset = mscreenHeader->bg_parallax[1]; if (offset > 0) { - parallax = (_parallax *) (file + offset); + parallax = (Parallax *) (file + offset); SWAP16(parallax->w); SWAP16(parallax->h); } // backgroundLayer - offset = mscreenHeader->screen + sizeof(_screenHeader); + offset = mscreenHeader->screen + sizeof(ScreenHeader); if (offset > 0) { - parallax = (_parallax *) (file + offset); + parallax = (Parallax *) (file + offset); SWAP16(parallax->w); SWAP16(parallax->h); } @@ -298,23 +298,23 @@ void convertEndian(uint8 *file, uint32 len) { // foregroundParallaxLayer offset = mscreenHeader->fg_parallax[0]; if (offset > 0) { - parallax = (_parallax *) (file + offset); + parallax = (Parallax *) (file + offset); SWAP16(parallax->w); SWAP16(parallax->h); } offset = mscreenHeader->fg_parallax[1]; if (offset > 0) { - parallax = (_parallax *) (file + offset); + parallax = (Parallax *) (file + offset); SWAP16(parallax->w); SWAP16(parallax->h); } break; } case GAME_OBJECT: { - _object_hub *objectHub = (_object_hub *) file; + ObjectHub *objectHub = (ObjectHub *) file; - objectHub->type = (int)SWAP_BYTES_32(objectHub->type); + objectHub->type = (int) SWAP_BYTES_32(objectHub->type); SWAP32(objectHub->logic_level); for (i = 0; i < TREE_SIZE; i++) { @@ -325,12 +325,12 @@ void convertEndian(uint8 *file, uint32 len) { break; } case WALK_GRID_FILE: { - _walkGridHeader *walkGridHeader = (_walkGridHeader *) file; + WalkGridHeader *walkGridHeader = (WalkGridHeader *) file; SWAP32(walkGridHeader->numBars); SWAP32(walkGridHeader->numNodes); - BarData *barData = (BarData *) (file + sizeof(_walkGridHeader)); + BarData *barData = (BarData *) (file + sizeof(WalkGridHeader)); for (i = 0; i < walkGridHeader->numBars; i++) { SWAP16(barData->x1); SWAP16(barData->y1); @@ -346,7 +346,7 @@ void convertEndian(uint8 *file, uint32 len) { barData++; } - uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(barData)); + uint16 *node = (uint16 *) (file + sizeof(WalkGridHeader) + walkGridHeader->numBars * sizeof(barData)); for (i = 0; i < walkGridHeader->numNodes * 2; i++) { SWAP16(*node); node++; @@ -367,7 +367,7 @@ void convertEndian(uint8 *file, uint32 len) { break; } case TEXT_FILE: { - _textHeader *textHeader = (_textHeader *) file; + TextHeader *textHeader = (TextHeader *) file; SWAP32(textHeader->noOfLines); break; } @@ -463,7 +463,7 @@ uint8 *ResourceManager::openResource(uint32 res, bool dump) { file.read(_resList[res]->ad, len); if (dump) { - _standardHeader *header = (_standardHeader *) _resList[res]->ad; + StandardHeader *header = (StandardHeader *) _resList[res]->ad; char buf[256]; char tag[10]; File out; @@ -743,7 +743,7 @@ void ResourceManager::printConsoleClusters(void) { } void ResourceManager::examine(int res) { - _standardHeader *file_header; + StandardHeader *file_header; if (res < 0 || res >= (int) _totalResFiles) Debug_Printf("Illegal resource %d (there are %d resources 0-%d)\n", res, _totalResFiles, _totalResFiles - 1); @@ -751,7 +751,7 @@ void ResourceManager::examine(int res) { Debug_Printf("%d is a null & void resource number\n", res); else { // open up the resource and take a look inside! - file_header = (_standardHeader *) openResource(res); + file_header = (StandardHeader *) openResource(res); // Debug_Printf("%d\n", file_header->fileType); // Debug_Printf("%s\n", file_header->name); @@ -855,7 +855,7 @@ void ResourceManager::killAll(bool wantInfo) { int j; uint32 res; uint32 nuked = 0; - _standardHeader *header; + StandardHeader *header; j = _vm->_memory->_baseMemBlock; @@ -866,7 +866,7 @@ void ResourceManager::killAll(bool wantInfo) { // not the global vars which are assumed to be open in // memory & not the player object! if (res != 1 && res != CUR_PLAYER_ID) { - header = (_standardHeader *) openResource(res); + header = (StandardHeader *) openResource(res); closeResource(res); _age[res] = 0; // effectively gone from _resList @@ -905,7 +905,7 @@ void ResourceManager::killAllObjects(bool wantInfo) { int j; uint32 res; uint32 nuked = 0; - _standardHeader *header; + StandardHeader *header; j = _vm->_memory->_baseMemBlock; @@ -915,7 +915,7 @@ void ResourceManager::killAllObjects(bool wantInfo) { //not the global vars which are assumed to be open in // memory & not the player object! if (res != 1 && res != CUR_PLAYER_ID) { - header = (_standardHeader *) openResource(res); + header = (StandardHeader *) openResource(res); closeResource(res); if (header->fileType == GAME_OBJECT) { @@ -964,8 +964,8 @@ void ResourceManager::getCd(int cd) { // CD2: "RBSII2" while (1) { - _keyboardEvent ke; - _mouseEvent *me; + KeyboardEvent ke; + MouseEvent *me; me = _vm->_input->mouseEvent(); if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) diff --git a/sword2/resman.h b/sword2/resman.h index 13b8a52756..f427d30093 100644 --- a/sword2/resman.h +++ b/sword2/resman.h @@ -74,7 +74,7 @@ public: void removeAll(void); // pointer to a pointer (or list of pointers in-fact) - mem **_resList; + Memory **_resList; private: Sword2Engine *_vm; diff --git a/sword2/router.cpp b/sword2/router.cpp index bc852ff117..f9ea8d1edb 100644 --- a/sword2/router.cpp +++ b/sword2/router.cpp @@ -154,7 +154,7 @@ void Router::freeAllRouteMem(void) { } } -int32 Router::routeFinder(Object_mega *ob_mega, Object_walkdata *ob_walkdata, int32 x, int32 y, int32 dir) { +int32 Router::routeFinder(ObjectMega *ob_mega, ObjectWalkdata *ob_walkdata, int32 x, int32 y, int32 dir) { /********************************************************************* * RouteFinder.C polygon router with modular walks * 21 august 94 @@ -705,7 +705,7 @@ bool Router::addSlowInFrames(WalkData *walkAnim) { return false; } -void Router::earlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata) { +void Router::earlySlowOut(ObjectMega *ob_mega, ObjectWalkdata *ob_walkdata) { int32 slowOutFrameNo; int32 walk_pc; WalkData *walkAnim; @@ -2105,7 +2105,7 @@ int32 Router::checkTarget(int32 x, int32 y) { // THE SETUP ROUTINES -void Router::loadWalkData(Object_walkdata *ob_walkdata) { +void Router::loadWalkData(ObjectWalkdata *ob_walkdata) { uint16 firstFrameOfDirection; uint16 walkFrameNo; uint32 frameCounter = 0; // starts at frame 0 of mega set @@ -2330,7 +2330,7 @@ void Router::extractRoute() { return; } -void Router::setUpWalkGrid(Object_mega *ob_mega, int32 x, int32 y, int32 dir) { +void Router::setUpWalkGrid(ObjectMega *ob_mega, int32 x, int32 y, int32 dir) { // get walk grid file + extra grid into 'bars' & 'node' arrays loadWalkGrid(); @@ -2395,7 +2395,7 @@ void Router::plotCross(int16 x, int16 y, uint8 colour) { } void Router::loadWalkGrid(void) { - _walkGridHeader floorHeader; + WalkGridHeader floorHeader; uint8 *fPolygrid; uint32 theseBars; uint32 theseNodes; @@ -2410,9 +2410,9 @@ void Router::loadWalkGrid(void) { if (_walkGridList[i]) { // open walk grid file fPolygrid = _vm->_resman->openResource(_walkGridList[i]); - fPolygrid += sizeof(_standardHeader); - memmove((uint8 *) &floorHeader, fPolygrid, sizeof(_walkGridHeader)); - fPolygrid += sizeof(_walkGridHeader); + fPolygrid += sizeof(StandardHeader); + memmove((uint8 *) &floorHeader, fPolygrid, sizeof(WalkGridHeader)); + fPolygrid += sizeof(WalkGridHeader); // how many bars & nodes are we getting from this // walkgrid file diff --git a/sword2/router.h b/sword2/router.h index f6d9ac4762..80f8cffdbb 100644 --- a/sword2/router.h +++ b/sword2/router.h @@ -105,7 +105,7 @@ private: // stores pointers to mem blocks containing routes created & used by // megas (NULL if slot not in use) - mem *_routeSlots[TOTAL_ROUTE_SLOTS]; + Memory *_routeSlots[TOTAL_ROUTE_SLOTS]; BarData _bars[O_GRID_SIZE]; NodeData _node[O_GRID_SIZE]; @@ -178,8 +178,8 @@ private: int32 getRoute(void); void extractRoute(void); void loadWalkGrid(void); - void setUpWalkGrid(Object_mega *ob_mega, int32 x, int32 y, int32 dir); - void loadWalkData(Object_walkdata *ob_walkdata); + void setUpWalkGrid(ObjectMega *ob_mega, int32 x, int32 y, int32 dir); + void loadWalkData(ObjectWalkdata *ob_walkdata); bool scan(int32 level); int32 newCheck(int32 status, int32 x1, int32 y1, int32 x2, int32 y2); @@ -223,9 +223,9 @@ public: memset(_leadingLeg, 0, sizeof(_leadingLeg)); } - int32 routeFinder(Object_mega *ob_mega, Object_walkdata *ob_walkdata, int32 x, int32 y, int32 dir); + int32 routeFinder(ObjectMega *ob_mega, ObjectWalkdata *ob_walkdata, int32 x, int32 y, int32 dir); - void earlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata); + void earlySlowOut(ObjectMega *ob_mega, ObjectWalkdata *ob_walkdata); void allocateRouteMem(void); WalkData *lockRouteMem(void); diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp index ad24b215f4..af0f0fe206 100644 --- a/sword2/save_rest.cpp +++ b/sword2/save_rest.cpp @@ -54,7 +54,7 @@ static void convertHeaderEndian(Sword2Engine::SaveGameHeader &header) { SWAP32(header.feet_y); SWAP32(header.music_id); - // _object_hub + // ObjectHub SWAP32(header.player_hub.type); SWAP32(header.player_hub.logic_level); for (i = 0; i < TREE_SIZE; i++) { @@ -63,16 +63,16 @@ static void convertHeaderEndian(Sword2Engine::SaveGameHeader &header) { SWAP32(header.player_hub.script_pc[i]); } - // Object_logic + // ObjectLogic SWAP32(header.logic.looping); SWAP32(header.logic.pause); - // Object_graphic + // ObjectGraphic SWAP32(header.graphic.type); SWAP32(header.graphic.anim_resource); SWAP32(header.graphic.anim_pc); - // Object_mega + // ObjectMega SWAP32(header.mega.currently_walking); SWAP32(header.mega.walk_pc); SWAP32(header.mega.scale_a); @@ -87,7 +87,7 @@ static void convertHeaderEndian(Sword2Engine::SaveGameHeader &header) { // SAVE GAME uint32 Sword2Engine::saveGame(uint16 slotNo, uint8 *desc) { - mem *saveBufferMem; + Memory *saveBufferMem; uint32 bufferSize; uint32 errorCode; @@ -117,7 +117,7 @@ uint32 Sword2Engine::findBufferSize(void) { return sizeof(_saveGameHeader) + _resman->fetchLen(1); } -void Sword2Engine::fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) { +void Sword2Engine::fillSaveBuffer(Memory *buffer, uint32 size, uint8 *desc) { uint8 *varsRes; // set up the _saveGameHeader @@ -144,7 +144,7 @@ void Sword2Engine::fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) { _saveGameHeader.music_id = _loopingMusicId; // object hub - memcpy(&_saveGameHeader.player_hub, _resman->openResource(CUR_PLAYER_ID) + sizeof(_standardHeader), sizeof(_object_hub)); + memcpy(&_saveGameHeader.player_hub, _resman->openResource(CUR_PLAYER_ID) + sizeof(StandardHeader), sizeof(ObjectHub)); _resman->closeResource(CUR_PLAYER_ID); // logic, graphic & mega structures @@ -169,8 +169,8 @@ void Sword2Engine::fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) { memcpy(buffer->ad + sizeof(_saveGameHeader), varsRes, FROM_LE_32(_saveGameHeader.varLength)); #ifdef SCUMM_BIG_ENDIAN - uint32 *globalVars = (uint32 *) (buffer->ad + sizeof(_saveGameHeader) + sizeof(_standardHeader)); - const uint numVars = (FROM_LE_32(_saveGameHeader.varLength) - sizeof(_standardHeader)) / 4; + uint32 *globalVars = (uint32 *) (buffer->ad + sizeof(_saveGameHeader) + sizeof(StandardHeader)); + const uint numVars = (FROM_LE_32(_saveGameHeader.varLength) - sizeof(StandardHeader)) / 4; for (uint i = 0; i < numVars; i++) globalVars[i] = SWAP_BYTES_32(globalVars[i]); @@ -217,7 +217,7 @@ uint32 Sword2Engine::saveData(uint16 slotNo, uint8 *buffer, uint32 bufferSize) { // RESTORE GAME uint32 Sword2Engine::restoreGame(uint16 slotNo) { - mem *saveBufferMem; + Memory *saveBufferMem; uint32 bufferSize; uint32 errorCode; @@ -290,7 +290,7 @@ uint32 Sword2Engine::restoreData(uint16 slotNo, uint8 *buffer, uint32 bufferSize } } -uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) { +uint32 Sword2Engine::restoreFromBuffer(Memory *buffer, uint32 size) { uint8 *varsRes; int32 pars[2]; @@ -337,7 +337,7 @@ uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) { // get player character data from savegame buffer // object hub is just after the standard header - memcpy(_resman->openResource(CUR_PLAYER_ID) + sizeof(_standardHeader), &_saveGameHeader.player_hub, sizeof(_object_hub)); + memcpy(_resman->openResource(CUR_PLAYER_ID) + sizeof(StandardHeader), &_saveGameHeader.player_hub, sizeof(ObjectHub)); _resman->closeResource(CUR_PLAYER_ID); @@ -353,8 +353,8 @@ uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) { memcpy(varsRes, buffer->ad + sizeof(_saveGameHeader), _saveGameHeader.varLength ); #ifdef SCUMM_BIG_ENDIAN - uint32 *globalVars = (uint32 *) (varsRes + sizeof(_standardHeader)); - const uint numVars = (_saveGameHeader.varLength - sizeof(_standardHeader)) / 4; + uint32 *globalVars = (uint32 *) (varsRes + sizeof(StandardHeader)); + const uint numVars = (_saveGameHeader.varLength - sizeof(StandardHeader)) / 4; for (uint i = 0; i < numVars; i++) globalVars[i] = SWAP_BYTES_32(globalVars[i]); @@ -462,9 +462,9 @@ void Sword2Engine::getPlayerStructures(void) { uint32 null_pc = 7; char *raw_script_ad; - _standardHeader *head; + StandardHeader *head; - head = (_standardHeader *) _resman->openResource(CUR_PLAYER_ID); + head = (StandardHeader *) _resman->openResource(CUR_PLAYER_ID); if (head->fileType != GAME_OBJECT) error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID); @@ -481,9 +481,9 @@ void Sword2Engine::putPlayerStructures(void) { uint32 null_pc; char *raw_script_ad; - _standardHeader *head; + StandardHeader *head; - head = (_standardHeader *) _resman->openResource(CUR_PLAYER_ID); + head = (StandardHeader *) _resman->openResource(CUR_PLAYER_ID); if (head->fileType != GAME_OBJECT) error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID); @@ -546,9 +546,9 @@ int32 Logic::fnPassPlayerSaveData(int32 *params) { // copy from player object to savegame header - memcpy(&_vm->_saveGameHeader.logic, _vm->_memory->intToPtr(params[0]), sizeof(Object_logic)); - memcpy(&_vm->_saveGameHeader.graphic, _vm->_memory->intToPtr(params[1]), sizeof(Object_graphic)); - memcpy(&_vm->_saveGameHeader.mega, _vm->_memory->intToPtr(params[2]), sizeof(Object_mega)); + memcpy(&_vm->_saveGameHeader.logic, _vm->_memory->intToPtr(params[0]), sizeof(ObjectLogic)); + memcpy(&_vm->_saveGameHeader.graphic, _vm->_memory->intToPtr(params[1]), sizeof(ObjectGraphic)); + memcpy(&_vm->_saveGameHeader.mega, _vm->_memory->intToPtr(params[2]), sizeof(ObjectMega)); // makes no odds return IR_CONT; @@ -562,17 +562,17 @@ int32 Logic::fnGetPlayerSaveData(int32 *params) { // 1 pointer to object's graphic structure // 2 pointer to object's mega structure - Object_logic *ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); - Object_graphic *ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[1]); - Object_mega *ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ObjectLogic *ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); + ObjectGraphic *ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[1]); + ObjectMega *ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); int32 pars[3]; // copy from savegame header to player object - memcpy((uint8 *) ob_logic, &_vm->_saveGameHeader.logic, sizeof(Object_logic)); - memcpy((uint8 *) ob_graphic, &_vm->_saveGameHeader.graphic, sizeof(Object_graphic)); - memcpy((uint8 *) ob_mega, &_vm->_saveGameHeader.mega, sizeof(Object_mega)); + memcpy((uint8 *) ob_logic, &_vm->_saveGameHeader.logic, sizeof(ObjectLogic)); + memcpy((uint8 *) ob_graphic, &_vm->_saveGameHeader.graphic, sizeof(ObjectGraphic)); + memcpy((uint8 *) ob_mega, &_vm->_saveGameHeader.mega, sizeof(ObjectMega)); // any walk-data must be cleared - the player will be set to stand if // he was walking when saved diff --git a/sword2/sound.cpp b/sword2/sound.cpp index 195b2b2176..d621b236ed 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -86,7 +86,7 @@ void Sword2Engine::triggerFx(uint8 j) { if (_fxQueue[j].type == FX_SPOT) { // load in the sample data = _resman->openResource(_fxQueue[j].resource); - data += sizeof(_standardHeader); + data += sizeof(StandardHeader); // wav data gets copied to sound memory rv = _sound->playFx(id, data, _fxQueue[j].volume, _fxQueue[j].pan, RDSE_FXSPOT); // release the sample @@ -160,7 +160,7 @@ int32 Logic::fnPlayFx(int32 *params) { uint32 rv; #ifdef _SWORD2_DEBUG - _standardHeader *header; + StandardHeader *header; #endif if (_vm->_wantSfxDebug) { @@ -210,7 +210,7 @@ int32 Logic::fnPlayFx(int32 *params) { data = _vm->_resman->openResource(_vm->_fxQueue[j].resource); #ifdef _SWORD2_DEBUG - header = (_standardHeader *) data; + header = (StandardHeader *) data; if (header->fileType != WAV_FILE) error("fnPlayFx given invalid resource"); #endif @@ -226,12 +226,12 @@ int32 Logic::fnPlayFx(int32 *params) { data = _vm->_resman->openResource(_vm->_fxQueue[j].resource); #ifdef _SWORD2_DEBUG - header = (_standardHeader *) data; + header = (StandardHeader *) data; if (header->fileType != WAV_FILE) error("fnPlayFx given invalid resource"); #endif - data += sizeof(_standardHeader); + data += sizeof(StandardHeader); // copy it to sound memory, using position in queue as 'id' rv = _vm->_sound->openFx(id, data); diff --git a/sword2/speech.cpp b/sword2/speech.cpp index 5422dd7c21..4c58d92c4e 100644 --- a/sword2/speech.cpp +++ b/sword2/speech.cpp @@ -86,7 +86,7 @@ int32 Logic::fnChoose(int32 *params) { // the human is switched off so there will be no normal mouse engine - _mouseEvent *me; + MouseEvent *me; uint32 i; int hit; uint8 *icon; @@ -156,7 +156,7 @@ int32 Logic::fnChoose(int32 *params) { for (i = 0; i < 15; i++) { if (i < IN_SUBJECT) { debug(5, " ICON res %d for %d", _subjectList[i].res, i); - icon = _vm->_resman->openResource(_subjectList[i].res) + sizeof(_standardHeader) + RDMENU_ICONWIDE * RDMENU_ICONDEEP; + icon = _vm->_resman->openResource(_subjectList[i].res) + sizeof(StandardHeader) + RDMENU_ICONWIDE * RDMENU_ICONDEEP; _vm->_graphics->setMenuIcon(RDMENU_BOTTOM, (uint8) i, icon); _vm->_resman->closeResource(_subjectList[i].res); } else { @@ -209,7 +209,7 @@ int32 Logic::fnChoose(int32 *params) { // change all others to grey if (i != (uint32) hit) { - icon = _vm->_resman->openResource(_subjectList[i].res) + sizeof(_standardHeader); + icon = _vm->_resman->openResource(_subjectList[i].res) + sizeof(StandardHeader); _vm->_graphics->setMenuIcon(RDMENU_BOTTOM, (uint8) i, icon); _vm->_resman->closeResource(_subjectList[i].res); } @@ -290,11 +290,11 @@ int32 Logic::fnTheyDo(int32 *params) { uint32 null_pc = 5; // 4th script - get-speech-state char *raw_script_ad; - _standardHeader *head; + StandardHeader *head; int32 target = params[0]; // request status of target - head = (_standardHeader *) _vm->_resman->openResource(target); + head = (StandardHeader *) _vm->_resman->openResource(target); if (head->fileType != GAME_OBJECT) error("fnTheyDo %d not an object", target); @@ -346,17 +346,17 @@ int32 Logic::fnTheyDoWeWait(int32 *params) { // 'looping' flag is used as a sent command yes/no - Object_logic *ob_logic; + ObjectLogic *ob_logic; uint32 null_pc = 5; // 4th script - get-speech-state char *raw_script_ad; - _standardHeader *head; + StandardHeader *head; int32 target = params[1]; // ok, see if the target is busy - we must request this info from the // target object - head = (_standardHeader *) _vm->_resman->openResource(target); + head = (StandardHeader *) _vm->_resman->openResource(target); if (head->fileType != GAME_OBJECT) error("fnTheyDoWeWait %d not an object", target); @@ -367,7 +367,7 @@ int32 Logic::fnTheyDoWeWait(int32 *params) { _vm->_resman->closeResource(target); - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (!INS_COMMAND && RESULT == 1 && ob_logic->looping == 0) { // first time so set up targets command if target is waiting @@ -432,11 +432,11 @@ int32 Logic::fnWeWait(int32 *params) { uint32 null_pc = 5; // 4th script - get-speech-state char *raw_script_ad; - _standardHeader *head; + StandardHeader *head; int32 target = params[0]; // request status of target - head = (_standardHeader *) _vm->_resman->openResource(target); + head = (StandardHeader *) _vm->_resman->openResource(target); if (head->fileType != GAME_OBJECT) error("fnWeWait: %d not an object", target); @@ -474,17 +474,17 @@ int32 Logic::fnTimedWait(int32 *params) { uint32 null_pc = 5; // 4th script - get-speech-state char *raw_script_ad; - Object_logic *ob_logic; - _standardHeader *head; + ObjectLogic *ob_logic; + StandardHeader *head; int32 target = params[1]; - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (!ob_logic->looping) ob_logic->looping = params[2]; // first time in // request status of target - head = (_standardHeader *) _vm->_resman->openResource(target); + head = (StandardHeader *) _vm->_resman->openResource(target); if (head->fileType != GAME_OBJECT) error("fnTimedWait %d not an object", target); @@ -556,10 +556,10 @@ int32 Logic::fnSpeechProcess(int32 *params) { // note - we could save a var and ditch wait_state and check // 'command' for non zero means busy - Object_speech *ob_speech; + ObjectSpeech *ob_speech; int32 pars[9]; - ob_speech = (Object_speech *) _vm->_memory->intToPtr(params[1]); + ob_speech = (ObjectSpeech *) _vm->_memory->intToPtr(params[1]); debug(5, " SP"); @@ -851,11 +851,11 @@ int32 Logic::fnISpeak(int32 *params) { // 8 animation mode 0 lip synced, // 1 just straight animation - _mouseEvent *me; - _animHeader *anim_head; - Object_logic *ob_logic; - Object_graphic *ob_graphic; - Object_mega *ob_mega; + MouseEvent *me; + AnimHeader *anim_head; + ObjectLogic *ob_logic; + ObjectGraphic *ob_graphic; + ObjectMega *ob_mega; uint8 *anim_file; uint32 local_text; uint32 text_res; @@ -869,12 +869,12 @@ int32 Logic::fnISpeak(int32 *params) { uint32 rv; // for text/speech testing & checking for correct file type - _standardHeader *head; + StandardHeader *head; // set up the pointers which we know we'll always need - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[S_OB_LOGIC]); - ob_graphic = (Object_graphic *) _vm->_memory->intToPtr(params[S_OB_GRAPHIC]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[S_OB_LOGIC]); + ob_graphic = (ObjectGraphic *) _vm->_memory->intToPtr(params[S_OB_GRAPHIC]); // FIRST TIME ONLY: create the text, load the wav, set up the anim, // etc. @@ -926,7 +926,7 @@ int32 Logic::fnISpeak(int32 *params) { if (_vm->_resman->checkValid(text_res)) { // open the resource - head = (_standardHeader *) _vm->_resman->openResource(text_res); + head = (StandardHeader *) _vm->_resman->openResource(text_res); if (head->fileType == TEXT_FILE) { // if it's not an animation file @@ -1016,7 +1016,7 @@ int32 Logic::fnISpeak(int32 *params) { // use this direction table to derive the anim // NB. ASSUMES WE HAVE A MEGA OBJECT!! - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[S_OB_MEGA]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[S_OB_MEGA]); // pointer to anim table anim_table = (int32 *) _vm->_memory->intToPtr(params[S_DIR_TABLE]); @@ -1294,12 +1294,12 @@ void Logic::locateTalker(int32 *params) { // 8 animation mode 0 lip synced, // 1 just straight animation - Object_mega *ob_mega; + ObjectMega *ob_mega; uint8 *file; - _frameHeader *frame_head; - _animHeader *anim_head; - _cdtEntry *cdt_entry; + FrameHeader *frame_head; + AnimHeader *anim_head; + CdtEntry *cdt_entry; uint16 scale; // if there's no anim @@ -1327,7 +1327,7 @@ void Logic::locateTalker(int32 *params) { if (cdt_entry->frameType & FRAME_OFFSET) { // this may be NULL - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[S_OB_MEGA]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[S_OB_MEGA]); // calc scale at which to print the sprite, based on // feet y-coord & scaling constants (NB. 'scale' is @@ -1394,13 +1394,13 @@ void Logic::formText(int32 *params) { uint32 text_res; uint8 *text; uint32 textWidth; - Object_speech *ob_speech; + ObjectSpeech *ob_speech; // should always be a text line, as all text is derived from line of // text if (params[S_TEXT]) { - ob_speech = (Object_speech *) _vm->_memory->intToPtr(params[S_OB_SPEECH]); + ob_speech = (ObjectSpeech *) _vm->_memory->intToPtr(params[S_OB_SPEECH]); // establish the max width allowed for this text sprite diff --git a/sword2/startup.cpp b/sword2/startup.cpp index 6ce17fbcf8..39feff5915 100644 --- a/sword2/startup.cpp +++ b/sword2/startup.cpp @@ -209,7 +209,7 @@ void Logic::conStart(int start) { // reopen global variables resource & send address to // interpreter - it won't be moving - setGlobalInterpreterVariables((int32 *) (_vm->_resman->openResource(1) + sizeof(_standardHeader))); + setGlobalInterpreterVariables((int32 *) (_vm->_resman->openResource(1) + sizeof(StandardHeader))); _vm->_resman->closeResource(1); // free all the route memory blocks from previous game diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index bf33cf186a..239ca551dd 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -226,7 +226,7 @@ int32 Sword2Engine::initialiseGame(void) { // res 1 is the globals list file = _resman->openResource(1); debug(5, "CALLING: SetGlobalInterpreterVariables"); - _logic->setGlobalInterpreterVariables((int32 *) (file + sizeof(_standardHeader))); + _logic->setGlobalInterpreterVariables((int32 *) (file + sizeof(StandardHeader))); // DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF // MEMORY SO IT CAN'T MOVE! @@ -268,7 +268,7 @@ void Sword2Engine::gameCycle(void) { if (_logic->getRunList()) { // run the logic session UNTIL a full loop has been performed do { - // reset the graphic 'buildit' list before a new + // reset the graphic 'BuildUnit' list before a new // logic list (see fnRegisterFrame) resetRenderLists(); @@ -296,7 +296,7 @@ void Sword2Engine::gameCycle(void) { } void Sword2Engine::go() { - _keyboardEvent ke; + KeyboardEvent ke; debug(5, "CALLING: readOptionSettings"); _gui->readOptionSettings(); diff --git a/sword2/sword2.h b/sword2/sword2.h index 8c21fff42a..0b24824fe6 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -55,7 +55,7 @@ private: // structure filled out by each object to register its graphic printing // requrements - struct buildit { + struct BuildUnit { int16 x; int16 y; uint16 scaled_width; @@ -80,13 +80,13 @@ private: bool shadingFlag; }; - buildit _bgp0List[MAX_bgp0_sprites]; - buildit _bgp1List[MAX_bgp1_sprites]; - buildit _backList[MAX_back_sprites]; - buildit _sortList[MAX_sort_sprites]; - buildit _foreList[MAX_fore_sprites]; - buildit _fgp0List[MAX_fgp0_sprites]; - buildit _fgp1List[MAX_fgp1_sprites]; + BuildUnit _bgp0List[MAX_bgp0_sprites]; + BuildUnit _bgp1List[MAX_bgp1_sprites]; + BuildUnit _backList[MAX_back_sprites]; + BuildUnit _sortList[MAX_sort_sprites]; + BuildUnit _foreList[MAX_fore_sprites]; + BuildUnit _fgp0List[MAX_fgp0_sprites]; + BuildUnit _fgp1List[MAX_fgp1_sprites]; // Holds the order of the sort list, i.e. the list stays static and we // sort this array. @@ -152,13 +152,13 @@ public: void resetRenderLists(void); void buildDisplay(void); - void processImage(buildit *build_unit); + void processImage(BuildUnit *build_unit); void displayMsg(uint8 *text, int time); void removeMsg(void); void setFullPalette(int32 palRes); int32 registerFrame(int32 *params); - void registerFrame(int32 *params, buildit *build_unit); + void registerFrame(int32 *params, BuildUnit *build_unit); // The debugger wants to access these @@ -191,12 +191,12 @@ public: int32 initBackground(int32 res, int32 new_palette); // Set by fnPassMega() - Object_mega _engineMega; + ObjectMega _engineMega; - menu_object _tempList[TOTAL_engine_pockets]; + MenuObject _tempList[TOTAL_engine_pockets]; uint32 _totalTemp; - menu_object _masterMenuList[TOTAL_engine_pockets]; + MenuObject _masterMenuList[TOTAL_engine_pockets]; uint32 _totalMasters; int menuClick(int menu_items); @@ -207,12 +207,12 @@ public: // _thisScreen describes the current back buffer and its in-game scroll // positions, etc. - screen_info _thisScreen; + ScreenInfo _thisScreen; void setUpBackgroundLayers(void); uint32 _curMouse; - Mouse_unit _mouseList[TOTAL_mouse_list]; + MouseUnit _mouseList[TOTAL_mouse_list]; // Set by checkMouseList() uint32 _mouseTouching; @@ -260,19 +260,19 @@ public: void monitorPlayerActivity(void); void noHuman(void); - void registerMouse(Object_mouse *ob_mouse); + void registerMouse(ObjectMouse *ob_mouse); uint8 *fetchPalette(uint8 *screenFile); - _screenHeader *fetchScreenHeader(uint8 *screenFile); - _layerHeader *fetchLayerHeader(uint8 *screenFile, uint16 layerNo); + ScreenHeader *fetchScreenHeader(uint8 *screenFile); + LayerHeader *fetchLayerHeader(uint8 *screenFile, uint16 layerNo); uint8 *fetchShadingMask(uint8 *screenFile); - _animHeader *fetchAnimHeader(uint8 *animFile); - _cdtEntry *fetchCdtEntry(uint8 *animFile, uint16 frameNo); - _frameHeader *fetchFrameHeader(uint8 *animFile, uint16 frameNo); - _parallax *fetchBackgroundParallaxLayer(uint8 *screenFile, int layer); - _parallax *fetchBackgroundLayer(uint8 *screenFile); - _parallax *fetchForegroundParallaxLayer(uint8 *screenFile, int layer); + AnimHeader *fetchAnimHeader(uint8 *animFile); + CdtEntry *fetchCdtEntry(uint8 *animFile, uint16 frameNo); + FrameHeader *fetchFrameHeader(uint8 *animFile, uint16 frameNo); + Parallax *fetchBackgroundParallaxLayer(uint8 *screenFile, int layer); + Parallax *fetchBackgroundLayer(uint8 *screenFile); + Parallax *fetchForegroundParallaxLayer(uint8 *screenFile, int layer); uint8 *fetchTextLine(uint8 *file, uint32 text_line); bool checkTextLine(uint8 *file, uint32 text_line); uint8 *fetchPaletteMatchTable(uint8 *screenFile); @@ -293,14 +293,14 @@ public: uint32 feet_x; // copy of _thisScreen.feet_x uint32 feet_y; // copy of _thisScreen.feet_y uint32 music_id; // copy of 'looping_music_id' - _object_hub player_hub; // copy of player object's object_hub structure - Object_logic logic; // copy of player character logic structure + ObjectHub player_hub; // copy of player object's object_hub structure + ObjectLogic logic; // copy of player character logic structure // copy of player character graphic structure - Object_graphic graphic; + ObjectGraphic graphic; // copy of player character mega structure - Object_mega mega; + ObjectMega mega; }; SaveGameHeader _saveGameHeader; @@ -309,15 +309,15 @@ public: uint32 restoreGame(uint16 slotNo); uint32 getSaveDescription(uint16 slotNo, uint8 *description); bool saveExists(uint16 slotNo); - void fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc); - uint32 restoreFromBuffer(mem *buffer, uint32 size); + void fillSaveBuffer(Memory *buffer, uint32 size, uint8 *desc); + uint32 restoreFromBuffer(Memory *buffer, uint32 size); uint32 findBufferSize(void); uint8 _scrollFraction; void setScrolling(void); - struct _fxq_entry { + struct FxQueueEntry { uint32 resource; // resource id of sample uint32 fetchId; // Id of resource in PSX CD queue. :) uint16 delay; // cycles to wait before playing (or 'random chance' if FX_RANDOM) @@ -326,7 +326,7 @@ public: uint8 type; // FX_SPOT, FX_RANDOM or FX_LOOP }; - _fxq_entry _fxQueue[FXQ_LENGTH]; + FxQueueEntry _fxQueue[FXQ_LENGTH]; // used to store id of tunes that loop, for save & restore uint32 _loopingMusicId; diff --git a/sword2/walker.cpp b/sword2/walker.cpp index 63b5f3a436..f90ff5e3cf 100644 --- a/sword2/walker.cpp +++ b/sword2/walker.cpp @@ -42,10 +42,10 @@ int32 Logic::fnWalk(int32 *params) { // 5 target y-coord // 6 target direction - Object_logic *ob_logic; - Object_graphic *ob_graph; - Object_mega *ob_mega; - Object_walkdata *ob_walkdata; + ObjectLogic *ob_logic; + ObjectGraphic *ob_graph; + ObjectMega *ob_mega; + ObjectWalkdata *ob_walkdata; int16 target_x; int16 target_y; uint8 target_dir; @@ -55,9 +55,9 @@ int32 Logic::fnWalk(int32 *params) { // get the parameters - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); - ob_graph = (Object_graphic *) _vm->_memory->intToPtr(params[1]); - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); + ob_graph = (ObjectGraphic *) _vm->_memory->intToPtr(params[1]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); target_x = (int16) params[4]; target_y = (int16) params[5]; @@ -83,7 +83,7 @@ int32 Logic::fnWalk(int32 *params) { if (params[6] < 0 || params[6] > 8) error("Invalid direction (%d) in fnWalk", params[6]); - ob_walkdata = (Object_walkdata *) _vm->_memory->intToPtr(params[3]); + ob_walkdata = (ObjectWalkdata *) _vm->_memory->intToPtr(params[3]); ob_mega->walk_pc = 0; // always @@ -165,7 +165,7 @@ int32 Logic::fnWalk(int32 *params) { if (checkEventWaiting()) { if (walkAnim[walk_pc].step == 0 && walkAnim[walk_pc + 1].step == 1) { // at the beginning of a step - ob_walkdata = (Object_walkdata *) _vm->_memory->intToPtr(params[3]); + ob_walkdata = (ObjectWalkdata *) _vm->_memory->intToPtr(params[3]); _router->earlySlowOut(ob_mega, ob_walkdata); } } @@ -243,14 +243,14 @@ int32 Logic::fnWalkToAnim(int32 *params) { // 3 pointer to object's walkdata structure // 4 anim resource id - Object_logic *ob_logic; + ObjectLogic *ob_logic; uint8 *anim_file; - _animHeader *anim_head; + AnimHeader *anim_head; int32 pars[7]; // if this is the start of the walk, read anim file to get start coords - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { // open anim file @@ -308,20 +308,20 @@ int32 Logic::fnTurn(int32 *params) { // 3 pointer to object's walkdata structure // 4 target direction - Object_logic *ob_logic; - Object_mega *ob_mega; + ObjectLogic *ob_logic; + ObjectMega *ob_mega; int32 pars[7]; // if this is the start of the turn, get the mega's current feet // coords + the required direction - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { if (params[4] < 0 || params[4] > 7) error("Invalid direction (%d) in fnTurn", params[4]); - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); pars[4] = ob_mega->feet_x; pars[5] = ob_mega->feet_y; @@ -352,8 +352,8 @@ int32 Logic::fnStandAt(int32 *params) { // 3 target y-coord // 4 target direction - Object_mega *ob_mega; - Object_graphic *ob_graph; + ObjectMega *ob_mega; + ObjectGraphic *ob_graph; // check for invalid direction @@ -362,8 +362,8 @@ int32 Logic::fnStandAt(int32 *params) { // set up pointers to the graphic & mega structure - ob_graph = (Object_graphic *) _vm->_memory->intToPtr(params[0]); - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[1]); + ob_graph = (ObjectGraphic *) _vm->_memory->intToPtr(params[0]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[1]); // set up the stand frame & set the mega's new direction @@ -389,7 +389,7 @@ int32 Logic::fnStand(int32 *params) { // 1 pointer to object's mega structure // 2 target direction - Object_mega *ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[1]); + ObjectMega *ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[1]); int32 pars[5]; pars[0] = params[0]; @@ -412,7 +412,7 @@ int32 Logic::fnStandAfterAnim(int32 *params) { // 2 anim resource id uint8 *anim_file; - _animHeader *anim_head; + AnimHeader *anim_head; int32 pars[5]; // open the anim file & set up a pointer to the animation header @@ -459,7 +459,7 @@ int32 Logic::fnStandAtAnim(int32 *params) { // 2 anim resource id uint8 *anim_file; - _animHeader *anim_head; + AnimHeader *anim_head; int32 pars[5]; // open the anim file & set up a pointer to the animation header @@ -544,17 +544,17 @@ int32 Logic::fnFaceXY(int32 *params) { // 4 target x-coord // 5 target y-coord - Object_logic *ob_logic; - Object_mega *ob_mega; + ObjectLogic *ob_logic; + ObjectMega *ob_mega; int32 pars[7]; // if this is the start of the turn, get the mega's current feet // coords + the required direction - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); pars[4] = ob_mega->feet_x; pars[5] = ob_mega->feet_y; @@ -582,16 +582,16 @@ int32 Logic::fnFaceMega(int32 *params) { uint32 null_pc = 3; // get ob_mega char *raw_script_ad; int32 pars[7]; - Object_logic *ob_logic; - Object_mega *ob_mega; - _standardHeader *head; + ObjectLogic *ob_logic; + ObjectMega *ob_mega; + StandardHeader *head; - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); if (ob_logic->looping == 0) { // get targets info - head = (_standardHeader *) _vm->_resman->openResource(params[4]); + head = (StandardHeader *) _vm->_resman->openResource(params[4]); if (head->fileType != GAME_OBJECT) error("fnFaceMega %d not an object", params[4]); @@ -603,7 +603,7 @@ int32 Logic::fnFaceMega(int32 *params) { _vm->_resman->closeResource(params[4]); - // engineMega is now the Object_mega of mega we want to turn + // engineMega is now the ObjectMega of mega we want to turn // to face pars[3] = params[3]; @@ -632,18 +632,18 @@ int32 Logic::fnWalkToTalkToMega(int32 *params) { // 4 id of target mega to face // 5 distance - Object_mega *ob_mega; - Object_logic *ob_logic; + ObjectMega *ob_mega; + ObjectLogic *ob_logic; uint32 null_pc = 3; // 4th script - get mega char *raw_script_ad; int32 pars[7]; int scale; int mega_separation = params[5]; - _standardHeader *head; + StandardHeader *head; - ob_logic = (Object_logic *) _vm->_memory->intToPtr(params[0]); - ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[2]); + ob_logic = (ObjectLogic *) _vm->_memory->intToPtr(params[0]); + ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[2]); pars[0] = params[0]; // standard stuff pars[1] = params[1]; @@ -653,7 +653,7 @@ int32 Logic::fnWalkToTalkToMega(int32 *params) { // not been here before so decide where to walk-to if (!ob_logic->looping) { // first request the targets info - head = (_standardHeader *) _vm->_resman->openResource(params[4]); + head = (StandardHeader *) _vm->_resman->openResource(params[4]); if (head->fileType != GAME_OBJECT) error("fnWalkToTalkToMega %d not an object", params[4]); @@ -666,7 +666,7 @@ int32 Logic::fnWalkToTalkToMega(int32 *params) { _vm->_resman->closeResource(params[4]); - // engineMega is now the Object_mega of mega we want to + // engineMega is now the ObjectMega of mega we want to // route to // stand exactly beside the mega, ie. at same y-coord @@ -766,7 +766,7 @@ int32 Logic::fnSetScaling(int32 *params) { // where s is system scale, which itself is (256 * actual_scale) ie. // s == 128 is half size - Object_mega *ob_mega = (Object_mega *) _vm->_memory->intToPtr(params[0]); + ObjectMega *ob_mega = (ObjectMega *) _vm->_memory->intToPtr(params[0]); ob_mega->scale_a = params[1]; ob_mega->scale_b = params[2]; |