From dee9b3bd870843d197678b8f6bc44b46561c5778 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 4 Jan 2005 17:15:53 +0000 Subject: [PATCH] o Fix regression with Win32 CD ITE at wyrmkeep logo o Support for sprites in Mac versions o Improvements on scene flags o More code on proper interface modes handling. Just a tiny bit was committed as other stuff breaks intro due to incompleteness. svn-id: r16425 --- saga/saga.h | 32 +++++++++++------------ saga/scene.cpp | 3 +++ saga/scene.h | 6 +++++ saga/sprite.cpp | 68 ++++++++++++++++++++----------------------------- saga/sprite.h | 2 +- saga/xref.txt | 4 +++ 6 files changed, 58 insertions(+), 57 deletions(-) diff --git a/saga/saga.h b/saga/saga.h index 942dd06c85e..fe3fe496f48 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -139,24 +139,24 @@ enum GAME_IDS { GID_ITE_DISK_DE, GID_ITE_AMIGACD_DE, // TODO GID_ITE_OLDMAC_DE, // TODO - GID_ITE_AMIGA_FL_DE, + GID_ITE_AMIGA_FL_DE,// TODO GID_ITE_CD_DE, // don't have it - GID_ITE_AMIGA_AGA_DEMO, - GID_ITE_AMIGA_ECS_DEMO, + GID_ITE_AMIGA_AGA_DEMO, // TODO + GID_ITE_AMIGA_ECS_DEMO, // TODO GID_IHNM_DEMO, GID_IHNM_CD }; enum GAME_FILETYPES { - GAME_RESOURCEFILE = 0x01, - GAME_SCRIPTFILE = 0x02, - GAME_SOUNDFILE = 0x04, - GAME_VOICEFILE = 0x08, - GAME_DEMOFILE = 0x10, - GAME_MUSICFILE = 0x20, - GAME_MUSICFILE_GM = 0x40, - GAME_MUSICFILE_FM = 0x80 + GAME_RESOURCEFILE = 1 << 0, + GAME_SCRIPTFILE = 1 << 1, + GAME_SOUNDFILE = 1 << 2, + GAME_VOICEFILE = 1 << 3, + GAME_DEMOFILE = 1 << 4, + GAME_MUSICFILE = 1 << 5, + GAME_MUSICFILE_GM = 1 << 6, + GAME_MUSICFILE_FM = 1 << 7 }; enum GAME_SOUNDINFO_TYPES { @@ -177,11 +177,11 @@ enum GAME_FONT_IDS { }; enum GAME_FEATURES { - GF_VOX_VOICES = 1, - GF_BIG_ENDIAN_DATA = 2, - GF_MAC_RESOURCES = 4, - GF_LANG_DE = 8, - GF_WYRMKEEP = 16 + GF_VOX_VOICES = 1 << 0, + GF_BIG_ENDIAN_DATA = 1 << 1, + GF_MAC_RESOURCES = 1 << 2, + GF_LANG_DE = 1 << 3, + GF_WYRMKEEP = 1 << 4 }; struct GAME_DISPLAYINFO { diff --git a/saga/scene.cpp b/saga/scene.cpp index 18b3e42a4bf..9ad1e17e43d 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -678,6 +678,9 @@ int Scene::loadScene(int scene_num, int load_flag, SCENE_PROC scene_proc, SCENE_ _vm->_actor->updateActorsScene(); + if (_desc.flags & kSceneFlagShowCursor) + _vm->_interface->activate(); + return SUCCESS; } diff --git a/saga/scene.h b/saga/scene.h index a5679fb4689..8530c256134 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -209,6 +209,11 @@ struct INTRO_CREDIT { }; +enum SceneFlags { + kSceneFlagISO = 1, + kSceneFlagShowCursor = 2 +}; + class Scene { public: Scene(SagaEngine *vm); @@ -228,6 +233,7 @@ class Scene { int queueScene(SCENE_QUEUE *scene_queue); int draw(SURFACE *); int getMode(); + int getFlags() { return _desc.flags; } void getBGMaskInfo(int &width, int &height, byte *&buffer, size_t &bufferLength); int isBGMaskPresent() { diff --git a/saga/sprite.cpp b/saga/sprite.cpp index f0e61e48f6c..0f0a335bde8 100644 --- a/saga/sprite.cpp +++ b/saga/sprite.cpp @@ -98,7 +98,10 @@ int Sprite::loadList(int resource_num, SPRITELIST **sprite_list_p) { for (i = 0; i < sprite_count; i++) { new_slist->offset_list[i].data_idx = 0; - new_slist->offset_list[i].offset = readS.readUint16(); + if (_vm->_features & GF_MAC_RESOURCES) + new_slist->offset_list[i].offset = readS.readUint32(); + else + new_slist->offset_list[i].offset = readS.readUint16(); } new_slist->slist_rn = resource_num; @@ -200,7 +203,7 @@ int Sprite::draw(SURFACE *ds, SPRITELIST *sprite_list, int sprite_num, const Poi assert(sprite_p); - MemoryReadStreamEndian readS(sprite_p, 8, IS_BIG_ENDIAN); + MemoryReadStream readS(sprite_p, 8); if (!(_vm->_features & GF_MAC_RESOURCES)) { x_align = readS.readSByte(); y_align = readS.readSByte(); @@ -208,11 +211,11 @@ int Sprite::draw(SURFACE *ds, SPRITELIST *sprite_list, int sprite_num, const Poi so_width = s_width = readS.readByte(); so_height = s_height = readS.readByte(); } else { - x_align = readS.readSint16(); - y_align = readS.readSint16(); + x_align = readS.readSint16BE(); + y_align = readS.readSint16BE(); - so_width = s_width = readS.readUint16(); - so_height = s_height = readS.readUint16(); + so_width = s_width = readS.readUint16BE(); + so_height = s_height = readS.readUint16BE(); } spr_pt.x = screenCoord.x + x_align; spr_pt.y = screenCoord.y + y_align; @@ -314,15 +317,23 @@ int Sprite::drawOccluded(SURFACE *ds, SPRITELIST *sprite_list, int sprite_num, c sprite_p = sprite_list->sprite_data[offset_idx]; sprite_p += offset; - MemoryReadStreamEndian readS(sprite_p, 5, IS_BIG_ENDIAN); + MemoryReadStream readS(sprite_p, 8); // Read sprite dimensions -- should probably cache this stuff in // sprite list - x_align = readS.readSByte(); - y_align = readS.readSByte(); + if (!(_vm->_features & GF_MAC_RESOURCES)) { + x_align = readS.readSByte(); + y_align = readS.readSByte(); - so_width = s_width = readS.readByte(); - so_height = s_height = readS.readByte(); + so_width = s_width = readS.readByte(); + so_height = s_height = readS.readByte(); + } else { + x_align = readS.readSint16BE(); + y_align = readS.readSint16BE(); + + so_width = s_width = readS.readUint16BE(); + so_height = s_height = readS.readUint16BE(); + } sprite_data_p = sprite_p + readS.pos(); @@ -384,48 +395,29 @@ int Sprite::drawOccluded(SURFACE *ds, SPRITELIST *sprite_list, int sprite_num, c mask_row_p += maskWidth; src_row_p += s_width; } -/* - { - char buf[1024] = { 0 }; - sprintf(buf, "dw: %d, dh: %d.", ci.draw_w, ci.draw_h); - _vm->textDraw(2, ds, buf, spr_x - x_align, spr_y - y_align, 255, 0, FONT_OUTLINE); - } -*/ return SUCCESS; } int Sprite::decodeRLESprite(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len) { int bg_runcount; int fg_runcount; - const byte *inbuf_ptr; byte *outbuf_ptr; - const byte *inbuf_end; byte *outbuf_end; int c; - inbuf_ptr = inbuf; outbuf_ptr = outbuf; - inbuf_end = inbuf + (inbuf_len); - inbuf_end--; - outbuf_end = outbuf + outbuf_len; outbuf_end--; memset(outbuf, 0, outbuf_len); - while ((inbuf_ptr < inbuf_end) && (outbuf_ptr < outbuf_end)) { - bg_runcount = *inbuf_ptr; - if (inbuf_ptr < inbuf_end) - inbuf_ptr++; - else - return 0; - fg_runcount = *inbuf_ptr; - if (inbuf_ptr < inbuf_end) - inbuf_ptr++; - else - return 0; + MemoryReadStream readS(inbuf, inbuf_len); + + while (!readS.eof() && (outbuf_ptr < outbuf_end)) { + bg_runcount = readS.readByte(); + fg_runcount = readS.readByte(); for (c = 0; c < bg_runcount; c++) { *outbuf_ptr = (byte) 0; @@ -436,11 +428,7 @@ int Sprite::decodeRLESprite(const byte *inbuf, size_t inbuf_len, byte *outbuf, s } for (c = 0; c < fg_runcount; c++) { - *outbuf_ptr = *inbuf_ptr; - if (inbuf_ptr < inbuf_end) - inbuf_ptr++; - else - return 0; + *outbuf_ptr = readS.readByte(); if (outbuf_ptr < outbuf_end) outbuf_ptr++; else diff --git a/saga/sprite.h b/saga/sprite.h index 0a956f6a6b7..be64c0a83d2 100644 --- a/saga/sprite.h +++ b/saga/sprite.h @@ -45,7 +45,7 @@ struct SPRITELIST_ENTRY { struct SPRITELIST_OFFSET { uint16 data_idx; - size_t offset; + uint32 offset; }; struct SPRITELIST { diff --git a/saga/xref.txt b/saga/xref.txt index ae55958ae44..de66d6fd9a1 100644 --- a/saga/xref.txt +++ b/saga/xref.txt @@ -115,3 +115,7 @@ Resource.h PicHeader.width IMAGE_HEADER.width PicHeader.height IMAGE_HEADER.height + +Process.c +========= + mainPanelMode Interface::_inMainMode