svn-id: r21327
This commit is contained in:
Travis Howell 2006-03-16 07:08:05 +00:00
parent ec05842572
commit 008b681dac
7 changed files with 61 additions and 64 deletions

View File

@ -299,7 +299,7 @@ void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
byte width = 6;
if (c == 0xC) {
video_fill_or_copy_from_3_to_2(fcs);
clearWindow(fcs);
} else if (c == 0xD || c == 0xA) {
video_putchar_newline(fcs);
} else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) {

View File

@ -208,8 +208,8 @@ uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uin
ha->height = 24;
ha->flags = 0xB0;
ha->id = 0x7FFD;
ha->layer = 100;
ha->unk3 = 0xD0;
ha->priority = 100;
ha->verb = 0xD0;
} else {
ha->x = x + 110;
ha->y = fcs->y + y;
@ -218,8 +218,8 @@ uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uin
ha->height = 20;
ha->flags = 0xB0;
ha->id = 0x7FFD;
ha->layer = 100;
ha->unk3 = 0xD0;
ha->priority = 100;
ha->verb = 0xD0;
}
return ha - _hitAreas;

View File

@ -590,7 +590,7 @@ int SimonEngine::runScript() {
uint flags = 0;
uint id = getVarOrWord();
uint params = id / 1000;
uint x, y, w, h, unk3;
uint x, y, w, h, verb;
Item *item;
id = id % 1000;
@ -611,12 +611,12 @@ int SimonEngine::runScript() {
w = getVarOrWord();
h = getVarOrWord();
item = getNextItemPtrStrange();
unk3 = getVarOrWord();
verb = getVarOrWord();
if (x >= 1000) {
unk3 += 0x4000;
verb += 0x4000;
x -= 1000;
}
addNewHitArea(id, x, y, w, h, flags, unk3, item);
addNewHitArea(id, x, y, w, h, flags, verb, item);
}
break;
@ -639,7 +639,7 @@ int SimonEngine::runScript() {
uint hitarea_id = getVarOrWord();
uint x = getVarOrWord();
uint y = getVarOrWord();
set_hitarea_x_y(hitarea_id, x, y);
moveBox(hitarea_id, x, y);
}
break;
@ -930,7 +930,7 @@ int SimonEngine::runScript() {
break;
case 160:{
o_unk_160(getVarOrByte());
o_setTextColor(getVarOrByte());
}
break;
@ -1649,8 +1649,11 @@ void SimonEngine::o_playSFX(uint sound_id) {
_sound->playEffects(sound_id);
}
void SimonEngine::o_unk_160(uint a) {
fcs_setTextColor(_windowArray[_curWindow], a);
void SimonEngine::o_setTextColor(uint color) {
FillOrCopyStruct *fcs;
fcs = _windowArray[_curWindow];
fcs->text_color = color;
}
void SimonEngine::o_unk_103() {

View File

@ -340,7 +340,7 @@ get_out:;
_base_time = time(NULL) - save_time + _base_time;
_copyPartialMode = 0;
dx_copy_rgn_from_3_to_2(94, 208, 46, 80);
restoreBlock(94, 208, 46, 80);
i = _timer4;
do {
@ -383,7 +383,7 @@ void SimonEngine::o_fileError(FillOrCopyStruct *fcs, bool save_error) {
ha->height = 8;
ha->flags = 0x20;
ha->id = 0x7FFF;
ha->layer = 0x3EF;
ha->priority = 0x3EF;
loop:;
_lastHitArea = _lastHitArea3 = 0;

View File

@ -251,7 +251,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_mouseCursor = 0;
_vgaVar9 = 0;
_scriptUnk1 = 0;
_vgaVar6 = 0;
_restoreWindow6 = 0;
_scrollX = 0;
_scrollY = 0;
_scrollXMax = 0;
@ -1824,9 +1824,9 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) {
ha->height = 17;
ha->flags = 0x24;
ha->id = 0x7FFB;
ha->layer = 100;
ha->priority = 100;
ha->fcs = fcs;
ha->unk3 = 1;
ha->verb = 1;
} else {
ha->x = 81;
ha->y = 158;
@ -1834,9 +1834,9 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) {
ha->height = 26;
ha->flags = 36;
ha->id = 0x7FFB;
ha->layer = 100;
ha->priority = 100;
ha->fcs = fcs;
ha->unk3 = 1;
ha->verb = 1;
}
ha = findEmptyHitArea();
@ -1849,9 +1849,9 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) {
ha->height = 17;
ha->flags = 0x24;
ha->id = 0x7FFC;
ha->layer = 100;
ha->priority = 100;
ha->fcs = fcs;
ha->unk3 = 1;
ha->verb = 1;
// Simon1 specific
o_kill_sprite_simon1(128);
@ -1863,9 +1863,9 @@ void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) {
ha->height = 26;
ha->flags = 36;
ha->id = 0x7FFC;
ha->layer = 100;
ha->priority = 100;
ha->fcs = fcs;
ha->unk3 = 1;
ha->verb = 1;
}
}
@ -2021,7 +2021,7 @@ startOver:
} else if (ha->id == 0x7FFC) {
handle_downarrow_hitarea(ha->fcs);
} else if (ha->id >= 101 && ha->id < 113) {
_verbHitArea = ha->unk3;
_verbHitArea = ha->verb;
handle_verb_hitarea(ha);
_hitAreaUnk4 = 0;
} else {
@ -2038,12 +2038,12 @@ startOver:
break;
} else {
// else 1
if (ha->unk3 == 0) {
if (ha->verb == 0) {
if (ha->item_ptr)
goto if_1;
} else {
_verbHitArea = ha->unk3 & 0xBFFF;
if (ha->unk3 & 0x4000) {
_verbHitArea = ha->verb & 0xBFFF;
if (ha->verb & 0x4000) {
_hitAreaSubjectItem = ha->item_ptr;
break;
}
@ -2390,7 +2390,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
_unkPalFlag = true;
} else {
_dxUse3Or4ForLock = true;
_vgaVar6 = true;
_restoreWindow6 = true;
}
}
@ -2857,10 +2857,6 @@ void SimonEngine::timer_callback() {
}
}
void SimonEngine::fcs_setTextColor(FillOrCopyStruct *fcs, uint value) {
fcs->text_color = value;
}
void SimonEngine::o_vga_reset() {
_lockWord |= 0x8000;
vc27_resetSprite();
@ -3063,11 +3059,11 @@ void SimonEngine::fcs_putchar(uint a) {
}
// ok
void SimonEngine::video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs) {
void SimonEngine::clearWindow(FillOrCopyStruct *fcs) {
if (fcs->flags & 0x10)
copy_img_from_3_to_2(fcs);
restoreWindow(fcs);
else
video_erase(fcs);
colorWindow(fcs);
fcs->textColumn = 0;
fcs->textRow = 0;
@ -3076,24 +3072,24 @@ void SimonEngine::video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs) {
}
// ok
void SimonEngine::copy_img_from_3_to_2(FillOrCopyStruct *fcs) {
void SimonEngine::restoreWindow(FillOrCopyStruct *fcs) {
_lockWord |= 0x8000;
if (getGameType() == GType_SIMON1) {
dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _windowArray[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
restoreBlock(fcs->y + fcs->height * 8 + ((fcs == _windowArray[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
} else {
if (_vgaVar6 && _windowArray[2] == fcs) {
if (_restoreWindow6 && _windowArray[2] == fcs) {
fcs = _windowArray[6];
_vgaVar6 = 0;
_restoreWindow6 = 0;
}
dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
restoreBlock(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
}
_lockWord &= ~0x8000;
}
void SimonEngine::video_erase(FillOrCopyStruct *fcs) {
void SimonEngine::colorWindow(FillOrCopyStruct *fcs) {
byte *dst;
uint h;
@ -3289,7 +3285,7 @@ void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte
void SimonEngine::video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs) {
if (fcs->flags & 8)
copy_img_from_3_to_2(fcs);
restoreWindow(fcs);
fcs->mode = 0;
}
@ -3777,7 +3773,7 @@ void SimonEngine::runSubroutine101() {
startUp_helper_2();
}
void SimonEngine::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x) {
void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) {
byte *dst, *src;
uint i;

View File

@ -68,8 +68,8 @@ struct HitArea {
uint16 id;
FillOrCopyStruct *fcs;
Item *item_ptr;
uint16 unk3;
uint16 layer;
uint16 verb;
uint16 priority;
HitArea() { memset(this, 0, sizeof(*this)); }
};
@ -253,7 +253,7 @@ protected:
byte _mouseCursor;
bool _vgaVar9;
int16 _scriptUnk1;
bool _vgaVar6;
bool _restoreWindow6;
int _scrollX, _scrollXMax, _scrollHeight;
int _scrollY, _scrollYMax, _scrollWidth;
int _scrollCount, _scrollFlag;
@ -540,7 +540,7 @@ protected:
void closeWindow(uint a);
void clear_hitarea_bit_0x40(uint hitarea);
void set_hitarea_bit_0x40(uint hitarea);
void set_hitarea_x_y(uint hitarea, int x, int y);
void moveBox(uint hitarea, int x, int y);
bool is_hitarea_0x40_clear(uint hitarea);
void delete_hitarea(uint hitarea);
void addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr);
@ -562,7 +562,7 @@ protected:
void killAllTimers();
uint getOffsetOfChild2Param(Child2 *child, uint prop);
void o_unk_160(uint a);
void o_setTextColor(uint color);
void o_playSFX(uint a);
void o_lockZone();
void o_unlockZone();
@ -617,7 +617,7 @@ protected:
void showActionString(uint x, const byte *string);
void video_putchar(FillOrCopyStruct *fcs, byte c, byte b = 0);
void video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs);
void clearWindow(FillOrCopyStruct *fcs);
void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d);
void read_vga_from_datfile_1(uint vga_id);
@ -801,18 +801,16 @@ protected:
bool isSpriteLoaded(uint16 id, uint16 fileId);
void fcs_setTextColor(FillOrCopyStruct *fcs, uint value);
void video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs);
void delete_hitarea_by_index(uint index);
void removeArrows(FillOrCopyStruct *fcs, uint fcs_index);
void fcs_putchar(uint a);
void copy_img_from_3_to_2(FillOrCopyStruct *fcs);
void video_erase(FillOrCopyStruct *fcs);
void restoreWindow(FillOrCopyStruct *fcs);
void colorWindow(FillOrCopyStruct *fcs);
void dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x);
void restoreBlock(uint b, uint r, uint y, uint x);
byte *getBackBuf();
byte *getFrontBuf();

View File

@ -301,7 +301,7 @@ void SimonEngine::hitareaChangedHelper() {
fcs = _windowArray[1];
if (fcs != NULL && fcs->text_color != 0)
video_fill_or_copy_from_3_to_2(fcs);
clearWindow(fcs);
_lastHitArea2Ptr = NULL;
_hitAreaPtr7 = NULL;
@ -345,7 +345,7 @@ void SimonEngine::set_hitarea_bit_0x40(uint hitarea) {
}
}
void SimonEngine::set_hitarea_x_y(uint hitarea, int x, int y) {
void SimonEngine::moveBox(uint hitarea, int x, int y) {
HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) {
ha->x = x;
@ -370,7 +370,7 @@ bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
return (ha->flags & 0x40) == 0;
}
void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr) {
void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
HitArea *ha;
delete_hitarea(id);
@ -380,8 +380,8 @@ void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int
ha->width = width;
ha->height = height;
ha->flags = flags | 0x20;
ha->id = ha->layer = id;
ha->unk3 = unk3;
ha->id = ha->priority = id;
ha->verb = verb;
ha->item_ptr = item_ptr;
_needHitAreaRecalc++;
@ -409,7 +409,7 @@ void SimonEngine::hitarea_proc_1() {
_hitAreaUnk4 = 999;
_hitAreaPtr5 = NULL;
} else {
_verbHitArea = ha->unk3;
_verbHitArea = ha->verb;
handle_verb_hitarea(ha);
}
}
@ -483,7 +483,7 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
HitArea *best_ha;
HitArea *ha = _hitAreas;
uint count = ARRAYSIZE(_hitAreas);
uint16 layer = 0;
uint16 priority = 0;
uint16 x_ = x;
const uint16 y_ = y;
@ -499,8 +499,8 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
if (ha->flags & 0x20) {
if (!(ha->flags & 0x40)) {
if (x_ >= ha->x && y_ >= ha->y &&
x_ - ha->x < ha->width && y_ - ha->y < ha->height && layer <= ha->layer) {
layer = ha->layer;
x_ - ha->x < ha->width && y_ - ha->y < ha->height && priority <= ha->priority) {
priority = ha->priority;
best_ha = ha;
} else {
if (ha->flags & 2) {