Add inventory array differences in FF and minor cleanup

svn-id: r21613
This commit is contained in:
Travis Howell 2006-04-04 23:29:24 +00:00
parent 194945f2a1
commit 15f4249978
5 changed files with 115 additions and 29 deletions

View File

@ -34,7 +34,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
while (len-- != 0) {
if (getGameType() == GType_FF) {
if ((_bitArray[5] & (1 << 13)) != 0) {
if (getBitFlag(93)) {
if (_curWindow == 3) {
if ((_newLines >= _textWindow->scrollY) && (_newLines < (_textWindow->scrollY + 3)))
fcs_putchar(*src);
@ -43,7 +43,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
src++;
}
} else {
if ((_bitArray[5] & (1 << 14)) != 0) {
if (getBitFlag(94)) {
if (_curWindow == 3) {
if (_newLines == (_textWindow->scrollY + 7))
fcs_putchar(*src);
@ -52,7 +52,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
src++;
}
} else {
//if ((_bitArray[5] & (1 << 12)) != 0)
//if (getBitFlag(92))
// while(!_nextCharacter);
fcs_putchar(*src++);
//_nextCharacter = false;
@ -245,7 +245,7 @@ void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint
}
}
static const byte fontSize[208] = {
static const byte feebleFontSize[208] = {
8, 2, 5, 7, 8, 8, 8, 2, 4, 4, 8, 8, 3, 8, 2, 9,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 3, 5, 8, 5, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, 8, 8, 8, 8, 8,
@ -306,7 +306,7 @@ void SimonEngine::showmessage_print_char(byte chr) {
if (chr == 10)
_printCharCurPos = 0;
else if (chr != 0)
_printCharCurPos++;
_printCharCurPos += (getGameType() == GType_FF) ? feebleFontSize[chr - 32] : 1;
}
} else {
const byte newline_character = 10;
@ -315,7 +315,7 @@ void SimonEngine::showmessage_print_char(byte chr) {
print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
if (chr == ' ') {
print_char_helper_1(&chr, 1);
_printCharCurPos++;
_printCharCurPos += (getGameType() == GType_FF) ? feebleFontSize[chr - 32] : 1;
} else {
print_char_helper_1(&chr, 1);
_printCharCurPos = 0;
@ -323,6 +323,8 @@ void SimonEngine::showmessage_print_char(byte chr) {
}
_numLettersToPrint = 0;
} else {
if (getGameType() == GType_FF)
_printCharCurPos += feebleFontSize[chr - 32];
_lettersToPrintBuf[_numLettersToPrint++] = chr;
}
}
@ -376,10 +378,10 @@ void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
}
}
}
} else if (c >= 0x20) {
} else if (c >= 32) {
if (getGameType() == GType_FF) {
video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow + fcs->y, c);
fcs->textColumn += fontSize[c - 0x20];
fcs->textColumn += feebleFontSize[c - 32];
return;
}

View File

@ -167,26 +167,26 @@ void SimonEngine::listSaveGames(int n) {
j = maxFiles - n + 1;
k = maxFiles - j + 1;
z = maxFiles;
if ((_bitArray[5] & (1 << 15)) != 0) {
if (getBitFlag(95)) {
j++;
z++;
}
while(1) {
OK=1;
if ((_bitArray[5] & (3 << 13)) != 0) {
if (getBitFlag(93)) {
OK = 0;
if(j > z)
break;
}
if ((_bitArray[5] & (1 << 13)) != 0) {
if (getBitFlag(93)) {
if (((_newLines + 1) >= _textWindow->scrollY) && (
(_newLines + 1) < (_textWindow->scrollY + 3)))
OK = 1;
}
if ((_bitArray[5] & (1 << 14)) != 0) {
if (getBitFlag(94)) {
if ((_newLines + 1) == (_textWindow->scrollY + 7))
OK = 1;
}
@ -281,7 +281,7 @@ void SimonEngine::swapCharacterLogo() {
x = _variableArray[91];
if (x > _variableArray[90])
x--;
if( x < _variableArray[90])
if (x < _variableArray[90])
x++;
_variableArray[91] = x;

View File

@ -283,6 +283,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_item1 = 0;
_currentBoxNumber = 0;
_iOverflow = 0;
_hitAreaObjectItem = 0;
_lastHitArea = 0;
_lastHitArea2Ptr = 0;

View File

@ -291,6 +291,7 @@ protected:
uint16 _defaultVerb;
uint _mouseHideCount;
uint _currentBoxNumber;
uint _iOverflow;
uint16 _windowNum;
@ -631,6 +632,8 @@ protected:
void defocusHitarea();
void endCutscene();
void runSubroutine101();
void checkUp(FillOrCopyStruct *fcs);
void checkDown(FillOrCopyStruct *fcs);
void inventoryUp(FillOrCopyStruct *fcs);
void inventoryDown(FillOrCopyStruct *fcs);
void hitareaChangedHelper();

View File

@ -508,27 +508,107 @@ void SimonEngine::leaveHitAreaById(uint hitarea_id) {
hitarea_leave(ha);
}
void SimonEngine::checkUp(FillOrCopyStruct *fcs) {
uint16 j, k;
if (((_variableArray[31] - _variableArray[30]) == 40) && (_variableArray[31] > 52)) {
k = (((_variableArray[31] / 52) - 2) % 3);
j = k * 6;
if (!is_hitarea_0x40_clear(j + 201)) {
uint index = get_fcs_ptr_3_index(fcs);
drawIconArray(index, fcs->fcs_data->item_ptr, 0, fcs->fcs_data->unk2);
loadSprite(4, 9, k + 34, 0, 0, 0);
}
}
if ((_variableArray[31] - _variableArray[30]) == 76) {
k = ((_variableArray[31] / 52) % 3);
j = k * 6;
if (is_hitarea_0x40_clear(j + 201)) {
loadSprite(4, 9, k + 31, 0, 0, 0);
delete_hitarea(j + 201);
delete_hitarea(j + 202);
delete_hitarea(j + 203);
delete_hitarea(j + 204);
delete_hitarea(j + 205);
delete_hitarea(j + 206);
}
_variableArray[31] -= 52;
_iOverflow = 1;
}
}
void SimonEngine::checkDown(FillOrCopyStruct *fcs) {
uint16 j, k;
if (((_variableArray[31] - _variableArray[30]) == 24) && (_iOverflow == 1)) {
uint index = get_fcs_ptr_3_index(fcs);
drawIconArray(index, fcs->fcs_data->item_ptr, 0, fcs->fcs_data->unk2);
k = ((_variableArray[31] / 52) % 3);
loadSprite(4, 9, k + 25, 0, 0, 0);
_variableArray[31] += 52;
}
if (((_variableArray[31] - _variableArray[30]) == 40) && (_variableArray[30] > 52)) {
k = (((_variableArray[31] / 52) + 1) % 3);
j = k * 6;
if (is_hitarea_0x40_clear(j + 201)) {
loadSprite(4, 9, k + 28, 0, 0, 0);
delete_hitarea(j + 201);
delete_hitarea(j + 202);
delete_hitarea(j + 203);
delete_hitarea(j + 204);
delete_hitarea(j + 205);
delete_hitarea(j + 206);
}
}
}
void SimonEngine::inventoryUp(FillOrCopyStruct *fcs) {
uint index;
if (getGameType() == GType_FF) {
_marks = 0;
checkUp(fcs);
loadSprite(4, 9 ,21 ,0 ,0, 0);
while(1) {
if (_currentBoxNumber != 32763 || _leftButtonDown)
break;
checkUp(fcs);
}
o_waitForMark(2);
checkUp(fcs);
o_sync(922);
o_waitForMark(1);
checkUp(fcs);
} else {
if (fcs->fcs_data->unk1 == 0)
return;
index = get_fcs_ptr_3_index(fcs);
if (fcs->fcs_data->unk1 == 0)
return;
mouseOff();
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2);
mouseOn();
mouseOff();
uint index = get_fcs_ptr_3_index(fcs);
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2);
mouseOn();
}
}
void SimonEngine::inventoryDown(FillOrCopyStruct *fcs) {
uint index;
index = get_fcs_ptr_3_index(fcs);
mouseOff();
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2);
mouseOn();
if (getGameType() == GType_FF) {
_marks = 0;
checkDown(fcs);
loadSprite(4, 9, 23, 0, 0, 0);
while(1) {
if (_currentBoxNumber != 32764 || _leftButtonDown)
break;
checkDown(fcs);
}
o_waitForMark(2);
checkDown(fcs);
o_sync(924);
o_waitForMark(1);
checkDown(fcs);
} else {
mouseOff();
uint index = get_fcs_ptr_3_index(fcs);
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2);
mouseOn();
}
}
void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {