[Scummvm-cvs-logs] SF.net SVN: scummvm: [21926] scummvm/trunk/engines/simon
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Sat Apr 15 15:38:04 CEST 2006
Revision: 21926
Author: kirben
Date: 2006-04-15 15:37:48 -0700 (Sat, 15 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21926&view=rev
Log Message:
-----------
Cleanup
Modified Paths:
--------------
scummvm/trunk/engines/simon/charset.cpp
scummvm/trunk/engines/simon/items.cpp
scummvm/trunk/engines/simon/oracle.cpp
scummvm/trunk/engines/simon/simon.cpp
scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/charset.cpp
===================================================================
--- scummvm/trunk/engines/simon/charset.cpp 2006-04-15 22:22:03 UTC (rev 21925)
+++ scummvm/trunk/engines/simon/charset.cpp 2006-04-15 22:37:48 UTC (rev 21926)
@@ -21,6 +21,7 @@
*/
#include "common/stdafx.h"
+
#include "simon/simon.h"
#include "simon/intern.h"
@@ -1525,11 +1526,13 @@
dst += y * _dxSurfacePitch + x + window->textColumnOffset;
if (getGameType() == GType_FF) {
+ dst = getFrontBuf() + y * _dxSurfacePitch + x + window->textColumnOffset;
h = 13;
w = feebleFontSize[chr - 0x20];
src = feeble_video_font + (chr - 0x20) * 13;
} else {
+ dst = getFrontBuf() + y * _dxSurfacePitch + x + window->textColumnOffset;
h = 8;
w = 6;
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp 2006-04-15 22:22:03 UTC (rev 21925)
+++ scummvm/trunk/engines/simon/items.cpp 2006-04-15 22:37:48 UTC (rev 21926)
@@ -1972,12 +1972,17 @@
}
void SimonEngine::o3_setColour() {
- // 195: set palette colour?
- uint blue = getVarOrByte();
- uint green = getVarOrByte();
- uint red = getVarOrByte();
- uint color = getVarOrByte();
- warning("STUB: script opcode 195 (%d, %d, %d, %d)", blue, green, red, color);
+ // 195: set palette colour
+ uint b = getVarOrByte();
+ uint g = getVarOrByte();
+ uint r = getVarOrByte();
+ uint c = getVarOrByte() * 4;
+
+ _palette[c + 0] = _paletteBackup[c + 0] = r;
+ _palette[c + 1] = _paletteBackup[c + 1] = g;
+ _palette[c + 2] = _paletteBackup[c + 2] = b;
+
+ debug(0, "o3_setColour (%d, %d, %d, %d)", c, r, g, b);
}
void SimonEngine::o3_b3Set() {
Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp 2006-04-15 22:22:03 UTC (rev 21925)
+++ scummvm/trunk/engines/simon/oracle.cpp 2006-04-15 22:37:48 UTC (rev 21926)
@@ -212,15 +212,18 @@
}
void SimonEngine::bltOracleText() {
- byte *src, *dst;
+ byte *src, *dst1, *dst2;
uint16 h;
src = getFrontBuf() + 103 * _screenWidth + 136;
- dst = getBackBuf() + 103 * _screenWidth + 136;
+ dst1 = getFrontBuf() + 103 * _screenWidth + 136;
+ dst2 = getBackBuf() + 103 * _screenWidth + 136;
for (h = 0; h < 104; h++) {
- memcpy(dst, src, 360);
- dst += _screenWidth;
+ memcpy(dst1, src, 360);
+ memcpy(dst2, src, 360);
+ dst1 += _screenWidth;
+ dst2 += _screenWidth;
src += _screenWidth;
}
}
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp 2006-04-15 22:22:03 UTC (rev 21925)
+++ scummvm/trunk/engines/simon/simon.cpp 2006-04-15 22:37:48 UTC (rev 21926)
@@ -234,7 +234,7 @@
_copyPartialMode = 0;
_speed = 1;
_fastMode = 0;
- _dxUse3Or4ForLock = 0;
+ _useBackGround = 0;
_debugMode = 0;
_pause = 0;
@@ -459,9 +459,9 @@
_sdlMouseX = 0;
_sdlMouseY = 0;
- _sdl_buf_3 = 0;
- _sdl_buf = 0;
- _sdl_buf_attached = 0;
+ _backGroundBuf = 0;
+ _frontBuf = 0;
+ _backBuf = 0;
_sdl_buf_scaled = 0;
_vc10BasePtrOld = 0;
@@ -1368,7 +1368,7 @@
return cur;
}
- debug(1,"getSubroutineByID: subroutine %d not found", subroutine_id);
+ debug(0,"getSubroutineByID: subroutine %d not found", subroutine_id);
return NULL;
}
@@ -2273,7 +2273,7 @@
if (getGameType() == GType_SIMON1) {
_unkPalFlag = true;
} else if (getGameType() == GType_SIMON2) {
- _dxUse3Or4ForLock = true;
+ _useBackGround = true;
_restoreWindow6 = true;
}
}
@@ -2315,7 +2315,7 @@
if (getGameType() == GType_SIMON1) {
if (vga_res_id == 16300) {
- dx_clear_attached_from_top(134);
+ clearBackFromTop(134);
_usePaletteDelay = true;
}
} else {
@@ -2346,7 +2346,20 @@
_vcPtr = vc_ptr_org;
- if (getGameType() == GType_SIMON1) {
+ if (getGameType() == GType_FF) {
+ fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
+ fillBackGroundFromBack(_screenHeight);
+ _syncFlag2 = 1;
+ } else if (getGameType() == GType_SIMON2) {
+ if (!_useBackGround) {
+ num_lines = _windowNum == 4 ? 134 : 200;
+ _boxStarHeight = num_lines;
+ fillFrontFromBack(0, 0, _screenWidth, num_lines);
+ fillBackGroundFromBack(num_lines);
+ _syncFlag2 = 1;
+ }
+ _useBackGround = false;
+ } else {
// Allow one section of Simon the Sorcerer 1 introduction to be displayed
// in lower half of screen
if (_subroutine == 2923 || _subroutine == 2926)
@@ -2354,24 +2367,11 @@
else
num_lines = _windowNum == 4 ? 134 : 200;
- dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
- dx_copy_from_attached_to_3(num_lines);
+ fillFrontFromBack(0, 0, _screenWidth, num_lines);
+ fillBackGroundFromBack(num_lines);
_syncFlag2 = 1;
_timer5 = 0;
- } else {
- if (!_dxUse3Or4ForLock) {
- if (getGameType() == GType_FF)
- num_lines = 480;
- else
- num_lines = _windowNum == 4 ? 134 : 200;
-
- _boxStarHeight = num_lines;
- dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
- dx_copy_from_attached_to_3(num_lines);
- _syncFlag2 = 1;
- }
- _dxUse3Or4ForLock = false;
}
_lockWord &= ~0x20;
@@ -2630,7 +2630,7 @@
}
if (_drawImagesDebug)
- memset(_sdl_buf_attached, 0, _screenWidth * _screenHeight);
+ memset(_backBuf, 0, _screenWidth * _screenHeight);
_updateScreen++;
_vcPtr = vc_ptr_org;
@@ -2685,8 +2685,8 @@
vcWriteVar(251, _scrollX);
}
- memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight);
- memcpy(_sdl_buf_3, _sdl_buf_attached, _scrollHeight * _screenWidth);
+ memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight);
+ memcpy(_backGroundBuf, _backBuf, _scrollHeight * _screenWidth);
_scrollFlag = 0;
}
@@ -2758,12 +2758,12 @@
timer_vga_sprites_2();
if (_copyPartialMode == 1) {
- dx_copy_from_2_to_attached(80, 46, 208 - 80, 94 - 46);
+ fillBackFromFront(80, 46, 208 - 80, 94 - 46);
}
if (_copyPartialMode == 2) {
// copy partial from attached to 2
- dx_copy_from_attached_to_2(176, 61, _screenWidth - 176, 134 - 61);
+ fillFrontFromBack(176, 61, _screenWidth - 176, 134 - 61);
_copyPartialMode = 0;
}
@@ -2945,10 +2945,8 @@
_lockWord |= 0x8000;
- dst = getFrontBuf();
-
if (getGameType() == GType_FF) {
- dst += _dxSurfacePitch * window->y + window->x;
+ dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x;
for (h = 0; h < window->height; h++) {
for (w = 0; w < window->width; w++) {
@@ -2958,7 +2956,7 @@
dst += _screenWidth;
}
} else {
- dst += _dxSurfacePitch * window->y + window->x * 8;
+ dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x * 8;
h = window->height * 8;
w = window->width * 8;
@@ -3347,7 +3345,7 @@
uint i;
dst = getFrontBuf();
- src = _sdl_buf_3;
+ src = _backGroundBuf;
dst += y * _dxSurfacePitch;
src += y * _dxSurfacePitch;
@@ -3362,24 +3360,24 @@
}
void SimonEngine::dx_clear_surfaces(uint num_lines) {
- memset(_sdl_buf_attached, 0, num_lines * _screenWidth);
+ memset(_backBuf, 0, num_lines * _screenWidth);
- _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, num_lines);
+ _system->copyRectToScreen(_backBuf, _screenWidth, 0, 0, _screenWidth, num_lines);
- if (_dxUse3Or4ForLock) {
- memset(_sdl_buf, 0, num_lines * _screenWidth);
- memset(_sdl_buf_3, 0, num_lines * _screenWidth);
+ if (_useBackGround) {
+ memset(_frontBuf, 0, num_lines * _screenWidth);
+ memset(_backGroundBuf, 0, num_lines * _screenWidth);
}
}
-void SimonEngine::dx_clear_attached_from_top(uint lines) {
- memset(_sdl_buf_attached, 0, lines * _screenWidth);
+void SimonEngine::clearBackFromTop(uint lines) {
+ memset(_backBuf, 0, lines * _screenWidth);
}
-void SimonEngine::dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h) {
+void SimonEngine::fillFrontFromBack(uint x, uint y, uint w, uint h) {
uint offs = x + y * _screenWidth;
- byte *s = _sdl_buf_attached + offs;
- byte *d = _sdl_buf + offs;
+ byte *s = _backBuf + offs;
+ byte *d = _frontBuf + offs;
do {
memcpy(d, s, w);
@@ -3388,10 +3386,10 @@
} while (--h);
}
-void SimonEngine::dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h) {
+void SimonEngine::fillBackFromFront(uint x, uint y, uint w, uint h) {
uint offs = x + y * _screenWidth;
- byte *s = _sdl_buf + offs;
- byte *d = _sdl_buf_attached + offs;
+ byte *s = _frontBuf + offs;
+ byte *d = _backBuf + offs;
do {
memcpy(d, s, w);
@@ -3400,8 +3398,8 @@
} while (--h);
}
-void SimonEngine::dx_copy_from_attached_to_3(uint lines) {
- memcpy(_sdl_buf_3, _sdl_buf_attached, lines * _screenWidth);
+void SimonEngine::fillBackGroundFromBack(uint lines) {
+ memcpy(_backGroundBuf, _backBuf, lines * _screenWidth);
}
void SimonEngine::dx_update_screen_and_palette() {
@@ -3415,10 +3413,10 @@
}
}
- _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, _screenHeight);
+ _system->copyRectToScreen(_backBuf, _screenWidth, 0, 0, _screenWidth, _screenHeight);
_system->updateScreen();
- memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight);
+ memcpy(_backBuf, _frontBuf, _screenWidth * _screenHeight);
if (getGameType() == GType_FF && _scrollFlag) {
scrollEvent();
@@ -3482,9 +3480,9 @@
_dumpFile = stdout;
// allocate buffers
- _sdl_buf_3 = (byte *)calloc(_screenWidth * _screenHeight, 1);
- _sdl_buf = (byte *)calloc(_screenWidth * _screenHeight, 1);
- _sdl_buf_attached = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
_sdl_buf_scaled = (byte *)calloc(_screenWidth * _screenHeight, 1);
allocItemHeap();
@@ -3739,14 +3737,19 @@
byte *SimonEngine::getFrontBuf() {
_dxSurfacePitch = _screenWidth;
- return _sdl_buf;
+ return _frontBuf;
}
byte *SimonEngine::getBackBuf() {
_dxSurfacePitch = _screenWidth;
- return _dxUse3Or4ForLock ? _sdl_buf_3 : _sdl_buf_attached;
+ return _useBackGround ? _backGroundBuf : _backBuf;
}
+byte *SimonEngine::getBackGround() {
+ _dxSurfacePitch = _screenWidth;
+ return _backGroundBuf;
+}
+
byte *SimonEngine::getScaleBuf() {
_dxSurfacePitch = _screenWidth;
return _sdl_buf_scaled;
Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h 2006-04-15 22:22:03 UTC (rev 21925)
+++ scummvm/trunk/engines/simon/simon.h 2006-04-15 22:37:48 UTC (rev 21926)
@@ -246,7 +246,7 @@
byte _copyPartialMode;
uint _speed;
bool _fastMode;
- bool _dxUse3Or4ForLock;
+ bool _useBackGround;
uint16 _debugMode;
uint16 _language;
@@ -452,9 +452,9 @@
int _sdlMouseX, _sdlMouseY;
- byte *_sdl_buf_3;
- byte *_sdl_buf;
- byte *_sdl_buf_attached;
+ byte *_backGroundBuf;
+ byte *_frontBuf;
+ byte *_backBuf;
byte *_sdl_buf_scaled;
Common::RandomSource _rnd;
@@ -1037,6 +1037,7 @@
byte *getFrontBuf();
byte *getBackBuf();
+ byte *getBackGround();
byte *getScaleBuf();
byte *read_vga_from_datfile_2(uint id, uint type);
@@ -1064,10 +1065,10 @@
void dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base);
void dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base);
- void dx_clear_attached_from_top(uint lines);
- void dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h);
- void dx_copy_from_attached_to_3(uint lines);
- void dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h);
+ void clearBackFromTop(uint lines);
+ void fillFrontFromBack(uint x, uint y, uint w, uint h);
+ void fillBackGroundFromBack(uint lines);
+ void fillBackFromFront(uint x, uint y, uint w, uint h);
void print_char_helper_1(const byte *src, uint len);
void print_char_helper_5(WindowBlock *window);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list