[Scummvm-cvs-logs] CVS: scummvm/sky mouse.cpp,NONE,1.1 mouse.h,NONE,1.1 logic.cpp,1.21,1.22 logic.h,1.10,1.11 module.mk,1.9,1.10 sky.cpp,1.29,1.30 sky.h,1.21,1.22 skydefs.h,1.10,1.11

Joost Peters joostp at users.sourceforge.net
Mon May 5 06:21:01 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv6337/sky

Modified Files:
	logic.cpp logic.h module.mk sky.cpp sky.h skydefs.h 
Added Files:
	mouse.cpp mouse.h 
Log Message:
some mouse stuff + fnEnterSection

--- NEW FILE: mouse.cpp ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/sky/mouse.cpp,v 1.1 2003/05/05 13:19:59 joostp Exp $
 *
 */

#include "stdafx.h"
#include "sky/sky.h"

#define MICE_FILE	60300
#define NO_MAIN_OBJECTS	24
#define NO_LINC_OBJECTS	21

uint32 _mouseObjectList[] = {

	65,
	9,
	66,
	64,
	8,
	63,
	10,
	11,
	71,
	76,
	37,
	36,
	42,
	75,
	79,
	6,
	74,
	39,
	49,
	43,
	34,
	35,
	77,
	38,

	//Link cursors

	24625,
	24649,
	24827,
	24651,
	24583,
	24581,
	24582,
	24628,
	24650,
	24629,
	24732,
	24631,
	24584,
	24630,
	24626,
	24627,
	24632,
	24643,
	24828,
	24830,
	24829
};

SkyMouse::SkyMouse(SkyDisk *skyDisk) {

	_skyDisk = skyDisk;
	_mouseWidth = 6;
	_mouseHeight = 6;
	_maskWidth = 6;
	_maskHeight = 6;
	
	_miceData = _skyDisk->loadFile(MICE_FILE, NULL);
	_mouseData2 = _miceData;

	uint16 width = FROM_LE_16(((struct dataFileHeader *)_miceData)->s_width);
	uint16 height = FROM_LE_16(((struct dataFileHeader *)_miceData)->s_height);

	_savedData = (byte *)malloc((width * height) + sizeof(struct dataFileHeader));

	//load in the object mouse file
	_objectMouseData = _skyDisk->loadFile(MICE_FILE + 1, NULL);
	_mouseWidth = 1;
	_mouseHeight = 1;
		
	//_systemFlags |= SF_MOUSE;;

}

SkyMouse::~SkyMouse( ){
	free (_miceData);
	free (_savedData);
	free (_objectMouseData);
}

void SkyMouse::replaceMouseCursors(uint16 fileNo) {

	_skyDisk->loadFile(fileNo, _objectMouseData);

}

uint32 SkyMouse::fnBlankMouse(void) {

	_mouseXOff = 0;	//re-align mouse
	spriteMouse(MOUSE_BLANK, 0, 0);

	return 1;

}

void SkyMouse::lockMouse(void) {

	_lockMouseX = _aMouseX;
	_lockMouseY = _aMouseY;

}

void SkyMouse::unlockMouse(void) {

	_aMouseX = _lockMouseX;
	_aMouseY = _lockMouseY;

}

void SkyMouse::restoreMouseData(uint16 frameNum) {
	warning("Stub: SkyMouse::restoreMouseData");
}

void SkyMouse::drawNewMouse() {
	warning("Stub: SkyMouse::drawNewMouse");
	//calculateMouseValues();
	//saveMouseData();
	//drawMouse();
}

void SkyMouse::spriteMouse(uint16 frameNum, uint16 mouseX, uint16 mouseY) {

	//_mouseFlag |= MF_IN_INT;
	_mouseType2 = frameNum;
	_mouseOffsetX = mouseX;
	_mouseOffsetY = mouseY;

	restoreMouseData(frameNum);

	byte *mouseData = _miceData;
	uint32 pos = ((struct dataFileHeader *)mouseData)->s_sp_size * ((struct dataFileHeader *)mouseData)->s_sp_size;
	pos += sizeof(struct dataFileHeader);
	_mouseData2 = mouseData + pos;	

	_mouseWidth = ((struct dataFileHeader *)mouseData)->s_width;
	_mouseHeight = ((struct dataFileHeader *)mouseData)->s_height;

	drawNewMouse();

	//_mouseFlag ^= (~_mouseFlag | MF_IN_INT);
}

--- NEW FILE: mouse.h ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/sky/mouse.h,v 1.1 2003/05/05 13:19:59 joostp Exp $
 *
 */

#ifndef __SkyMouse__
#define __SkyMouse__

#include "stdafx.h"
#include "sky/disk.h"
#include "sky/struc.h"

class SkyMouse {

public:
	SkyMouse(SkyDisk *skyDisk);
	~SkyMouse(void);

	void replaceMouseCursors(uint16 fileNo);
	uint32 fnBlankMouse(void);
	void lockMouse(void);
	void unlockMouse(void);
	void restoreMouseData(uint16 frameNum);
	void drawNewMouse(void);
	void spriteMouse(uint16 frameNum, uint16 mouseX, uint16 mouseY);


protected:
	uint16 _aMouseX;	//actual mouse coordinates
	uint16 _aMouseY;	

	uint16 _lockMouseX;
	uint16 _lockMouseY;

	uint16 _mouseOffsetX;	//for offsetting the mouse
	uint16 _mouseOffsetY;	//positive offsets only, mouse moves left or up

	uint16	_mouseType2;	//number of current mouse
	byte *_mouseData2;	//pointer to mouse data

	uint16 _mouseWidth;	//mouse width and height
	uint16 _mouseHeight;

	byte *_mousePosition;	//current screen address of mouse
	uint16 _maskWidth;	//width on screen
	uint16 _maskHeight;	//height on screen

	byte *_savedData;	//place for saved data

	uint32 _mouseFlag;	//bit 0 set when in handler
				//bit 1 set when screen data has been saved
				//bit 2 set when we don't want to show mouse

	byte *_miceData;	//address of mouse sprites
	byte *_objectMouseData;	//address of object mouse sprites
	
	uint16	_tMouseX;
	uint16	_tMouseY;

	uint16	_mouseXOff;
	
	static uint32 _mouseObjectList[];
	
	SkyDisk *_skyDisk;

};

#endif //__SkyMouse__

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- logic.cpp	2 May 2003 12:16:50 -0000	1.21
+++ logic.cpp	5 May 2003 13:19:57 -0000	1.22
@@ -48,10 +48,13 @@
 	&SkyLogic::simpleAnim,	 // 16 Module anim without x,y's
 };
 
-SkyLogic::SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText) {
+SkyLogic::SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, uint32 gameVersion) {
 	_skyDisk = skyDisk;
 	_skyGrid = skyGrid;
 	_skyText = skyText;
+	_skyMusic = skyMusic;
+	_skyMouse = skyMouse;
+	_gameVersion = gameVersion;
 	_skyAutoRoute = new SkyAutoRoute(_skyGrid);
 
 	for (uint i = 0; i < sizeof(_moduleList)/sizeof(uint16*); i++)
@@ -1076,8 +1079,7 @@
 }
 
 uint32 SkyLogic::fnBlankMouse(uint32 a, uint32 b, uint32 c) {
-	warning("Stub: fnBlankMouse");
-	return 1;
+	return _skyMouse->fnBlankMouse();
 }
 
 uint32 SkyLogic::fnCrossMouse(uint32 a, uint32 b, uint32 c) {
@@ -1532,8 +1534,30 @@
 	error("Stub: fnLeaveSection");
 }
 
-uint32 SkyLogic::fnEnterSection(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnEnterSection");
+uint32 SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
+	
+	if (SkyState::isDemo(_gameVersion))
+		if (sectionNo > 2)
+			error("End of demo");
+
+	_scriptVariables[CUR_SECTION] = sectionNo;
+
+	if (sectionNo == 5) //linc section - has different mouse icons
+		_skyMouse->replaceMouseCursors(60302);
+
+	else
+		if (sectionNo != _currentSection) {
+
+			_currentSection = sectionNo;
+			_saveCurrentSection = sectionNo;
+
+			sectionNo++;
+			_skyMusic->loadSectionMusic(sectionNo);
+			_skyGrid->loadGrids();
+
+		}
+			
+	return 1;
 }
 
 uint32 SkyLogic::fnRestoreGame(uint32 a, uint32 b, uint32 c) {

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- logic.h	1 May 2003 14:05:10 -0000	1.10
+++ logic.h	5 May 2003 13:19:59 -0000	1.11
@@ -26,10 +26,12 @@
 #include "sky/disk.h"
 #include "sky/grid.h"
 #include "sky/autoroute.h"
+#include "sky/musicbase.h"
+#include "sky/mouse.h"
 
 class SkyLogic {
 public:
-	SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText);
+	SkyLogic(SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, uint32 gameVersion);
 	void engine();
 
 	void lreturn();
@@ -144,7 +146,7 @@
 	uint32 fnEyeball(uint32 a, uint32 b, uint32 c);
 	uint32 fnCursorUp(uint32 a, uint32 b, uint32 c);
 	uint32 fnLeaveSection(uint32 a, uint32 b, uint32 c);
-	uint32 fnEnterSection(uint32 a, uint32 b, uint32 c);
+	uint32 fnEnterSection(uint32 sectionNo, uint32 b, uint32 c);
 	uint32 fnRestoreGame(uint32 a, uint32 b, uint32 c);
 	uint32 fnRestartGame(uint32 a, uint32 b, uint32 c);
 	uint32 fnNewSwingSeq(uint32 a, uint32 b, uint32 c);
@@ -185,10 +187,17 @@
 	Compact *_compact;
 	uint32 _scriptVariables[838];
 
+	uint32 _currentSection;
+	uint32 _saveCurrentSection;
+	
+	uint32 _gameVersion;
+	
 	SkyDisk *_skyDisk;
 	SkyGrid *_skyGrid;
 	SkyText *_skyText;
+	SkyMusicBase *_skyMusic;
 	SkyAutoRoute *_skyAutoRoute;
+	SkyMouse *_skyMouse;
 };
 
 #endif

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/module.mk,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- module.mk	3 May 2003 05:19:07 -0000	1.9
+++ module.mk	5 May 2003 13:19:59 -0000	1.10
@@ -13,6 +13,7 @@
 	sky/grid.o \
 	sky/intro.o \
 	sky/logic.o \
+	sky/mouse.o \
 	sky/musicbase.o \
 	sky/rnc_deco.o \
 	sky/screen.o \

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sky.cpp	3 May 2003 02:59:45 -0000	1.29
+++ sky.cpp	5 May 2003 13:19:59 -0000	1.30
@@ -25,6 +25,7 @@
 #include "sky/compact.h"
 #include "sky/logic.h"
 #include "sky/debug.h"
+#include "sky/mouse.h"
 #include "common/file.h"
 #include "common/gameDetector.h"
 #include <errno.h>
@@ -128,6 +129,7 @@
 
 	_gameVersion = _skyDisk->determineGameVersion();
 	_skyText = getSkyText();
+	_skyMouse = new SkyMouse(_skyDisk);
 	
 	initialiseScreen();
 	initVirgin();
@@ -137,7 +139,7 @@
 	//initialiseRouter();
 	loadFixedItems();
 	_skyGrid = new SkyGrid(_skyDisk);
-	_skyLogic = new SkyLogic(_skyDisk, _skyGrid, _skyText);
+	_skyLogic = new SkyLogic(_skyDisk, _skyGrid, _skyText, _skyMusic, _skyMouse, _gameVersion);
 }
 
 void SkyState::initItemList() {

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- sky.h	3 May 2003 02:59:45 -0000	1.21
+++ sky.h	5 May 2003 13:19:59 -0000	1.22
@@ -35,6 +35,7 @@
 #include "sky/musicbase.h"
 #include "sky/adlibmusic.h"
 #include "sky/gmmusic.h"
+#include "sky/mouse.h"
 
 class SkyLogic;
 class SkyGrid;
@@ -89,6 +90,7 @@
 	SkyText *_skyText;
 	SkyGrid *_skyGrid;
 	SkyLogic *_skyLogic;
+	SkyMouse *_skyMouse;
 
 	SkyMusicBase *_skyMusic;
 	GameDetector *_detector; // necessary for music

Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- skydefs.h	4 May 2003 13:52:20 -0000	1.10
+++ skydefs.h	5 May 2003 13:19:59 -0000	1.11
@@ -43,6 +43,7 @@
 #define HIT_ID 38
 #define THE_CHOSEN_ONE 52
 #define TEXT1 54
+#define CUR_SECTION	144
 
 //screen/grid defines
 #define GAME_SCREEN_WIDTH	320
@@ -4242,4 +4243,53 @@
 #define C_AT_WAS	82
 #define C_ALT	84
 #define C_REQUEST	86
+
+//system flags
+#define SF_TIMER	(1 << 0)	// set if timer interrupt redirected
+#define SF_GRAPHICS	(1 << 1)	// set if screen is in graphics mode
+#define SF_MOUSE	(1 << 2)	// set if mouse handler installed
+#define SF_KEYBOARD	(1 << 3)	// set if keyboard interrupt redirected
+#define SF_MUSIC_BOARD	(1 << 4)	// set if a music board detected
+#define SF_ROLAND	(1 << 5)	// set if roland board present
+#define SF_ADLIB	(1 << 6)	// set if adlib board present
+#define SF_SBLASTER	(1 << 7)	// set if sblaster present
+#define SF_TANDY	(1 << 8)	// set if tandy present
+#define SF_MUSIC_BIN	(1 << 9)	// set if music driver is loaded
+#define SF_PLUS_FX	(1 << 10)	// set if extra fx module needed
+#define SF_FX_OFF	(1 << 11)	// set if fx disabled
+#define SF_MUS_OFF	(1 << 12)	// set if music disabled
+#define SF_TIMER_TICK	(1 << 13)	// set every timer interupt
+
+// Status flags
+#define SF_CHOOSING	(1 << 14)	// set when choosing text
+#define SF_NO_SCROLL	(1 << 15)	// when set don't scroll
+#define SF_SPEED	(1 << 16)	// when set allow speed options
+#define SF_GAME_RESTORED	(1 << 17)	// set when game restored or restarted
+#define SF_REPLAY_RST	(1 << 18)	// set when loading restart data (used to stop rewriting of replay file)
+#define SF_SPEECH_FILE	(1 << 19)	// set when loading speech file
+#define SF_VOC_PLAYING	(1 << 20)	// set when a voc file is playing
+#define SF_PLAY_VOCS	(1 << 21)	// set when we want speech instead of text
+#define SF_CRIT_ERR	(1 << 22)	// set when critical error routine trapped
+#define SF_ALLOW_SPEECH	(1 << 23)	// speech allowes on cd sblaster version
+#define SF_ALLOW_TEXT	(1 << 24)	// text allowed on cd sblaster version
+#define SF_ALLOW_QUICK	(1 << 25)	// when set allow speed playing
+#define SF_TEST_DISK	(1 << 26)	// set when loading files
+#define SF_MOUSE_STOPPED	(1 << 27)	// set if mouse handler skipped to prevent stack overflow
+
+// Mouse flags
+#define MF_NO_UPDATE	(1 << 0)	// set to disable mouse updating
+#define MF_IN_INT	(1 << 1)	// set when in mouse interrupt
+#define MF_SAVED	(1 << 2)	// set when saved data is valid
+#define MF_GOT_INT	(1 << 3)	// set when mouse interrupt received
+
+#define MOUSE_NORMAL	(1 << 1)	// normal mouse
+#define MOUSE_DISK	(1 << 2)	// disk mouse
+#define MOUSE_DOWN	(1 << 3)
+#define MOUSE_RIGHT	(1 << 4)	// right pointer
+#define MOUSE_LEFT	(1 << 5)	// left pointer
+#define MOUSE_BLANK	(1 << 6)	// blank mouse
+#define MOUSE_CROSS	(1 << 7)	// angry mouse
+#define MOUSE_UP	(1 << 8)	// mouse up
+
+
 





More information about the Scummvm-git-logs mailing list