aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/cge_main.cpp5
-rw-r--r--engines/cge/cge_main.h2
-rw-r--r--engines/cge/events.cpp (renamed from engines/cge/keybd.cpp)171
-rw-r--r--engines/cge/events.h (renamed from engines/cge/mouse.h)35
-rw-r--r--engines/cge/gettext.cpp3
-rw-r--r--engines/cge/keybd.h63
-rw-r--r--engines/cge/mixer.cpp2
-rw-r--r--engines/cge/module.mk3
-rw-r--r--engines/cge/mouse.cpp194
-rw-r--r--engines/cge/snail.cpp3
-rw-r--r--engines/cge/vmenu.cpp2
11 files changed, 211 insertions, 272 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 0d8bef4b85..40bace9c51 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -36,8 +36,7 @@
#include "cge/snail.h"
#include "cge/text.h"
#include "cge/game.h"
-#include "cge/mouse.h"
-#include "cge/keybd.h"
+#include "cge/events.h"
#include "cge/cfile.h"
#include "cge/vol.h"
#include "cge/talk.h"
@@ -1857,8 +1856,10 @@ void CGEEngine::cge_main(void) {
if (Music && STARTUP::SoundOk)
LoadMIDI(0);
+/** *****DEBUG*****
if (STARTUP::Mode < 2)
movie(LGO_EXT);
+*/
if (showTitle("WELCOME")) {
if ((!_isDemo) && (STARTUP::Mode == 1))
movie("X02"); // intro
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 9b905ea360..1b77c05bf0 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -30,7 +30,7 @@
#include "cge/wav.h"
#include "cge/vga13h.h"
-#include "cge/mouse.h"
+#include "cge/events.h"
namespace CGE {
diff --git a/engines/cge/keybd.cpp b/engines/cge/events.cpp
index 45237d15d1..e5ad00da5e 100644
--- a/engines/cge/keybd.cpp
+++ b/engines/cge/events.cpp
@@ -25,11 +25,15 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
-#include "cge/keybd.h"
-#include "cge/mouse.h"
+#include "cge/events.h"
+#include "cge/events.h"
+#include "cge/text.h"
+#include "cge/cge_main.h"
namespace CGE {
+/*----------------- KEYBOARD interface -----------------*/
+
Sprite *Keyboard::_client = NULL;
uint8 Keyboard::_key[0x60] = { 0 };
uint16 Keyboard::_current = 0;
@@ -148,4 +152,167 @@ void Keyboard::NewKeyboard(...) {
warning("STUB: Keyboard::NewKeyboard");
}
+/*----------------- MOUSE interface -----------------*/
+
+Event Evt[EVT_MAX];
+
+uint16 EvtHead = 0, EvtTail = 0;
+
+MOUSE_FUN *MOUSE::OldMouseFun = NULL;
+uint16 MOUSE::OldMouseMask = 0;
+
+
+MOUSE::MOUSE(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), Busy(NULL), Hold(NULL), hx(0), _vm(vm) {
+ static Seq ms[] = {
+ { 0, 0, 0, 0, 1 },
+ { 1, 1, 0, 0, 1 }
+ };
+
+ setSeq(ms);
+
+ /* TODO Mouse handling
+ // Mouse reset
+ _AX = 0x0000; // soft & hard reset (0x0021 soft reset does not work)
+ __int__(0x33);
+ Exist = (_AX != 0);
+ Buttons = _BX;
+*/
+ gotoxy(SCR_WID/2, SCR_HIG/2);
+ _z = 127;
+ step(1);
+
+ Exist = true;
+ warning("STUB: MOUSE::MOUSE");
+}
+
+
+MOUSE::~MOUSE(void) {
+ Off();
+}
+
+
+//void MOUSE::SetFun (void)
+//{
+//}
+
+
+void MOUSE::On(void) {
+ /*
+ if (SeqPtr && Exist)
+ {
+ _CX = X + X; // horizontal position
+ _DX = Y; // vertical position
+ _AX = 0x0004; // Set Mouse Position
+ __int__(0x33);
+ // set new mouse fun
+ _ES = FP_SEG(NewMouseFun);
+ _DX = FP_OFF(NewMouseFun);
+ _CX = 0x001F; // 11111b = all events
+ _AX = 0x0014; // Swap User-Interrupt Vector
+ __int__(0x33);
+ // save old mouse fun
+ OldMouseMask = _CX;
+ OldMouseFun = (MOUSE_FUN *) MK_FP(_ES, _DX);
+
+ // set X bounds
+ _DX = (SCR_WID - W) * 2; // right limit
+ _CX = 0; // left limit
+ _AX = 0x0007; // note: each pixel = 2
+ __int__(0x33);
+
+ // set Y bounds
+ _DX = SCR_HIG - H; // bottom limit
+ _CX = 0; // top limit
+ _AX = 0x0008;
+ __int__(0x33);
+
+ Step(0);
+ if (Busy) Busy->Step(0);
+ }
+ */
+ warning("STUB: MOUSE::On");
+}
+
+
+void MOUSE::Off(void) {
+/*
+ if (SeqPtr == 0)
+ {
+ if (Exist)
+ {
+ // bring back old mouse fun
+ _ES = FP_SEG(OldMouseFun);
+ _DX = FP_OFF(OldMouseFun);
+ _CX = OldMouseMask;
+ _AX = 0x0014; // Swap User-Interrupt Vector
+ __int__(0x33);
+ }
+ Step(1);
+ if (Busy) Busy->Step(1);
+ }
+ */
+ warning("STUB: MOUSE::Off");
+}
+
+
+void MOUSE::ClrEvt(Sprite *spr) {
+ if (spr) {
+ uint16 e;
+ for (e = EvtTail; e != EvtHead; e = (e + 1) % EVT_MAX)
+ if (Evt[e]._ptr == spr)
+ Evt[e]._msk = 0;
+ } else
+ EvtTail = EvtHead;
+}
+
+
+void MOUSE::Tick(void) {
+ step();
+ while (EvtTail != EvtHead) {
+ Event e = Evt[EvtTail];
+ if (e._msk) {
+ if (Hold && e._ptr != Hold)
+ Hold->touch(e._msk | ATTN, e._x - Hold->_x, e._y - Hold->_y);
+
+ // update mouse cursor position
+ if (e._msk & ROLL)
+ gotoxy(e._x, e._y);
+
+ // activate current touched SPRITE
+ if (e._ptr) {
+ if (e._msk & KEYB)
+ e._ptr->touch(e._msk, e._x, e._y);
+ else
+ e._ptr->touch(e._msk, e._x - e._ptr->_x, e._y - e._ptr->_y);
+ } else if (Sys)
+ Sys->touch(e._msk, e._x, e._y);
+
+ if (e._msk & L_DN) {
+ Hold = e._ptr;
+ if (Hold) {
+ Hold->_flags._hold = true;
+ hx = e._x - Hold->_x;
+ hy = e._y - Hold->_y;
+ }
+ }
+
+ if (e._msk & L_UP) {
+ if (Hold) {
+ Hold->_flags._hold = false;
+ Hold = NULL;
+ }
+ }
+ ///Touched = e.Ptr;
+
+ // discard Text if button released
+ if (e._msk & (L_UP | R_UP))
+ KillText();
+ }
+ EvtTail = (EvtTail + 1) % EVT_MAX;
+ }
+ if (Hold)
+ Hold->gotoxy(_x - hx, _y - hy);
+}
+
+
} // End of namespace CGE
diff --git a/engines/cge/mouse.h b/engines/cge/events.h
index 4d95f10423..be4b15e133 100644
--- a/engines/cge/mouse.h
+++ b/engines/cge/events.h
@@ -25,14 +25,45 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
-#ifndef __MOUSE__
-#define __MOUSE__
+#ifndef __CGE_EVENTS__
+#define __CGE_EVENTS__
#include "cge/game.h"
#include "cge/talk.h"
+#include "cge/jbw.h"
+#include "cge/vga13h.h"
namespace CGE {
+/*----------------- KEYBOARD interface -----------------*/
+
+#define KEYBD_INT 9
+#define LSHIFT 42
+#define RSHIFT 54
+#define CTRL 29
+#define ALT 56
+
+
+class Keyboard {
+public:
+ static void (* OldKeyboard)(...);
+ static void NewKeyboard(...);
+ static uint16 _code[0x60];
+ static uint16 _current;
+ static Sprite *_client;
+ static uint8 _key[0x60];
+ static uint16 last() {
+ uint16 cur = _current;
+ _current = 0;
+ return cur;
+ }
+ static Sprite *setClient(Sprite *spr);
+ Keyboard();
+ ~Keyboard();
+};
+
+/*----------------- MOUSE interface -----------------*/
+
#define EVT_MAX 256
#define ROLL 0x01
#define L_DN 0x02
diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp
index 1b609e2d8b..889aee4fed 100644
--- a/engines/cge/gettext.cpp
+++ b/engines/cge/gettext.cpp
@@ -26,8 +26,7 @@
*/
#include "cge/gettext.h"
-#include "cge/keybd.h"
-#include "cge/mouse.h"
+#include "cge/events.h"
#include "cge/cge_main.h"
#include <string.h>
diff --git a/engines/cge/keybd.h b/engines/cge/keybd.h
deleted file mode 100644
index bb87ffb0ed..0000000000
--- a/engines/cge/keybd.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This code is based on original Soltys source code
- * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
- */
-
-#ifndef __KEYBD__
-#define __KEYBD__
-
-#include "cge/jbw.h"
-#include "cge/vga13h.h"
-
-namespace CGE {
-
-#define KEYBD_INT 9
-#define LSHIFT 42
-#define RSHIFT 54
-#define CTRL 29
-#define ALT 56
-
-
-class Keyboard {
-public:
- static void (* OldKeyboard)(...);
- static void NewKeyboard(...);
- static uint16 _code[0x60];
- static uint16 _current;
- static Sprite *_client;
- static uint8 _key[0x60];
- static uint16 last() {
- uint16 cur = _current;
- _current = 0;
- return cur;
- }
- static Sprite *setClient(Sprite *spr);
- Keyboard();
- ~Keyboard();
-};
-
-} // End of namespace CGE
-
-#endif
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index b6442f3cd3..f8c0b9ceab 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -28,7 +28,7 @@
#include "cge/mixer.h"
#include "cge/text.h"
#include "cge/snail.h"
-#include "cge/mouse.h"
+#include "cge/events.h"
#include "cge/snddrv.h"
#include "cge/cge_main.h"
#include <string.h>
diff --git a/engines/cge/module.mk b/engines/cge/module.mk
index 70967667a5..d9dea6534d 100644
--- a/engines/cge/module.mk
+++ b/engines/cge/module.mk
@@ -11,12 +11,11 @@ MODULE_OBJS := \
console.o \
detection.o \
ems.o \
+ events.o \
game.o \
general.o \
gettext.o \
- keybd.o \
mixer.o \
- mouse.o \
snail.o \
sound.o \
startup.o \
diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp
deleted file mode 100644
index a1b6b253ce..0000000000
--- a/engines/cge/mouse.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This code is based on original Soltys source code
- * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
- */
-
-#include "cge/mouse.h"
-#include "cge/text.h"
-#include "cge/cge_main.h"
-
-namespace CGE {
-
-Event Evt[EVT_MAX];
-
-uint16 EvtHead = 0, EvtTail = 0;
-
-MOUSE_FUN *MOUSE::OldMouseFun = NULL;
-uint16 MOUSE::OldMouseMask = 0;
-
-
-MOUSE::MOUSE(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), Busy(NULL), Hold(NULL), hx(0), _vm(vm) {
- static Seq ms[] = {
- { 0, 0, 0, 0, 1 },
- { 1, 1, 0, 0, 1 }
- };
-
- setSeq(ms);
-
- /* TODO Mouse handling
- // Mouse reset
- _AX = 0x0000; // soft & hard reset (0x0021 soft reset does not work)
- __int__(0x33);
- Exist = (_AX != 0);
- Buttons = _BX;
-*/
- gotoxy(SCR_WID/2, SCR_HIG/2);
- _z = 127;
- step(1);
-
- Exist = true;
- warning("STUB: MOUSE::MOUSE");
-}
-
-
-MOUSE::~MOUSE(void) {
- Off();
-}
-
-
-//void MOUSE::SetFun (void)
-//{
-//}
-
-
-void MOUSE::On(void) {
- /*
- if (SeqPtr && Exist)
- {
- _CX = X + X; // horizontal position
- _DX = Y; // vertical position
- _AX = 0x0004; // Set Mouse Position
- __int__(0x33);
- // set new mouse fun
- _ES = FP_SEG(NewMouseFun);
- _DX = FP_OFF(NewMouseFun);
- _CX = 0x001F; // 11111b = all events
- _AX = 0x0014; // Swap User-Interrupt Vector
- __int__(0x33);
- // save old mouse fun
- OldMouseMask = _CX;
- OldMouseFun = (MOUSE_FUN *) MK_FP(_ES, _DX);
-
- // set X bounds
- _DX = (SCR_WID - W) * 2; // right limit
- _CX = 0; // left limit
- _AX = 0x0007; // note: each pixel = 2
- __int__(0x33);
-
- // set Y bounds
- _DX = SCR_HIG - H; // bottom limit
- _CX = 0; // top limit
- _AX = 0x0008;
- __int__(0x33);
-
- Step(0);
- if (Busy) Busy->Step(0);
- }
- */
- warning("STUB: MOUSE::On");
-}
-
-
-void MOUSE::Off(void) {
-/*
- if (SeqPtr == 0)
- {
- if (Exist)
- {
- // bring back old mouse fun
- _ES = FP_SEG(OldMouseFun);
- _DX = FP_OFF(OldMouseFun);
- _CX = OldMouseMask;
- _AX = 0x0014; // Swap User-Interrupt Vector
- __int__(0x33);
- }
- Step(1);
- if (Busy) Busy->Step(1);
- }
- */
- warning("STUB: MOUSE::Off");
-}
-
-
-void MOUSE::ClrEvt(Sprite *spr) {
- if (spr) {
- uint16 e;
- for (e = EvtTail; e != EvtHead; e = (e + 1) % EVT_MAX)
- if (Evt[e]._ptr == spr)
- Evt[e]._msk = 0;
- } else
- EvtTail = EvtHead;
-}
-
-
-void MOUSE::Tick(void) {
- step();
- while (EvtTail != EvtHead) {
- Event e = Evt[EvtTail];
- if (e._msk) {
- if (Hold && e._ptr != Hold)
- Hold->touch(e._msk | ATTN, e._x - Hold->_x, e._y - Hold->_y);
-
- // update mouse cursor position
- if (e._msk & ROLL)
- gotoxy(e._x, e._y);
-
- // activate current touched SPRITE
- if (e._ptr) {
- if (e._msk & KEYB)
- e._ptr->touch(e._msk, e._x, e._y);
- else
- e._ptr->touch(e._msk, e._x - e._ptr->_x, e._y - e._ptr->_y);
- } else if (Sys)
- Sys->touch(e._msk, e._x, e._y);
-
- if (e._msk & L_DN) {
- Hold = e._ptr;
- if (Hold) {
- Hold->_flags._hold = true;
- hx = e._x - Hold->_x;
- hy = e._y - Hold->_y;
- }
- }
-
- if (e._msk & L_UP) {
- if (Hold) {
- Hold->_flags._hold = false;
- Hold = NULL;
- }
- }
- ///Touched = e.Ptr;
-
- // discard Text if button released
- if (e._msk & (L_UP | R_UP))
- KillText();
- }
- EvtTail = (EvtTail + 1) % EVT_MAX;
- }
- if (Hold)
- Hold->gotoxy(_x - hx, _y - hy);
-}
-
-} // End of namespace CGE
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 54b786722f..217acb2448 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -31,11 +31,10 @@
#include "cge/vga13h.h"
#include "cge/bitmaps.h"
#include "cge/text.h"
-#include "cge/mouse.h"
#include "cge/cge_main.h"
#include <stdio.h>
#include <stdlib.h>
-#include "cge/keybd.h"
+#include "cge/events.h"
namespace CGE {
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index 7e1d327b69..149af901e8 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -26,7 +26,7 @@
*/
#include "cge/vmenu.h"
-#include "cge/mouse.h"
+#include "cge/events.h"
#include "cge/cge_main.h"
#include <string.h>