From 3e7feb5cb176d3c4504317f8d342b0d0c6629df7 Mon Sep 17 00:00:00 2001 From: Andrew Kurushin Date: Wed, 10 Aug 2005 18:27:18 +0000 Subject: fixed iso convertion Rif position add some IHNM panels svn-id: r18652 --- saga/actor.cpp | 2 +- saga/game.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ saga/interface.cpp | 13 ++++++++----- saga/interface.h | 8 +++----- saga/saga.h | 3 +++ saga/script.h | 9 +++++++-- 6 files changed, 70 insertions(+), 19 deletions(-) diff --git a/saga/actor.cpp b/saga/actor.cpp index e305b997dd..70e379d157 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -647,7 +647,7 @@ void Actor::realLocation(Location &location, uint16 objectId, uint16 walkFlags) distance = location.y; location.u() = (angleLUT[angle][0] * distance) >> 8; - location.v() = (angleLUT[angle][1] * distance) >> 8; + location.v() = -(angleLUT[angle][1] * distance) >> 8; } else { angle = location.x & 15; distance = location.y; diff --git a/saga/game.cpp b/saga/game.cpp index 736be9f262..b641fb9b43 100644 --- a/saga/game.cpp +++ b/saga/game.cpp @@ -37,6 +37,15 @@ #include "saga/scene.h" #include "saga/resnames.h" +#define ITE_CONVERSE_MAX_TEXT_WIDTH (256 - 60) +#define ITE_CONVERSE_TEXT_HEIGHT 10 +#define ITE_CONVERSE_TEXT_LINES 4 + +//TODO: ihnm +#define IHNM_CONVERSE_MAX_TEXT_WIDTH (256 - 60) +#define IHNM_CONVERSE_TEXT_HEIGHT 10 +#define IHNM_CONVERSE_TEXT_LINES 10 + namespace Saga { static int detectGame(const FSList &fslist, bool mode = false, int start = -1); @@ -66,10 +75,10 @@ static PanelButton ITE_MainPanelButtons[] = { }; static PanelButton ITE_ConversePanelButtons[] = { - {kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 0, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 0,'1',0, 0,0,0}, - {kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 1, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 1,'2',0, 0,0,0}, - {kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 2, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 2,'3',0, 0,0,0}, - {kPanelButtonConverseText, 52,6 + CONVERSE_TEXT_HEIGHT * 3, CONVERSE_MAX_TEXT_WIDTH,CONVERSE_TEXT_HEIGHT, 3,'4',0, 0,0,0}, + {kPanelButtonConverseText, 52,6 + ITE_CONVERSE_TEXT_HEIGHT * 0, ITE_CONVERSE_MAX_TEXT_WIDTH,ITE_CONVERSE_TEXT_HEIGHT, 0,'1',0, 0,0,0}, + {kPanelButtonConverseText, 52,6 + ITE_CONVERSE_TEXT_HEIGHT * 1, ITE_CONVERSE_MAX_TEXT_WIDTH,ITE_CONVERSE_TEXT_HEIGHT, 1,'2',0, 0,0,0}, + {kPanelButtonConverseText, 52,6 + ITE_CONVERSE_TEXT_HEIGHT * 2, ITE_CONVERSE_MAX_TEXT_WIDTH,ITE_CONVERSE_TEXT_HEIGHT, 2,'3',0, 0,0,0}, + {kPanelButtonConverseText, 52,6 + ITE_CONVERSE_TEXT_HEIGHT * 3, ITE_CONVERSE_MAX_TEXT_WIDTH,ITE_CONVERSE_TEXT_HEIGHT, 3,'4',0, 0,0,0}, {kPanelButtonArrow, 257,6, 9,6, -1,'u',0, 0,4,2}, {kPanelButtonArrow, 257,41, 9,6, 1,'d',0, 1,5,3}, }; @@ -145,6 +154,9 @@ static GameDisplayInfo ITE_DisplayInfo = { ARRAYSIZE(ITE_MainPanelButtons), ITE_MainPanelButtons, + ITE_CONVERSE_MAX_TEXT_WIDTH, + ITE_CONVERSE_TEXT_HEIGHT, + ITE_CONVERSE_TEXT_LINES, 4, 5, // converse Up & Down button indexies 0, 148, // converse panel offsets ARRAYSIZE(ITE_ConversePanelButtons), @@ -499,11 +511,38 @@ static GamePatchDescription ITELinPatch_Files[] = { // IHNM section static PanelButton IHNM_MainPanelButtons[] = { - {kPanelButtonVerb, 0,0, 0,0, kVerbWalkTo,' ',0, 0,0,0}, //TODO + {kPanelButtonVerb, 106,13, 114,30, kVerbWalkTo,'w',0, 0,0,0}, //TODO: verb Sprite Numbers + {kPanelButtonVerb, 106,45, 114,30, kVerbLookAt,'l',0, 0,0,0}, + {kPanelButtonVerb, 106,77, 114,30, kVerbTake,'k',0, 0,0,0}, + {kPanelButtonVerb, 106,109, 114,30, kVerbUse,'u',0, 0,0,0}, + {kPanelButtonVerb, 223,13, 114,30, kVerbTalkTo,'t',0, 0,0,0}, + {kPanelButtonVerb, 223,45, 114,30, kVerbSwallow,'s',0, 0,0,0}, + {kPanelButtonVerb, 223,77, 114,30, kVerbGive,'g',0, 0,0,0}, + {kPanelButtonVerb, 223,109, 114,30, kVerbPush,'p',0, 0,0,0}, + {kPanelButtonArrow, 606,22, 20,25, -1,'[',0, 0,0,0}, //TODO: arrow Sprite Numbers + {kPanelButtonArrow, 606,108, 20,25, 1,']',0, 0,0,0} +//TODO:inventory +/* + {kPanelButtonInventory, 181 + 32*0,6, 27,18, 0,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*1,6, 27,18, 1,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*2,6, 27,18, 2,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*3,6, 27,18, 3,'-',0, 0,0,0}, + + {kPanelButtonInventory, 181 + 32*0,27, 27,18, 4,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*1,27, 27,18, 5,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*2,27, 27,18, 6,'-',0, 0,0,0}, + {kPanelButtonInventory, 181 + 32*3,27, 27,18, 7,'-',0, 0,0,0} +*/ }; static PanelButton IHNM_ConversePanelButtons[] = { - {kPanelButtonConverseText, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO + {kPanelButtonConverseText, 117,18 + IHNM_CONVERSE_TEXT_HEIGHT * 0, IHNM_CONVERSE_MAX_TEXT_WIDTH,IHNM_CONVERSE_TEXT_HEIGHT, 0,'1',0, 0,0,0}, + {kPanelButtonConverseText, 52,18 + IHNM_CONVERSE_TEXT_HEIGHT * 1, IHNM_CONVERSE_MAX_TEXT_WIDTH,IHNM_CONVERSE_TEXT_HEIGHT, 1,'2',0, 0,0,0}, + {kPanelButtonConverseText, 52,18 + IHNM_CONVERSE_TEXT_HEIGHT * 2, IHNM_CONVERSE_MAX_TEXT_WIDTH,IHNM_CONVERSE_TEXT_HEIGHT, 2,'3',0, 0,0,0}, + {kPanelButtonConverseText, 52,18 + IHNM_CONVERSE_TEXT_HEIGHT * 3, IHNM_CONVERSE_MAX_TEXT_WIDTH,IHNM_CONVERSE_TEXT_HEIGHT, 3,'4',0, 0,0,0}, + //..... + {kPanelButtonArrow, 606,22, 20,25, -1,'[',0, 0,0,0}, //TODO: arrow Sprite Numbers + {kPanelButtonArrow, 606,108, 20,25, 1,']',0, 0,0,0} }; static PanelButton IHNM_OptionPanelButtons[] = { @@ -556,6 +595,9 @@ static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all -1, -1, // converse Up & Down button indexies + IHNM_CONVERSE_MAX_TEXT_WIDTH, + IHNM_CONVERSE_TEXT_HEIGHT, + IHNM_CONVERSE_TEXT_LINES, 0, 0, // converse panel offsets ARRAYSIZE(IHNM_ConversePanelButtons), IHNM_ConversePanelButtons, diff --git a/saga/interface.cpp b/saga/interface.cpp index 282da2c65d..6a2fd1d5e6 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -62,6 +62,9 @@ static int verbTypeToTextStringsIdLUT[kVerbTypesMax] = { -1, -1, -1, + -1, + -1, + -1, -1 }; @@ -1213,7 +1216,7 @@ void Interface::handleChapterSelectionClick(const Point& mousePoint) { event.time = 0; event.param = _vm->_scene->getScriptModuleNumber(); event.param2 = script; - event.param3 = kVerbIHNMUse; // Action + event.param3 = kVerbUse; // Action event.param4 = obj; // Object event.param5 = 0; // With Object event.param6 = obj; // Actor @@ -1882,7 +1885,7 @@ bool Interface::converseAddText(const char *text, int replyId, byte replyFlags, for (i = len; i >= 0; i--) { c = _converseWorkString[i]; - if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kSmallFont, _converseWorkString, i, kFontNormal) <= CONVERSE_MAX_TEXT_WIDTH)) { + if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kSmallFont, _converseWorkString, i, kFontNormal) <= _vm->getDisplayInfo().converseMaxTextWidth)) { break; } } @@ -1923,7 +1926,7 @@ void Interface::converseDisplayText() { _converseStartPos = 0; - end = _converseTextCount - CONVERSE_TEXT_LINES; + end = _converseTextCount - _vm->getDisplayInfo().converseTextLines; if (end < 0) end = 0; @@ -1953,7 +1956,7 @@ void Interface::converseDisplayTextLines(Surface *ds) { char bullet[2] = { (char)0xb7, 0 }; - Rect rect(8, CONVERSE_TEXT_LINES * CONVERSE_TEXT_HEIGHT); + Rect rect(8, _vm->getDisplayInfo().converseTextLines * _vm->getDisplayInfo().converseTextHeight); Point textPoint; assert(_conversePanel.buttonsCount >= 6); @@ -1966,7 +1969,7 @@ void Interface::converseDisplayTextLines(Surface *ds) { ds->drawRect(rect, kITEColorDarkGrey); //fill bullet place - for (int i = 0; i < CONVERSE_TEXT_LINES; i++) { + for (int i = 0; i < _vm->getDisplayInfo().converseTextLines; i++) { relPos = _converseStartPos + i; if (_converseTextCount <= relPos) { diff --git a/saga/interface.h b/saga/interface.h index 33dbcfb5a8..9e14ea9644 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -43,6 +43,9 @@ enum InterfaceUpdateFlags { UPDATE_WHEELDOWN = 16 }; +#define CONVERSE_MAX_TEXTS 64 +#define CONVERSE_MAX_WORK_STRING 128 + #define ITE_INVENTORY_SIZE 24 #define VERB_STRLIMIT 32 @@ -51,11 +54,6 @@ enum InterfaceUpdateFlags { #define STATUS_TEXT_INPUT_MAX 256 // Converse-specific stuff -#define CONVERSE_MAX_TEXTS 64 -#define CONVERSE_MAX_TEXT_WIDTH (256 - 60) -#define CONVERSE_TEXT_HEIGHT 10 -#define CONVERSE_TEXT_LINES 4 -#define CONVERSE_MAX_WORK_STRING 128 enum PanelModes { kPanelNull, diff --git a/saga/saga.h b/saga/saga.h index c7e7931b03..69afb94a91 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -413,6 +413,9 @@ struct GameDisplayInfo { int mainPanelButtonsCount; PanelButton *mainPanelButtons; + int converseMaxTextWidth; + int converseTextHeight; + int converseTextLines; int converseUpButtonIndex; int converseDownButtonIndex; diff --git a/saga/script.h b/saga/script.h index 52dda59ecb..e37353c2db 100644 --- a/saga/script.h +++ b/saga/script.h @@ -72,6 +72,11 @@ enum VerbTypes { kVerbWalkOnly = 13, kVerbLookOnly = 14, +//additional IHNM + kVerbTake = 15, + kVerbSwallow = 16, + kVerbPush = 17, +/* kVerbIHNMNone = 0, kVerbIHNMWalkTo = 1, kVerbIHNMLookAt = 2, @@ -81,8 +86,8 @@ enum VerbTypes { kVerbIHNMSwallow = 6, kVerbIHNMGive = 7, kVerbIHNMPush = 8, - - kVerbTypesMax = kVerbLookOnly + 1 +*/ + kVerbTypesMax = kVerbPush + 1 }; #define STHREAD_TIMESLICE 8 -- cgit v1.2.3