[Scummvm-cvs-logs] CVS: scummvm/bs2/driver _mouse.cpp,1.18,1.19 rdwin.cpp,1.25,1.26 rdwin.h,1.3,1.4
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sat Sep 27 04:48:24 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.18,1.19 build_display.cpp,1.24,1.25 console.cpp,1.10,1.11 console.h,1.4,1.5 debug.cpp,1.9,1.10 debug.h,1.4,1.5 events.cpp,1.5,1.6 function.cpp,1.15,1.16 icons.cpp,1.8,1.9 interpreter.cpp,1.13,1.14 interpreter.h,1.7,1.8 layers.cpp,1.7,1.8 logic.cpp,1.14,1.15 maketext.cpp,1.13,1.14 mem_view.cpp,1.9,1.10 memory.cpp,1.7,1.8 mouse.cpp,1.17,1.18 protocol.cpp,1.10,1.11 resman.cpp,1.43,1.44 router.cpp,1.15,1.16 save_rest.cpp,1.18,1.19 scroll.cpp,1.4,1.5 sound.cpp,1.17,1.18 speech.cpp,1.22,1.23 startup.cpp,1.13,1.14 sword2.cpp,1.39,1.40 sync.cpp,1.5,1.6 tony_gsdk.cpp,1.9,1.10 walker.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/bs2 sword2.cpp,1.40,1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/bs2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv15614/driver
Modified Files:
_mouse.cpp rdwin.cpp rdwin.h
Log Message:
More cleanup, and I've replaced most - not quite all - of BS2's debug
message functions with our own.
We still need to go through them and assign sensible debug levels to them.
Index: _mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/_mouse.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- _mouse.cpp 23 Sep 2003 16:53:25 -0000 1.18
+++ _mouse.cpp 27 Sep 2003 11:02:57 -0000 1.19
@@ -64,89 +64,79 @@
//
//=============================================================================
-
-//#include "ddraw.h"
-
#include "stdafx.h"
#include "driver96.h"
-
#include "d_draw.h"
#include "render.h"
#include "menu.h"
#include "../sword2.h"
-
#define MAX_MOUSE_EVENTS 16
#define MOUSEFLASHFRAME 6
-// FIXME: Does this struct have to be packed?
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
typedef struct {
- uint8 runTimeComp; // type of runtime compression used for the frame data
- uint8 noAnimFrames; // number of frames in the anim
- int8 xHotSpot;
- int8 yHotSpot;
- uint8 mousew;
- uint8 mouseh;
-} _mouseAnim;
-
-int16 mousex;
-int16 mousey;
-
-static uint8 mouseBacklog = 0;
-static uint8 mouseLogPos = 0;
-static uint8 mouseFrame;
-static uint8 *mouseSprite = NULL;
-static _mouseAnim *mouseAnim = NULL;
-static _mouseAnim *luggageAnim = NULL;
-static _mouseEvent mouseLog[MAX_MOUSE_EVENTS];
-static int32 *mouseOffsets;
-static int32 *luggageOffset;
+ uint8 runTimeComp; // type of runtime compression used for the
+ // frame data
+ uint8 noAnimFrames; // number of frames in the anim
+ int8 xHotSpot;
+ int8 yHotSpot;
+ uint8 mousew;
+ uint8 mouseh;
+} GCC_PACK _mouseAnim;
-// FIXME: I have no idea how large the mouse cursor can be. Is this enough?
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
-byte _mouseData[128 * 128];
+int16 mousex;
+int16 mousey;
+static uint8 mouseBacklog = 0;
+static uint8 mouseLogPos = 0;
+static uint8 mouseFrame;
+static uint8 *mouseSprite = NULL;
+static _mouseAnim *mouseAnim = NULL;
+static _mouseAnim *luggageAnim = NULL;
+static _mouseEvent mouseLog[MAX_MOUSE_EVENTS];
+static int32 *mouseOffsets;
+static int32 *luggageOffset;
+// This is the maximum mouse cursor size in the SDL backend
+#define MAX_MOUSE_W 80
+#define MAX_MOUSE_H 80
+byte _mouseData[MAX_MOUSE_W * MAX_MOUSE_H];
void ResetRenderEngine(void) {
parallaxScrollx = 0;
parallaxScrolly = 0;
scrollx = 0;
scrolly = 0;
-
}
+// --------------------------------------------------------------------------
+// Logs the mouse button event passed in buttons. The button events are
+// defined as RD_LEFTBUTTONDOWN, RD_LEFTBUTTONUP, RD_RIGHTBUTTONDOWN and
+// RD_RIGHTBUTTONUP.
+// --------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------
-// Logs the mouse button event passed in buttons. The button events are
-// defined as RD_LEFTBUTTONDOWN, RD_LEFTBUTTONUP, RD_RIGHTBUTTONDOWN and
-// RD_RIGHTBUTTONUP.
-// --------------------------------------------------------------------------
-void LogMouseEvent(uint16 buttons)
-
-{
-
+void LogMouseEvent(uint16 buttons) {
_mouseEvent *me;
-
- if (mouseBacklog == MAX_MOUSE_EVENTS-1) // We need to leave the one which is
- { // the current event alone!
+ // We need to leave the one, which is the current event, alone!
+ if (mouseBacklog == MAX_MOUSE_EVENTS - 1)
return;
- }
me = &mouseLog[(mouseBacklog + mouseLogPos) % MAX_MOUSE_EVENTS];
me->buttons = buttons;
- mouseBacklog += 1;
-
+ mouseBacklog++;
}
-
-
// FIXME: The original code used 0 for transparency, while our backend uses
// 0xFF. That means that parts of the mouse cursor that weren't meant to be
// transparent may be now.
@@ -174,11 +164,10 @@
i += *comp++;
}
}
+
return RD_OK;
}
-
-
void DrawMouse(void) {
if (!mouseAnim && !luggageAnim)
return;
@@ -222,16 +211,18 @@
assert(deltaX >= 0);
assert(deltaY >= 0);
- // HACK for maximum cursor size
- if (mouse_width + deltaX > 80)
+ // HACK for maximum cursor size. (The SDL backend imposes this
+ // restriction)
+
+ if (mouse_width + deltaX > MAX_MOUSE_W)
deltaX = 80 - mouse_width;
- if (mouse_height + deltaY > 80)
+ if (mouse_height + deltaY > MAX_MOUSE_H)
deltaY = 80 - mouse_height;
mouse_width += deltaX;
mouse_height += deltaY;
- if ((uint32)(mouse_width * mouse_height) > sizeof(_mouseData)) {
+ if ((uint32) (mouse_width * mouse_height) > sizeof(_mouseData)) {
warning("Mouse cursor too large");
return;
}
@@ -239,7 +230,7 @@
memset(_mouseData, 0xFF, mouse_width * mouse_height);
if (luggageAnim)
- DecompressMouse(_mouseData, (uint8 *) luggageAnim + (int32)READ_LE_UINT32(luggageOffset), luggageAnim->mousew,
+ DecompressMouse(_mouseData, (uint8 *) luggageAnim + READ_LE_UINT32(luggageOffset), luggageAnim->mousew,
luggageAnim->mouseh, mouse_width, deltaX, deltaY);
if (mouseAnim)
@@ -248,35 +239,25 @@
g_system->set_mouse_cursor(_mouseData, mouse_width, mouse_height, hotspot_x, hotspot_y);
}
-
-
-_mouseEvent *MouseEvent(void)
-
-{
+_mouseEvent *MouseEvent(void) {
_mouseEvent *me;
- if (mouseBacklog)
- {
+ if (mouseBacklog) {
me = &mouseLog[mouseLogPos];
if (++mouseLogPos == MAX_MOUSE_EVENTS)
- {
mouseLogPos = 0;
- }
- mouseBacklog -= 1;
- return(me);
- }
- return(NULL);
+ mouseBacklog--;
+ return me;
+ }
+ return NULL;
}
-
-uint8 CheckForMouseEvents(void) // (James23july97)
-{
- return (mouseBacklog); // return the number of mouse events waiting
+uint8 CheckForMouseEvents(void) {
+ return mouseBacklog; // return the number of mouse events waiting
}
-
int32 AnimateMouse(void) {
uint8 prevMouseFrame = mouseFrame;
@@ -285,7 +266,8 @@
if (++mouseFrame == mouseAnim->noAnimFrames)
mouseFrame = MOUSEFLASHFRAME;
- mouseSprite = (uint8 *) mouseAnim + (int32)READ_LE_UINT32(mouseOffsets + mouseFrame);
+
+ mouseSprite = (uint8 *) mouseAnim + READ_LE_UINT32(mouseOffsets + mouseFrame);
if (mouseFrame != prevMouseFrame)
DrawMouse();
@@ -293,18 +275,18 @@
return RD_OK;
}
-
-
int32 SetMouseAnim(uint8 *ma, int32 size, int32 mouseFlash) {
if (mouseAnim) {
free(mouseAnim);
mouseAnim = NULL;
}
+
if (ma) {
if (mouseFlash == RDMOUSE_FLASH)
mouseFrame = 0;
else
mouseFrame = MOUSEFLASHFRAME;
+
mouseAnim = (_mouseAnim *) malloc(size);
if (!mouseAnim)
return RDERR_OUTOFMEMORY;
@@ -322,15 +304,16 @@
else
g_system->show_mouse(false);
}
+
return RD_OK;
}
-
int32 SetLuggageAnim(uint8 *ma, int32 size) {
if (luggageAnim) {
free(luggageAnim);
luggageAnim = NULL;
}
+
if (ma) {
luggageAnim = (_mouseAnim *) malloc(size);
if (!luggageAnim)
@@ -349,7 +332,6 @@
else
g_system->show_mouse(false);
}
+
return RD_OK;
}
-
-
Index: rdwin.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/rdwin.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- rdwin.cpp 25 Sep 2003 06:11:07 -0000 1.25
+++ rdwin.cpp 27 Sep 2003 11:02:58 -0000 1.26
@@ -37,7 +37,7 @@
#define MENUDEEP 40 // Temporary, until menu.h is written!
-
+#if 0
//-----------------------------------------------------------------------------
void Zdebug(const char *format,...) {
@@ -68,6 +68,7 @@
#endif
#endif
}
+#endif
//-----------------------------------------------------------------------------
// OSystem Event Handler. Full of cross platform goodness and 99% fat free!
Index: rdwin.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/driver/rdwin.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rdwin.h 23 Sep 2003 16:53:25 -0000 1.3
+++ rdwin.h 27 Sep 2003 11:02:58 -0000 1.4
@@ -17,29 +17,8 @@
* $Header$
*/
-//=============================================================================
-//
-// Filename : rdwin.h
-// Created : 20th August 1996
-// By : P.R.Porter
-//
-// Summary : This include file defines links to all data which is
-// defined in the rdwin.c module, but can be accessed by
-// other parts of the driver96 library.
-//
-//
-//=============================================================================
-
-
#ifndef RDWIN_H
#define RDWIN_H
-
-/*
-extern HWND hwnd; // handle to the current window
-extern RECT rcWindow; // size of the current window.
-
-extern void Message(LPSTR fmt, ...);
-*/
extern void SetNeedRedraw(void);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.18,1.19 build_display.cpp,1.24,1.25 console.cpp,1.10,1.11 console.h,1.4,1.5 debug.cpp,1.9,1.10 debug.h,1.4,1.5 events.cpp,1.5,1.6 function.cpp,1.15,1.16 icons.cpp,1.8,1.9 interpreter.cpp,1.13,1.14 interpreter.h,1.7,1.8 layers.cpp,1.7,1.8 logic.cpp,1.14,1.15 maketext.cpp,1.13,1.14 mem_view.cpp,1.9,1.10 memory.cpp,1.7,1.8 mouse.cpp,1.17,1.18 protocol.cpp,1.10,1.11 resman.cpp,1.43,1.44 router.cpp,1.15,1.16 save_rest.cpp,1.18,1.19 scroll.cpp,1.4,1.5 sound.cpp,1.17,1.18 speech.cpp,1.22,1.23 startup.cpp,1.13,1.14 sword2.cpp,1.39,1.40 sync.cpp,1.5,1.6 tony_gsdk.cpp,1.9,1.10 walker.cpp,1.7,1.8
- Next message: [Scummvm-cvs-logs] CVS: scummvm/bs2 sword2.cpp,1.40,1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list