[Scummvm-cvs-logs] CVS: scummvm/sword2 build_display.cpp,1.41,1.42 console.cpp,1.26,1.27 controls.cpp,1.44,1.45 debug.cpp,1.21,1.22 icons.cpp,1.19,1.20 mouse.cpp,1.34,1.35 mouse.h,1.8,1.9 resman.cpp,1.59,1.60 speech.cpp,1.39,1.40 sword2.cpp,1.73,1.74 sword2.h,1.31,1.32
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sun Nov 2 10:51:07 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm TODO,1.37,1.38
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui widget.cpp,1.20,1.21 widget.h,1.24,1.25 dialog.cpp,1.34,1.35 newgui.h,1.30,1.31 newgui.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv30203
Modified Files:
build_display.cpp console.cpp controls.cpp debug.cpp icons.cpp
mouse.cpp mouse.h resman.cpp speech.cpp sword2.cpp sword2.h
Log Message:
Even more stuff moving into Sword2Engine. I'm tempted to make a new class
for the mouse stuff, but I need to think about that a bit more. I have a
feeling the code could be cleaned up a bit anyway...
Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/build_display.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- build_display.cpp 2 Nov 2003 17:17:09 -0000 1.41
+++ build_display.cpp 2 Nov 2003 18:50:04 -0000 1.42
@@ -212,8 +212,8 @@
g_display->waitForFade();
}
- Set_mouse(0);
- Set_luggage(0);
+ setMouse(0);
+ setLuggage(0);
g_display->closeMenuImmediately();
g_display->clearScene();
@@ -654,20 +654,20 @@
build_unit->sort_y = build_unit->y + build_unit->scaled_height - 1;
if (params[0]) {
- // passed a mouse structure, so add to the mouse_list
+ // passed a mouse structure, so add to the _mouseList
ob_mouse = (Object_mouse *) params[0];
// only if 'pointer' isn't NULL
if (ob_mouse->pointer) {
- assert(cur_mouse < TOTAL_mouse_list);
+ assert(_curMouse < TOTAL_mouse_list);
- mouse_list[cur_mouse].x1 = build_unit->x;
- mouse_list[cur_mouse].y1 = build_unit->y;
- mouse_list[cur_mouse].x2 = build_unit->x + build_unit->scaled_width;
- mouse_list[cur_mouse].y2 = build_unit->y + build_unit->scaled_height;
+ _mouseList[_curMouse].x1 = build_unit->x;
+ _mouseList[_curMouse].y1 = build_unit->y;
+ _mouseList[_curMouse].x2 = build_unit->x + build_unit->scaled_width;
+ _mouseList[_curMouse].y2 = build_unit->y + build_unit->scaled_height;
- mouse_list[cur_mouse].priority = ob_mouse->priority;
- mouse_list[cur_mouse].pointer = ob_mouse->pointer;
+ _mouseList[_curMouse].priority = ob_mouse->priority;
+ _mouseList[_curMouse].pointer = ob_mouse->pointer;
// check if pointer text field is set due to previous
// object using this slot (ie. not correct for this
@@ -677,15 +677,15 @@
// isn't same is current id
// then we don't want this "left over" pointer text
- if (mouse_list[cur_mouse].pointer_text && mouse_list[cur_mouse].id != (int32) ID)
- mouse_list[cur_mouse].pointer_text=0;
+ if (_mouseList[_curMouse].pointer_text && _mouseList[_curMouse].id != (int32) ID)
+ _mouseList[_curMouse].pointer_text=0;
- mouse_list[cur_mouse].id = ID;
+ _mouseList[_curMouse].id = ID;
// not using sprite as detection mask
- mouse_list[cur_mouse].anim_resource = 0;
- mouse_list[cur_mouse].anim_pc = 0;
+ _mouseList[_curMouse].anim_resource = 0;
+ _mouseList[_curMouse].anim_pc = 0;
- cur_mouse++;
+ _curMouse++;
}
}
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/console.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- console.cpp 2 Nov 2003 15:58:45 -0000 1.26
+++ console.cpp 2 Nov 2003 18:50:05 -0000 1.27
@@ -380,7 +380,7 @@
}
// if mouse if off, or system menu is locked off
- if (mouse_status || mouse_mode_locked) {
+ if (g_sword2->_mouseStatus || g_sword2->_mouseModeLocked) {
DebugPrintf("WARNING: Cannot save game while control menu unavailable!\n");
return true;
}
@@ -428,7 +428,7 @@
}
// if mouse if off, or system menu is locked off
- if (mouse_status || mouse_mode_locked) {
+ if (g_sword2->_mouseStatus || g_sword2->_mouseModeLocked) {
DebugPrintf("WARNING: Cannot restore game while control menu unavailable!\n");
return true;
}
Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- controls.cpp 2 Nov 2003 17:17:09 -0000 1.44
+++ controls.cpp 2 Nov 2003 18:50:05 -0000 1.45
@@ -1293,7 +1293,7 @@
// Reset the mouse hot-spot list (see
// fnRegisterMouse and fnRegisterFrame)
- Reset_mouse_list();
+ g_sword2->resetMouseList();
if (g_logic.processSession())
error("restore 1st cycle failed??");
@@ -1465,7 +1465,7 @@
// reset the mouse hot-spot list (see fnRegisterMouse and
// fnRegisterFrame)
- Reset_mouse_list();
+ g_sword2->resetMouseList();
g_display->closeMenuImmediately();
Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/debug.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- debug.cpp 2 Nov 2003 17:17:09 -0000 1.21
+++ debug.cpp 2 Nov 2003 18:50:05 -0000 1.22
@@ -185,12 +185,12 @@
makeDebugTextBlock(buf, 0, 15);
- if (mouse_touching)
+ if (g_sword2->_mouseTouching)
sprintf(buf, "mouse %d,%d (id %d: %s)",
g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x,
g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y,
- mouse_touching,
- FetchObjectName(mouse_touching));
+ g_sword2->_mouseTouching,
+ FetchObjectName(g_sword2->_mouseTouching));
else
sprintf(buf, "mouse %d,%d (not touching)",
g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x,
Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/icons.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- icons.cpp 2 Nov 2003 15:58:45 -0000 1.19
+++ icons.cpp 2 Nov 2003 18:50:05 -0000 1.20
@@ -54,9 +54,9 @@
// so that the icon in 'object_held' is coloured while the rest are
// grey
- examining_menu_icon = 1;
+ g_sword2->_examiningMenuIcon = true;
g_sword2->buildMenu();
- examining_menu_icon = 0;
+ g_sword2->_examiningMenuIcon = false;
// script continue
return IR_CONT;
@@ -68,7 +68,7 @@
uint32 null_pc = 0;
uint32 j, k;
- uint8 icon_coloured;
+ bool icon_coloured;
uint8 *icon;
uint8 *head;
uint32 res;
@@ -154,7 +154,7 @@
// 'res' is now the resource id of the icon
res = _masterMenuList[j].icon_resource;
- if (examining_menu_icon) {
+ if (_examiningMenuIcon) {
// WHEN AN ICON HAS BEEN RIGHT-CLICKED FOR
// 'EXAMINE' - SELECTION COLOURED, THE REST
// GREYED OUT
@@ -163,9 +163,9 @@
// it coloured. If not, grey this one out.
if (res == OBJECT_HELD)
- icon_coloured = 1;
+ icon_coloured = true;
else
- icon_coloured = 0;
+ icon_coloured = false;
} else if (COMBINE_BASE) {
// WHEN ONE MENU OBJECT IS BEING USED WITH
// ANOTHER - BOTH TO BE COLOURED, THE REST
@@ -175,9 +175,9 @@
// combined...
if (res == OBJECT_HELD || res == COMBINE_BASE)
- icon_coloured = 1;
+ icon_coloured = true;
else
- icon_coloured = 0;
+ icon_coloured = false;
} else {
// NORMAL ICON SELECTION - SELECTION GREYED
// OUT, THE REST COLOURED
@@ -186,9 +186,9 @@
// not, make it coloured.
if (res == OBJECT_HELD)
- icon_coloured = 0;
+ icon_coloured = false;
else
- icon_coloured = 1;
+ icon_coloured = true;
}
icon = res_man.open(_masterMenuList[j].icon_resource) + sizeof(_standardHeader);
Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- mouse.cpp 2 Nov 2003 17:17:09 -0000 1.34
+++ mouse.cpp 2 Nov 2003 18:50:05 -0000 1.35
@@ -60,108 +60,59 @@
USE = 3100
};
-//the mouse list stuff
-
-uint32 cur_mouse;
-Mouse_unit mouse_list[TOTAL_mouse_list];
-
-// set by Check_mouse_list
-uint32 mouse_touching = 0;
-static uint32 old_mouse_touching = 0;
[...1116 lines suppressed...]
// params: none
- player_activity_delay = 0;
+ g_sword2->_playerActivityDelay = 0;
return IR_CONT;
-}
-
-void Monitor_player_activity(void) {
- // if there is at least one mouse event outstanding
- if (CheckForMouseEvents()) {
- // reset activity delay counter
- player_activity_delay = 0;
- } else {
- // no. of game cycles since mouse event queue last empty
- player_activity_delay++;
- }
}
} // End of namespace Sword2
Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mouse.h 28 Oct 2003 19:51:29 -0000 1.8
+++ mouse.h 2 Nov 2003 18:50:06 -0000 1.9
@@ -22,20 +22,22 @@
#include "sword2/object.h"
-namespace Sword2 {
-
#define TOTAL_mouse_list 50
-#define MOUSE_normal 0
-#define MOUSE_menu 1
-#define MOUSE_drag 2
-#define MOUSE_system_menu 3
-#define MOUSE_holding 4
+namespace Sword2 {
+
+enum {
+ MOUSE_normal = 0, // normal in game
+ MOUSE_menu = 1, // menu chooser
+ MOUSE_drag = 2, // dragging luggage
+ MOUSE_system_menu = 3, // system menu chooser
+ MOUSE_holding = 4 // speech chooser
+};
// mouse unit - like Object_mouse, but with anim resource & pc (needed if
// sprite is to act as mouse detection mask)
-typedef struct {
+struct Mouse_unit {
// Top-left and bottom-right of mouse area. These coords are inclusive
int32 x1;
int32 y1;
@@ -62,39 +64,7 @@
// local id of text line to print when pointer highlights an object
int32 pointer_text;
-} Mouse_unit;
-
-extern uint32 cur_mouse;
-extern Mouse_unit mouse_list[TOTAL_mouse_list];
-extern uint32 mouse_touching;
-extern uint32 mouse_mode;
-extern uint8 examining_menu_icon;
-
-// human 0 on/1 off
-extern uint32 mouse_status;
-
-// 0 not !0 mode cannot be changed from normal mouse to top menu (i.e. when
-// carrying big objects)
-extern uint32 mouse_mode_locked;
-
-//last minute for pause mode
-extern uint32 real_luggage_item;
-
-void Reset_mouse_list(void);
-
-void Normal_mouse(void);
-void Menu_mouse(void);
-void Drag_mouse(void);
-void System_menu_mouse(void);
-
-void Mouse_on_off(void);
-uint32 Check_mouse_list(void);
-void Mouse_engine(void);
-
-void Set_mouse(uint32 res);
-void Set_luggage(uint32 res);
-
-void ClearPointerText(void);
+};
} // End of namespace Sword2
Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- resman.cpp 1 Nov 2003 16:55:20 -0000 1.59
+++ resman.cpp 2 Nov 2003 18:50:06 -0000 1.60
@@ -30,7 +30,7 @@
#include "sword2/logic.h"
#include "sword2/maketext.h"
#include "sword2/memory.h"
-#include "sword2/mouse.h" // for system Set_mouse & Set_luggage routines
+#include "sword2/mouse.h" // for system setMouse & setLuggage routines
#include "sword2/protocol.h"
#include "sword2/resman.h"
#include "sword2/sound.h" // for Clear_fx_queue() called from cacheNewCluster()
@@ -998,7 +998,7 @@
if (file == NULL) {
error("init cannot *OPEN* cd.inf");
- }
+ }
_cd_inf cdInf;
@@ -1027,8 +1027,8 @@
g_display->clearScene();
- Set_mouse(0);
- Set_luggage(0);
+ g_sword2->setMouse(0);
+ g_sword2->setLuggage(0);
uint8 *bgfile;
bgfile = res_man.open(2950); // open the screen resource
Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/speech.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- speech.cpp 2 Nov 2003 17:17:10 -0000 1.39
+++ speech.cpp 2 Nov 2003 18:50:07 -0000 1.40
@@ -231,7 +231,7 @@
g_display->showMenu(RDMENU_BOTTOM);
// lets have the mouse pointer back
- Set_mouse(NORMAL_MOUSE_ID);
+ g_sword2->setMouse(NORMAL_MOUSE_ID);
choosing = 1;
@@ -280,7 +280,7 @@
IN_SUBJECT = 0;
// blank mouse again
- Set_mouse(0);
+ g_sword2->setMouse(0);
debug(5, "hit %d - ref %d ref*8 %d", hit, subject_list[hit].ref, subject_list[hit].ref * 8);
@@ -329,7 +329,7 @@
if (g_display->_mouseY > 399) {
// will wait for cursor to move off the bottom menu
- mouse_mode = MOUSE_holding;
+ g_sword2->_mouseMode = MOUSE_holding;
debug(5, " holding");
}
Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- sword2.cpp 2 Nov 2003 17:17:10 -0000 1.73
+++ sword2.cpp 2 Nov 2003 18:50:08 -0000 1.74
@@ -163,6 +163,23 @@
memset(_masterMenuList, 0, sizeof(_masterMenuList));
memset(&_thisScreen, 0, sizeof(_thisScreen));
+
+ memset(_mouseList, 0, sizeof(_mouseList));
+
+ _mouseTouching = 0;
+ _oldMouseTouching = 0;
+ _menuSelectedPos = 0;
+ _examiningMenuIcon = false;
+ _mousePointerRes = 0;
+ _mouseMode = 0;
+ _mouseStatus = false;
+ _mouseModeLocked = false;
+ _currentLuggageResource = 0;
+ _oldButton = 0;
+ _buttonClick = 0;
+ _pointerTextBlocNo = 0;
+ _playerActivityDelay = 0;
+ _realLuggageItem = 0;
}
Sword2Engine::~Sword2Engine() {
@@ -275,7 +292,7 @@
// reset the mouse hot-spot list (see fnRegisterMouse
// and fnRegisterFrame)
- Reset_mouse_list();
+ g_sword2->resetMouseList();
// keep going as long as new lists keep getting put in
// - i.e. screen changes
@@ -289,7 +306,7 @@
if (g_sword2->_thisScreen.scroll_flag)
Set_scrolling();
- Mouse_engine();
+ g_sword2->mouseEngine();
Process_fx_queue();
// update age and calculate previous cycle memory usage
@@ -325,7 +342,7 @@
if (SaveExists(_saveSlot))
RestoreGame(_saveSlot);
else { // show restore menu
- Set_mouse(NORMAL_MOUSE_ID);
+ setMouse(NORMAL_MOUSE_ID);
if (!gui->restoreControl())
Start_game();
}
@@ -517,8 +534,8 @@
PauseAllSound();
- //make a normal mouse
- ClearPointerText();
+ // make a normal mouse
+ g_sword2->clearPointerText();
// mouse_mode=MOUSE_normal;
@@ -526,10 +543,10 @@
g_display->setLuggageAnim(NULL, 0);
// blank cursor
- Set_mouse(0);
+ g_sword2->setMouse(0);
// forces engine to choose a cursor
- mouse_touching = 1;
+ g_sword2->_mouseTouching = 1;
// if level at max, turn down because palette-matching won't work
// when dimmed
@@ -552,8 +569,8 @@
// removed "PAUSED" from screen
// Kill_text_bloc(pause_text_bloc_no);
- if (OBJECT_HELD && real_luggage_item)
- Set_luggage(real_luggage_item);
+ if (OBJECT_HELD && g_sword2->_realLuggageItem)
+ g_sword2->setLuggage(g_sword2->_realLuggageItem);
UnpauseAllSound();
@@ -570,8 +587,8 @@
unpause_zone = 2;
// if mouse is about or we're in a chooser menu
- if (!mouse_status || choosing)
- Set_mouse(NORMAL_MOUSE_ID);
+ if (!g_sword2->_mouseStatus || choosing)
+ g_sword2->setMouse(NORMAL_MOUSE_ID);
}
} // End of namespace Sword2
Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- sword2.h 2 Nov 2003 17:17:10 -0000 1.31
+++ sword2.h 2 Nov 2003 18:50:09 -0000 1.32
@@ -30,6 +30,7 @@
#include "sword2/events.h"
#include "sword2/icons.h"
#include "sword2/layers.h"
+#include "sword2/mouse.h"
#include "sword2/object.h"
#include "sword2/driver/d_sound.h"
#include "sword2/driver/d_draw.h"
@@ -170,9 +171,6 @@
uint32 _curFgp0;
uint32 _curFgp1;
- // So I know if the control panel can be activated
- int32 _mouseStatus;
-
// Debugging stuff
uint32 _largestLayerArea;
@@ -226,6 +224,57 @@
screen_info _thisScreen;
void setUpBackgroundLayers(void);
+
+ uint32 _curMouse;
+ Mouse_unit _mouseList[TOTAL_mouse_list];
+
+ // Set by checkMouseList()
+ uint32 _mouseTouching;
+ uint32 _oldMouseTouching;
+
+ uint32 _menuSelectedPos;
+
+ // If it's NORMAL_MOUSE_ID (ie. normal pointer) then it's over a floor
+ // area (or hidden hot-zone)
+
+ uint32 _mousePointerRes;
+
+ uint32 _mouseMode;
+ bool _examiningMenuIcon;
+
+ bool _mouseStatus; // Human 0 on/1 off
+ bool _mouseModeLocked; // 0 not !0 mode cannot be changed from
+ // normal mouse to top menu (i.e. when
+ // carrying big objects)
+ uint32 _realLuggageItem; // Last minute for pause mode
+ uint32 _currentLuggageResource;
+ uint32 _oldButton; // For the re-click stuff - must be
+ // the same button you see
+ uint32 _buttonClick;
+ uint32 _pointerTextBlocNo;
+ uint32 _playerActivityDelay; // Player activity delay counter
+
+ void resetMouseList(void);
+
+ void normalMouse(void);
+ void menuMouse(void);
+ void dragMouse(void);
+ void systemMenuMouse(void);
+
+ void mouseOnOff(void);
+ uint32 checkMouseList(void);
+ void mouseEngine(void);
+
+ void setMouse(uint32 res);
+ void setLuggage(uint32 res);
+
+ void clearPointerText(void);
+
+ void createPointerText(uint32 text_id, uint32 pointer_res);
+ void monitorPlayerActivity(void);
+ void noHuman(void);
+
+ void registerMouse(Object_mouse *ob_mouse);
void errorString(const char *buf_input, char *buf_output);
void initialiseFontResourceFlags(void);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm TODO,1.37,1.38
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui widget.cpp,1.20,1.21 widget.h,1.24,1.25 dialog.cpp,1.34,1.35 newgui.h,1.30,1.31 newgui.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list