[Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.7,1.8 menu.cpp,1.4,1.5 mouse.cpp,1.5,1.6 screen.cpp,1.7,1.8 screen.h,1.3,1.4 sound.h,1.2,1.3 sword1.cpp,1.6,1.7
Robert G?ffringmann
lavosspawn at users.sourceforge.net
Tue Dec 16 23:34:01 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm player_mod.cpp,2.10,2.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.32,1.33 resman.cpp,1.77,1.78 router.cpp,1.32,1.33 router.h,1.13,1.14 walker.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv16436/sword1
Modified Files:
logic.cpp menu.cpp mouse.cpp screen.cpp screen.h sound.h
sword1.cpp
Log Message:
fixed text output and logic bug. changed scrolling code.
hey, sword is running really nice already. :)
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- logic.cpp 17 Dec 2003 05:16:36 -0000 1.7
+++ logic.cpp 17 Dec 2003 07:33:00 -0000 1.8
@@ -91,6 +91,7 @@
}
void SwordLogic::engine(void) {
+ debug(5, "\n\nNext logic cycle");
_eventMan->serviceGlobalEventList();
for (uint16 sectCnt = 0; sectCnt < TOTAL_SECTIONS; sectCnt++) {
@@ -862,7 +863,7 @@
int SwordLogic::fnCheckFade(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
- _scriptVars[RETURN_VALUE] = (uint8)_screen->stillFading();
+ _scriptVars[RETURN_VALUE] = (uint8)(!_screen->stillFading());
return SCRIPT_CONT;
}
@@ -1083,12 +1084,13 @@
_objMan->unlockText(textNo);
BsObject * textCpt = _objMan->fetchObject(textCptId);
+ textCpt->o_screen = cpt->o_screen;
+ textCpt->o_target = textCptId;
// the graphic is a property of SwordText, so we don't lock/unlock it.
- uint16 textSpriteWidth = _textMan->giveSpriteData(cpt->o_target)->width;
- uint16 textSpriteHeight = _textMan->giveSpriteData(cpt->o_target)->height;
+ uint16 textSpriteWidth = _textMan->giveSpriteData(textCpt->o_target)->width;
+ uint16 textSpriteHeight = _textMan->giveSpriteData(textCpt->o_target)->height;
- textCpt->o_screen = cpt->o_screen;
cpt->o_text_id = textCptId;
// now set text coords, above the player, usually
@@ -1096,7 +1098,7 @@
#define TEXT_MARGIN 3 // distance kept from edges of screen
#define ABOVE_HEAD 20 // distance kept above talking sprite
uint16 textX, textY;
- if ((id == GEORGE) || ((id == NICO) && (_scriptVars[SCREEN] == 10)) && (!cpt->o_anim_resource)) {
+ if (((id == GEORGE) || ((id == NICO) && (_scriptVars[SCREEN] == 10))) && (!cpt->o_anim_resource)) {
// if George is doing Voice-Over text (centered at the bottom of the screen)
textX = _scriptVars[SCROLL_OFFSET_X] + 128 + (640 / 2) - textSpriteWidth / 2;
textY = _scriptVars[SCROLL_OFFSET_Y] + 128 + 400;
Index: menu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- menu.cpp 17 Dec 2003 05:16:36 -0000 1.4
+++ menu.cpp 17 Dec 2003 07:33:00 -0000 1.5
@@ -213,13 +213,15 @@
}
int SwordMenu::logicChooser(BsObject *compact) {
+ uint8 objSelected = 0;
if (_objectBarShown)
- uint8 objSelected = checkMenuClick(MENU_TOP);
- if (checkMenuClick(MENU_BOT)) {
+ objSelected = checkMenuClick(MENU_TOP);
+ if (!objSelected)
+ objSelected = checkMenuClick(MENU_BOT);
+ if (objSelected) {
compact->o_logic = LOGIC_script;
return 1;
- } else
- return 0;
+ }
return 0;
}
Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mouse.cpp 17 Dec 2003 05:16:36 -0000 1.5
+++ mouse.cpp 17 Dec 2003 07:33:00 -0000 1.6
@@ -110,13 +110,18 @@
_numObjs = 0;
return; // no human, so we don't want the mouse engine
}
-
- if (y < 40) { // okay, we are in the top menu.
- if (!_inTopMenu) // are we just entering it?
- _menu->fnStartMenu();
- _menu->checkTopMenu();
- _inTopMenu = true;
- } else if (_inTopMenu) { // we're not in the menu. did we just leave it?
+
+ if (!SwordLogic::_scriptVars[TOP_MENU_DISABLED]) {
+ if (y < 40) { // okay, we are in the top menu.
+ if (!_inTopMenu) // are we just entering it?
+ _menu->fnStartMenu();
+ _menu->checkTopMenu();
+ _inTopMenu = true;
+ } else if (_inTopMenu) { // we're not in the menu. did we just leave it?
+ _menu->fnEndMenu();
+ _inTopMenu = false;
+ }
+ } else if (_inTopMenu) {
_menu->fnEndMenu();
_inTopMenu = false;
}
Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- screen.cpp 17 Dec 2003 01:47:47 -0000 1.7
+++ screen.cpp 17 Dec 2003 07:33:00 -0000 1.8
@@ -57,36 +57,17 @@
if (!SwordLogic::_scriptVars[SCROLL_FLAG])
return ; // screen is smaller than 640x400 => no need for scrolling
- int32 dx, dy;
- uint32 scrlDistX, scrlDistY;
uint32 scrlToX, scrlToY;
offsetX = inRange(0, offsetX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
offsetY = inRange(0, offsetY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
_oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
_oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
+ scrlToX = (uint32)offsetX;
+ scrlToY = (uint32)offsetY;
- if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
- scrlToX = (uint32)offsetX;
- scrlToY = (uint32)offsetY;
- } else { // catch up with required scroll offsets - speed depending on distance to catch up (dx and dy) & 'SCROLL_FRACTION' used
- // but limit to certain number of pixels per cycle (MAX_SCROLL_DISTANCE)
- dx = SwordLogic::_scriptVars[SCROLL_OFFSET_X] - offsetX;
- dy = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] - offsetY;
- int8 sig = (dx < 0) ? (-1) : 1;
- if (dx < 0)
- dx = -dx;
- scrlDistX = 1 + dx/SCROLL_FRACTION;
- scrlDistX = inRange(0, scrlDistX, MAX_SCROLL_DISTANCE);
- scrlToX = SwordLogic::_scriptVars[SCROLL_OFFSET_X] + sig * scrlDistX;
-
- sig = (dy < 0) ? (-1) : 1;
- if (dy < 0)
- dy = -dy;
- scrlDistY = 1 + dy/SCROLL_FRACTION;
- scrlDistY = inRange(0, scrlDistY, MAX_SCROLL_DISTANCE);
- scrlToY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] + sig * scrlDistY;
- }
+ if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) // first time on this screen - need absolute scroll immediately!
+ SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
scrlToX = inRange(0, scrlToX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
scrlToY = inRange(0, scrlToY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
if ((scrlToX != SwordLogic::_scriptVars[SCROLL_OFFSET_X]) || (scrlToY != SwordLogic::_scriptVars[SCROLL_OFFSET_Y])) {
@@ -103,8 +84,10 @@
}
void SwordScreen::fadeDownPalette(void) {
- _fadingStep = 15;
- _fadingDirection = FADE_DOWN;
+ if (!_isBlack) { // don't fade down twice
+ _fadingStep = 15;
+ _fadingDirection = FADE_DOWN;
+ }
}
void SwordScreen::fadeUpPalette(void) {
@@ -122,15 +105,16 @@
_targetPalette[(start + cnt) * 4 + 2] = palData[cnt * 3 + 2] << 2;
}
_resMan->resClose(id);
+ _isBlack = false;
if (fadeUp) {
_fadingStep = 1;
- _fadingDirection = 1;
+ _fadingDirection = FADE_UP;
} else
_system->set_palette(_targetPalette, start, length);
}
bool SwordScreen::stillFading(void) {
- return (_fadingStep > 0);
+ return !_isBlack;
}
void SwordScreen::updateScreen(void) {
@@ -662,8 +646,11 @@
_currentPalette[cnt] = (_targetPalette[cnt] * _fadingStep) >> 4;
_fadingStep += _fadingDirection;
- if (_fadingStep == 17)
+ if (_fadingStep == 17) {
_fadingStep = 0;
+ _isBlack = false;
+ } else if (_fadingStep == 0)
+ _isBlack = true;
}
void SwordScreen::fnSetParallax(uint32 screen, uint32 resId) {
Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- screen.h 17 Dec 2003 01:47:47 -0000 1.3
+++ screen.h 17 Dec 2003 07:33:00 -0000 1.4
@@ -142,6 +142,8 @@
uint8 _currentPalette[256 * 4]; // for fading
uint8 _fadingStep;
int8 _fadingDirection; // 1 for fade up, -1 for fade down
+ bool _isBlack; // if the logic already faded down the palette, this is set to show the
+ // mainloop that no further fading is necessary.
};
#endif //BSSCREEN_H
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound.h 17 Dec 2003 05:16:37 -0000 1.2
+++ sound.h 17 Dec 2003 07:33:00 -0000 1.3
@@ -68,8 +68,6 @@
void fnStopFx(int32 fxNo);
void clearAllFx(void);
int addToQueue(int32 fxNo);
- //void removeFromQueue(int32 fxNo);
- // ^= part of fnPlayFx
void engine(void);
Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sword1.cpp 17 Dec 2003 05:16:37 -0000 1.6
+++ sword1.cpp 17 Dec 2003 07:33:00 -0000 1.7
@@ -180,7 +180,6 @@
_music->stream();
frameTime = _system->get_msecs();
_systemVars.saveGameFlag = 0;
- debug(5, "\n\nNext logic cycle");
_logic->engine();
_logic->updateScreenParams(); // sets scrolling
@@ -222,8 +221,7 @@
} while ((SwordLogic::_scriptVars[SCREEN] == SwordLogic::_scriptVars[NEW_SCREEN]) &&
(_systemVars.saveGameFlag < 2)); // change screen
- // we don't fade down after syria pan (53). Also, scripts can call fnFadeDown, in that case, we already are fading
- if ((SwordLogic::_scriptVars[SCREEN] != 53) && (!_screen->stillFading()))
+ if (SwordLogic::_scriptVars[SCREEN] != 53) // we don't fade down after syria pan (53).
_screen->fadeDownPalette();
while (_screen->stillFading()) {
_music->stream();
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm player_mod.cpp,2.10,2.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.32,1.33 resman.cpp,1.77,1.78 router.cpp,1.32,1.33 router.h,1.13,1.14 walker.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list