aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-07-03 17:09:19 +0200
committeruruk2013-07-03 17:09:19 +0200
commit490e66e239bc4128250ad089611bb213ad87ccf2 (patch)
tree3410978a6b9cbb2c36deea3c5e974761f2872788 /engines
parent590f89e90e547076f27c25dfb2c1058f7f95bbbf (diff)
downloadscummvm-rg350-490e66e239bc4128250ad089611bb213ad87ccf2.tar.gz
scummvm-rg350-490e66e239bc4128250ad089611bb213ad87ccf2.tar.bz2
scummvm-rg350-490e66e239bc4128250ad089611bb213ad87ccf2.zip
AVALANCHE: Gyro: Implement file handling.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/gyro2.cpp44
-rw-r--r--engines/avalanche/gyro2.h9
2 files changed, 50 insertions, 3 deletions
diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp
index 5af1670af1..04a1d1425f 100644
--- a/engines/avalanche/gyro2.cpp
+++ b/engines/avalanche/gyro2.cpp
@@ -38,6 +38,7 @@
#include "avalanche/trip6.h"
#include "common/textconsole.h"
+#include "common/file.h"
//#include "dropdown.h"
//#include "basher.h"
@@ -248,6 +249,18 @@ Gyro::Gyro() : interrogation(0), oncandopageswap(true) {
whereis[i] = static_const_whereis[i];
}
+Gyro::~Gyro() {
+ /* These are allocated in Gyro::setup_vmc */
+
+ free(vmc.andpic);
+ free(vmc.xorpic);
+
+ for (int fv = 0; fv < 2; fv ++) {
+ free(vmc.backpic[fv]);
+ }
+
+}
+
void Gyro::setParent(AvalancheEngine *vm) {
_vm = vm;
}
@@ -467,7 +480,13 @@ void Gyro::wipe_vmc(byte page_) {
}
void Gyro::setup_vmc() {
- warning("STUB: Gyro::setup_vmc()");
+ vmc.andpic = malloc(mouse_size);
+ vmc.xorpic = malloc(mouse_size);
+
+ for (int fv = 0; fv < 2; fv ++) {
+ vmc.backpic[fv] = malloc(mouse_size);
+ vmc.wherewas[fv].x = 32767;
+ }
}
void Gyro::clear_vmc() {
@@ -483,7 +502,28 @@ void Gyro::setminmaxvertcurspos(uint16 min, uint16 max) {
}
void Gyro::load_a_mouse(byte which) {
- warning("STUB: Gyro::load_a_mouse()");
+ Common::File f;
+
+ if (!f.open("mice.avd")) {
+ warning("AVALANCHE: Gyro: File not found: mice.avd");
+ return;
+ }
+
+ f.seek(mouse_size * 2 * (which - 1) + 134);
+
+ for (int i = 0; i < mouse_size; i++)
+ ((byte *) vmc.andpic)[i] = f.readByte();
+
+ for (int i = 0; i < mouse_size; i++)
+ ((byte *) vmc.xorpic)[i] = f.readByte();
+
+ f.close();
+
+ vmc.ofsx = -mps[which].horzhotspot;
+ vmc.ofsy = -mps[which].verthotspot;
+
+ setminmaxhorzcurspos(mps[which].horzhotspot, 624 + mps[which].horzhotspot);
+ setminmaxvertcurspos(mps[which].verthotspot, 199);
}
void Gyro::background(byte x) {
diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h
index 42463504a3..719d04875f 100644
--- a/engines/avalanche/gyro2.h
+++ b/engines/avalanche/gyro2.h
@@ -224,10 +224,15 @@ struct quasiped_type {
typedef byte tunetype[31];
+
+struct PointType {
+ int16 x, y;
+};
+
struct vmctype { /* Virtual Mouse Cursor */
void *andpic, *xorpic;
void *backpic[2];
- void* wherewas[2];
+ PointType wherewas[2];
byte picnumber;
int8 ofsx, ofsy;
};
@@ -607,6 +612,8 @@ public:
Gyro();
+ ~Gyro();
+
void setParent(AvalancheEngine *vm);
void newpointer(byte m);