aboutsummaryrefslogtreecommitdiff
path: root/engines/cryo
diff options
context:
space:
mode:
authorStrangerke2016-09-29 07:43:13 +0200
committerEugene Sandulenko2017-01-25 22:41:56 +0100
commit2e8b3e9462a89ef81d4a3a7e19db4d5482ebe1d8 (patch)
treee675c156bdb5bfc920bb2fceb1a9361c628fa4a8 /engines/cryo
parent6c6eff6c400e0a33a3d664e406ce4e7e2790c0c7 (diff)
downloadscummvm-rg350-2e8b3e9462a89ef81d4a3a7e19db4d5482ebe1d8.tar.gz
scummvm-rg350-2e8b3e9462a89ef81d4a3a7e19db4d5482ebe1d8.tar.bz2
scummvm-rg350-2e8b3e9462a89ef81d4a3a7e19db4d5482ebe1d8.zip
CRYO: Renaming, replace rect_t by Common::Rect
Diffstat (limited to 'engines/cryo')
-rw-r--r--engines/cryo/clhnm.cpp50
-rw-r--r--engines/cryo/cryo.cpp2
-rw-r--r--engines/cryo/cryo.h2
-rw-r--r--engines/cryo/cryolib.cpp121
-rw-r--r--engines/cryo/cryolib.h100
-rw-r--r--engines/cryo/eden.cpp450
-rw-r--r--engines/cryo/eden.h20
7 files changed, 372 insertions, 373 deletions
diff --git a/engines/cryo/clhnm.cpp b/engines/cryo/clhnm.cpp
index 6471748f61..a2915bf4dc 100644
--- a/engines/cryo/clhnm.cpp
+++ b/engines/cryo/clhnm.cpp
@@ -314,13 +314,13 @@ void CLHNM_SetFinalBuffer(hnm_t *hnm, byte *buffer) {
void CLHNM_AllocMemory(hnm_t *hnm) {
CLBeginCheck;
- hnm->work_buffer[0] = (byte *)CLMemory_Alloc(hnm->header.buffersize + 2);
+ hnm->work_buffer[0] = (byte *)CLMemory_Alloc(hnm->_header._bufferSize + 2);
CLCheckError();
if (!hnm->work_buffer[0])
goto fin;
- hnm->work_buffer[1] = (byte *)CLMemory_Alloc(hnm->header.buffersize + 2);
+ hnm->work_buffer[1] = (byte *)CLMemory_Alloc(hnm->_header._bufferSize + 2);
CLCheckError();
if (!hnm->work_buffer[1]) {
@@ -331,7 +331,7 @@ void CLHNM_AllocMemory(hnm_t *hnm) {
}
if (!use_preload) {
- hnm->read_buffer = (byte *)CLMemory_Alloc(hnm->header.buffersize + 2);
+ hnm->read_buffer = (byte *)CLMemory_Alloc(hnm->_header._bufferSize + 2);
// CLCheckError();
if (!hnm->read_buffer) {
CLMemory_Free(hnm->work_buffer[0]);
@@ -461,9 +461,9 @@ void CLHNM_ChangePalette(hnm_t *hnm) {
}
void CLHNM_Desentrelace(hnm_t *hnm) {
- switch (hnm->header.width) {
+ switch (hnm->_header._width) {
case 320:
- CLHNM_Desentrelace320(hnm->new_frame_buffer, hnm->final_buffer, hnm->header.height);
+ CLHNM_Desentrelace320(hnm->new_frame_buffer, hnm->final_buffer, hnm->_header._height);
CLNoError;
break;
// case 480:
@@ -525,7 +525,7 @@ int16 CLHNM_LoadFrame(hnm_t *hnm) {
if (use_preload) {
} else {
- if (chunk - 4 > hnm->header.buffersize) {
+ if (chunk - 4 > hnm->_header._bufferSize) {
__libError = -3;
__osError = 0;
CLCheckError();
@@ -586,7 +586,7 @@ bool CLHNM_NextElement(hnm_t *hnm) {
CLHNM_ResetInternalTimer();
pred_l = pred_r = 0;
}
- if (hnm->frame == hnm->header.nframe)
+ if (hnm->frame == hnm->_header._numbFrame)
return false;
if (!CLHNM_LoadFrame(hnm))
return false;
@@ -609,13 +609,13 @@ bool CLHNM_NextElement(hnm_t *hnm) {
hnm->frame++;
CLHNM_SelectBuffers(hnm);
CLHNM_DecompLempelZiv(hnm->data_ptr + 4, hnm->new_frame_buffer);
- switch (hnm->header.width) {
+ switch (hnm->_header._width) {
// case 320: CLBlitter_RawCopy320ASM(hnm->new_frame_buffer, hnm->old_frame_buffer, hnm->header.height); break;
// case 480: CLBlitter_RawCopy480ASM(hnm->new_frame_buffer, hnm->old_frame_buffer, hnm->header.height); break;
// case 640: CLBlitter_RawCopy640ASM(hnm->new_frame_buffer, hnm->old_frame_buffer, hnm->header.height); break;
// default: memcpy(hnm->old_frame_buffer, hnm->new_frame_buffer, hnm->header.width * hnm->header.height);
default:
- memcpy(hnm->old_frame_buffer, hnm->new_frame_buffer, hnm->header.buffersize); //TODO strange buffer size here
+ memcpy(hnm->old_frame_buffer, hnm->new_frame_buffer, hnm->_header._bufferSize); //TODO strange buffer size here
}
if (!(h6 & 1))
CLHNM_Desentrelace(hnm);
@@ -623,7 +623,7 @@ bool CLHNM_NextElement(hnm_t *hnm) {
// if(hnm->header.width == 640)
// CLBlitter_RawCopy640(hnm->new_frame_buffer, hnm->final_buffer, hnm->header.height);
// else
- memcpy(hnm->final_buffer, hnm->new_frame_buffer, hnm->header.height); //TODO: wrong size?
+ memcpy(hnm->final_buffer, hnm->new_frame_buffer, hnm->_header._height); //TODO: wrong size?
}
if (use_adpcm) {
if (!sound_started) {
@@ -640,14 +640,14 @@ bool CLHNM_NextElement(hnm_t *hnm) {
case BE16('IU'):
hnm->frame++;
CLHNM_SelectBuffers(hnm);
- CLHNM_DecompUBA(hnm->new_frame_buffer, hnm->new_frame_buffer, hnm->old_frame_buffer, hnm->data_ptr, hnm->header.width, h6);
+ CLHNM_DecompUBA(hnm->new_frame_buffer, hnm->new_frame_buffer, hnm->old_frame_buffer, hnm->data_ptr, hnm->_header._width, h6);
if (!(h6 & 1))
CLHNM_Desentrelace(hnm);
else {
// if(hnm->header.width == 640)
// CLBlitter_RawCopy640(hnm->new_frame_buffer, hnm->final_buffer, hnm->header.height);
// else
- memcpy(hnm->final_buffer, hnm->new_frame_buffer, hnm->header.width * hnm->header.height);
+ memcpy(hnm->final_buffer, hnm->new_frame_buffer, hnm->_header._width * hnm->_header._height);
}
goto end_frame;
case BE16('sd'):
@@ -700,27 +700,27 @@ end_frame:
void CLHNM_ReadHeader(hnm_t *hnm) {
CLBeginCheck;
if (!use_preload) {
- long size = sizeof(hnm->header);
- CLFile_Read(*hnm->file, &hnm->header, &size);
+ long size = sizeof(hnm->_header);
+ CLFile_Read(*hnm->file, &hnm->_header, &size);
} else
;
CLCheckError();
CLEndCheck;
- hnm->header.width = LE16(hnm->header.width);
- hnm->header.height = LE16(hnm->header.height);
- hnm->header.filesize = LE32(hnm->header.filesize);
- hnm->header.nframe = LE32(hnm->header.nframe);
- hnm->header.table_offset = LE32(hnm->header.table_offset);
- hnm->header.speed = LE16(hnm->header.speed);
- hnm->header.maxbuffer = LE16(hnm->header.maxbuffer);
- hnm->header.buffersize = LE32(hnm->header.buffersize);
- hnm->header.ff_20 = LE16(hnm->header.ff_20);
- hnm->header.buffersize += 4096; //TODO: checkme
+ hnm->_header._width = LE16(hnm->_header._width);
+ hnm->_header._height = LE16(hnm->_header._height);
+ hnm->_header._unusedFileSize = LE32(hnm->_header._unusedFileSize);
+ hnm->_header._numbFrame = LE32(hnm->_header._numbFrame);
+ hnm->_header._unusedTableOffset = LE32(hnm->_header._unusedTableOffset);
+ hnm->_header._unusedSpeed = LE16(hnm->_header._unusedSpeed);
+ hnm->_header._unusedMaxBuffer = LE16(hnm->_header._unusedMaxBuffer);
+ hnm->_header._bufferSize = LE32(hnm->_header._bufferSize);
+ hnm->_header._unusedUnknown = LE16(hnm->_header._unusedUnknown);
+ hnm->_header._bufferSize += 4096; //TODO: checkme
}
int16 CLHNM_GetVersion(hnm_t *hnm) {
CLNoError;
- if (hnm->header.id == BE32('HNM4'))
+ if (hnm->_header._signature == BE32('HNM4'))
return 4;
return -1;
}
diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp
index 7e226f8684..24af6bf107 100644
--- a/engines/cryo/cryo.cpp
+++ b/engines/cryo/cryo.cpp
@@ -95,7 +95,7 @@ Common::Error CryoEngine::run() {
// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
debugC(3, kCryoDebugExample | kCryoDebugExample2, "Example debug call two");
- game.run();
+ _game.run();
return Common::kNoError;
}
diff --git a/engines/cryo/cryo.h b/engines/cryo/cryo.h
index 60386469ed..433ffdd8c9 100644
--- a/engines/cryo/cryo.h
+++ b/engines/cryo/cryo.h
@@ -64,7 +64,7 @@ public:
Common::RandomSource *_rnd;
Graphics::Surface _screen;
- EdenGame game;
+ EdenGame _game;
private:
Console *_console;
diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp
index 62b2d779a3..1a180b1fbf 100644
--- a/engines/cryo/cryolib.cpp
+++ b/engines/cryo/cryolib.cpp
@@ -81,62 +81,63 @@ void CLMemory_Free(void *ptr) {
volatile long TimerTicks = 0; // incremented in realtime
///// CLView
-void CLView_SetSrcZoomValues(view_t *view, int x, int y) {
- view->zoom.src_left = x;
- view->zoom.src_top = y;
+void CLView_SetSrcZoomValues(View *view, int x, int y) {
+ view->_zoom._srcLeft = x;
+ view->_zoom._srcTop = y;
}
-void CLView_SetDisplayZoomValues(view_t *view, int w, int h) {
- view->zoom.width = w;
- view->zoom.height = h;
+void CLView_SetDisplayZoomValues(View *view, int w, int h) {
+ view->_zoom._width = w;
+ view->_zoom._height = h;
}
-void CLView_Free(view_t *view) {
- if (view->p_buffer && view->allocated)
- CLMemory_Free(view->p_buffer);
+void CLView_Free(View *view) {
+ if (view->_bufferPtr && view->_allocated)
+ CLMemory_Free(view->_bufferPtr);
if (view)
CLMemory_Free(view);
}
-void CLView_InitDatas(view_t *view, int w, int h, void *buffer) {
- view->p_buffer = (byte *)buffer;
- view->width = w;
- view->height = h;
- view->pitch = w;
- view->doubled = 0;
- view->norm.src_left = 0;
- view->norm.src_top = 0;
- view->norm.dst_left = 0;
- view->norm.dst_top = 0;
- view->norm.width = w;
- view->norm.height = h;
- view->zoom.src_left = 0;
- view->zoom.src_top = 0;
- view->zoom.dst_left = 0;
- view->zoom.dst_top = 0;
- view->zoom.width = w;
- view->zoom.height = h;
-}
-view_t *CLView_New(int w, int h) {
- view_t *view = (view_t *)CLMemory_Alloc(sizeof(view_t));
+void CLView_InitDatas(View *view, int w, int h, void *buffer) {
+ view->_bufferPtr = (byte *)buffer;
+ view->_width = w;
+ view->_height = h;
+ view->_pitch = w;
+ view->_doubled = false;
+ view->_normal._srcLeft = 0;
+ view->_normal._srcTop = 0;
+ view->_normal._dstLeft = 0;
+ view->_normal._dstTop = 0;
+ view->_normal._width = w;
+ view->_normal._height = h;
+ view->_zoom._srcLeft = 0;
+ view->_zoom._srcTop = 0;
+ view->_zoom._dstLeft = 0;
+ view->_zoom._dstTop = 0;
+ view->_zoom._width = w;
+ view->_zoom._height = h;
+}
+View *CLView_New(int w, int h) {
+ View *view = (View *)CLMemory_Alloc(sizeof(View));
if (view) {
void *buffer = (byte *)CLMemory_Alloc(w * h);
if (buffer) {
- view->allocated = 1;
+ view->_allocated = true;
CLView_InitDatas(view, w, h, buffer);
} else {
+ view->_allocated = false;
CLMemory_Free(view);
view = 0;
}
}
return view;
}
-void CLView_CenterIn(view_t *parent, view_t *child) {
- child->norm.dst_left = (parent->width - child->norm.width) / 2;
- child->norm.dst_top = (parent->height - child->norm.height) / 2;
- child->zoom.dst_left = (parent->width - child->zoom.width) / 2;
- child->zoom.dst_top = (parent->height - child->zoom.height) / 2;
+void CLView_CenterIn(View *parent, View *child) {
+ child->_normal._dstLeft = (parent->_width - child->_normal._width) / 2;
+ child->_normal._dstTop = (parent->_height - child->_normal._height) / 2;
+ child->_zoom._dstLeft = (parent->_width - child->_zoom._width) / 2;
+ child->_zoom._dstTop = (parent->_height - child->_zoom._height) / 2;
}
///// CLScreenView
-view_t ScreenView;
+View ScreenView;
void CLScreenView_Init() {
// ScreenView is the game's target screen (a pc display)
@@ -145,7 +146,7 @@ void CLScreenView_Init() {
CLView_InitDatas(&ScreenView, g_ed->_screen.w, g_ed->_screen.h, g_ed->_screen.getPixels());
}
-void CLScreenView_CenterIn(view_t *view) {
+void CLScreenView_CenterIn(View *view) {
CLView_CenterIn(&ScreenView, view);
}
@@ -222,16 +223,16 @@ static uint16 newPaletteCount, newPaletteFirst;
static color_t *pNewPalette;
static uint16 useNewPalette;
-void CLBlitter_CopyViewRect(view_t *view1, view_t *view2, rect_t *rect1, rect_t *rect2) {
- int sy, dy = rect2->sy, x, w = rect1->ex - rect1->sx + 1;
+void CLBlitter_CopyViewRect(View *view1, View *view2, Common::Rect *rect1, Common::Rect *rect2) {
+ int sy, dy = rect2->top, x, w = rect1->right - rect1->left + 1;
// debug("- Copy rect %3d:%3d-%3d:%3d -> %3d:%3d-%3d:%3d - %s",
// rect1->sx, rect1->sy, rect1->ex, rect1->ey,
// rect2->sx, rect2->sy, rect2->ex, rect2->ey,
// (rect1->ex - rect1->sx == rect2->ex - rect2->sx && rect1->ey - rect1->sy == rect2->ey - rect2->sy) ? "ok" : "BAD");
- assert(rect1->ex - rect1->sx == rect2->ex - rect2->sx && rect1->ey - rect1->sy == rect2->ey - rect2->sy);
- for (sy = rect1->sy; sy <= rect1->ey; sy++, dy++) {
- byte *s = view1->p_buffer + sy * view1->pitch + rect1->sx;
- byte *d = view2->p_buffer + dy * view2->pitch + rect2->sx;
+ assert(rect1->right - rect1->left == rect2->right - rect2->left && rect1->bottom - rect1->top == rect2->bottom - rect2->top);
+ for (sy = rect1->top; sy <= rect1->bottom; sy++, dy++) {
+ byte *s = view1->_bufferPtr + sy * view1->_pitch + rect1->left;
+ byte *d = view2->_bufferPtr + dy * view2->_pitch + rect2->left;
for (x = 0; x < w; x++)
*d++ = *s++;
}
@@ -254,24 +255,24 @@ void CLBlitter_CopyView2ViewSimpleSize(byte *src, int16 srcw, int16 srcp, int16
dst += dstp - dstw;
}
}
-void CLBlitter_CopyView2ScreenCUSTOM(view_t *view) {
- view_t *dest = &ScreenView;
- if (!view->doubled) {
- int16 srcpitch = view->pitch;
- int16 dstpitch = dest->pitch;
+void CLBlitter_CopyView2ScreenCUSTOM(View *view) {
+ View *dest = &ScreenView;
+ if (!view->_doubled) {
+ int16 srcpitch = view->_pitch;
+ int16 dstpitch = dest->_pitch;
// this is not quite correct?
- // CLBlitter_CopyView2ViewSimpleSize(view->p_buffer + view->norm.src_top * srcpitch + view->norm.src_left, view->norm.width, srcpitch, view->norm.height,
- // dest->p_buffer + dest->norm.dst_top * dstpitch + dest->norm.dst_left, dest->norm.width, dstpitch, dest->norm.height);
+ // CLBlitter_CopyView2ViewSimpleSize(view->_bufferPtr + view->_normal.src_top * srcpitch + view->_normal._srcLeft, view->_normal._width, srcpitch, view->_normal._height,
+ // dest->_bufferPtr + dest->_normal._dstTop * dstpitch + dest->_normal._dstLeft, dest->_normal._width, dstpitch, dest->_normal._height);
- CLBlitter_CopyView2ViewSimpleSize(view->p_buffer + view->norm.src_top * srcpitch + view->norm.src_left, view->norm.width, srcpitch, view->norm.height,
- dest->p_buffer + (dest->norm.dst_top + view->norm.dst_top) * dstpitch + dest->norm.dst_left + view->norm.dst_left, dest->norm.width, dstpitch, dest->norm.height);
+ CLBlitter_CopyView2ViewSimpleSize(view->_bufferPtr + view->_normal._srcTop * srcpitch + view->_normal._srcLeft, view->_normal._width, srcpitch, view->_normal._height,
+ dest->_bufferPtr + (dest->_normal._dstTop + view->_normal._dstTop) * dstpitch + dest->_normal._dstLeft + view->_normal._dstLeft, dest->_normal._width, dstpitch, dest->_normal._height);
} else {
assert(0);
}
}
-void CLBlitter_CopyView2Screen(view_t *view) {
+void CLBlitter_CopyView2Screen(View *view) {
if (useNewPalette) {
color_t palette[256];
@@ -284,20 +285,20 @@ void CLBlitter_CopyView2Screen(view_t *view) {
if (view)
CLBlitter_CopyView2ScreenCUSTOM(view);
- g_system->copyRectToScreen(ScreenView.p_buffer, ScreenView.pitch, 0, 0, ScreenView.width, ScreenView.height);
+ g_system->copyRectToScreen(ScreenView._bufferPtr, ScreenView._pitch, 0, 0, ScreenView._width, ScreenView._height);
g_system->updateScreen();
}
void CLBlitter_UpdateScreen() {
CLBlitter_CopyView2Screen(nullptr);
}
-void CLBlitter_FillView(view_t *view, unsigned int fill) {
+void CLBlitter_FillView(View *view, unsigned int fill) {
int16 x, y;
- byte *d = view->p_buffer;
+ byte *d = view->_bufferPtr;
assert((fill & 0xFF) * 0x01010101 == fill);
- for (y = 0; y < view->height; y++) {
- for (x = 0; x < view->width; x++)
+ for (y = 0; y < view->_height; y++) {
+ for (x = 0; x < view->_width; x++)
*d++ = fill;
- d += view->pitch - view->width;
+ d += view->_pitch - view->_width;
}
}
void CLBlitter_FillScreenView(unsigned int fill) {
diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h
index 5f07f4107d..75146bb478 100644
--- a/engines/cryo/cryolib.h
+++ b/engines/cryo/cryolib.h
@@ -24,6 +24,7 @@
#define CRYO_CRYOLIB_H
#include "audio/mixer.h"
+#include "common/system.h"
#include "cryo/platdefs.h"
@@ -73,28 +74,25 @@ extern int16 __debug, __libError, __osError;
DebugStr(c2pstr(buffer_)); \
};
-struct rect_t {
- int sy, sx, ey, ex;
+struct BlitView{
+ int _srcLeft;
+ int _srcTop;
+ int _dstLeft;
+ int _dstTop;
+ int _width;
+ int _height;
};
-typedef struct rect_t rect_t;
-
-struct view_t {
- byte *p_buffer;
- int width;
- int height;
- int16 pitch;
- int16 doubled;
- int16 allocated;
- struct {
- int src_left;
- int src_top;
- int dst_left;
- int dst_top;
- int width;
- int height;
- } norm, zoom;
+
+struct View {
+ byte *_bufferPtr;
+ int _width;
+ int _height;
+ int16 _pitch;
+ bool _doubled;
+ bool _allocated;
+ BlitView _normal;
+ BlitView _zoom;
};
-typedef struct view_t view_t;
struct color3_t {
int16 r, g, b;
@@ -112,32 +110,32 @@ struct palette_t {
typedef struct palette_t palette_t;
#pragma pack(push, 1)
-struct hnmheader_t {
- int id;
- char flag1;
- char flag2;
- char reseverd;
- char bpp;
- uint16 width;
- uint16 height;
- int filesize;
- int nframe;
- int table_offset;
- int16 speed;
- int16 maxbuffer;
- int buffersize;
- int16 ff_20;
- char reserved2[14];
- char copyright[16];
+struct HNMHeader {
+ int _signature;
+ char _unusedFlag1;
+ char _unusedFlag2;
+ char _unusedReserved;
+ char _unusedBpp;
+ uint16 _width;
+ uint16 _height;
+ int _unusedFileSize;
+ int _numbFrame;
+ int _unusedTableOffset;
+ int16 _unusedSpeed;
+ int16 _unusedMaxBuffer;
+ int _bufferSize;
+ int16 _unusedUnknown;
+ char _unusedReserved2[14];
+ char _unusedCopyright[16];
};
-typedef struct hnmheader_t hnmheader_t;
+typedef struct HNMHeader HNMHeader;
#pragma pack(pop)
struct hnm_t {
int frame;
int ff_4;
file_t *file;
- hnmheader_t header;
+ HNMHeader _header;
byte *work_buffer[2];
byte *final_buffer;
byte *new_frame_buffer;
@@ -208,7 +206,7 @@ struct soundchannel_t {
typedef struct soundchannel_t soundchannel_t;
extern volatile long TimerTicks;
-extern view_t ScreenView;
+extern View ScreenView;
soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode);
@@ -232,15 +230,15 @@ void SysBeep(int x);
long TickCount();
void FlushEvents(int16 arg1, int16 arg2);
-void CLBlitter_CopyViewRect(view_t *view1, view_t *view2, rect_t *rect1, rect_t *rect2);
+void CLBlitter_CopyViewRect(View *view1, View *view2, Common::Rect *rect1, Common::Rect *rect2);
void CLBlitter_Send2ScreenNextCopy(color_t *palette, uint16 first, uint16 count);
void CLBlitter_OneBlackFlash();
void CLBlitter_CopyView2ViewSimpleSize(byte *src, int16 srcw, int16 srcp, int16 srch,
byte *dst, int16 dstw, int16 dstp, int16 dsth);
-void CLBlitter_CopyView2ScreenCUSTOM(view_t *view);
-void CLBlitter_CopyView2Screen(view_t *view);
+void CLBlitter_CopyView2ScreenCUSTOM(View *view);
+void CLBlitter_CopyView2Screen(View *view);
void CLBlitter_UpdateScreen();
-void CLBlitter_FillView(view_t *view, unsigned int fill);
+void CLBlitter_FillView(View *view, unsigned int fill);
void CLBlitter_FillScreenView(unsigned int fill);
void CLPalette_Init();
@@ -289,15 +287,15 @@ void CLMouse_GetPosition(int16 *x, int16 *y);
void CLMouse_SetPosition(int16 x, int16 y);
uint16 CLMouse_IsDown();
-void CLView_SetSrcZoomValues(view_t *view, int x, int y);
-void CLView_SetDisplayZoomValues(view_t *view, int w, int h);
-void CLView_Free(view_t *view);
-void CLView_InitDatas(view_t *view, int w, int h, void *buffer);
-view_t *CLView_New(int w, int h);
-void CLView_CenterIn(view_t *parent, view_t *child);
+void CLView_SetSrcZoomValues(View *view, int x, int y);
+void CLView_SetDisplayZoomValues(View *view, int w, int h);
+void CLView_Free(View *view);
+void CLView_InitDatas(View *view, int w, int h, void *buffer);
+View *CLView_New(int w, int h);
+void CLView_CenterIn(View *parent, View *child);
void CLScreenView_Init();
-void CLScreenView_CenterIn(view_t *view);
+void CLScreenView_CenterIn(View *view);
void CRYOLib_InstallExitPatch();
void CRYOLib_RemoveExitPatch();
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 32b71d86f5..844748e04a 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -63,16 +63,16 @@ void EdenGame::removeConsole() {
void EdenGame::scroll() {
restoreFriezes();
- p_mainview->norm.src_left = scroll_pos;
- p_mainview->zoom.src_left = scroll_pos;
+ p_mainview->_normal._srcLeft = scroll_pos;
+ p_mainview->_zoom._srcLeft = scroll_pos;
}
void EdenGame::resetScroll() {
old_scroll_pos = scroll_pos;
scroll_pos = 0;
restoreFriezes(); //TODO: inlined scroll() ?
- p_mainview->norm.src_left = 0;
- p_mainview->zoom.src_left = 0;
+ p_mainview->_normal._srcLeft = 0;
+ p_mainview->_zoom._srcLeft = 0;
}
void EdenGame::scrollFrescoes() {
@@ -892,21 +892,21 @@ void EdenGame::saveFriezes() {
// Original name: sauvefriseshaut
void EdenGame::saveTopFrieze(int16 x) { // Save top bar
- underTopBarScreenRect.sy = 0; //TODO: wrong fields order?
- underTopBarScreenRect.sx = x;
- underTopBarScreenRect.ex = x + 320 - 1;
- underTopBarScreenRect.ey = 15;
- underTopBarBackupRect.sy = 0;
- underTopBarBackupRect.sx = 0;
- underTopBarBackupRect.ex = 320 - 1;
- underTopBarBackupRect.ey = 15;
+ underTopBarScreenRect.top = 0; //TODO: wrong fields order?
+ underTopBarScreenRect.left = x;
+ underTopBarScreenRect.right = x + 320 - 1;
+ underTopBarScreenRect.bottom = 15;
+ underTopBarBackupRect.top = 0;
+ underTopBarBackupRect.left = 0;
+ underTopBarBackupRect.right = 320 - 1;
+ underTopBarBackupRect.bottom = 15;
CLBlitter_CopyViewRect(p_mainview, p_underBarsView, &underTopBarScreenRect, &underTopBarBackupRect);
}
// Original name: sauvefrisesbas
void EdenGame::saveBottomFrieze() { // Save bottom bar
- underBottomBarScreenRect.sx = 0;
- underBottomBarScreenRect.ex = 320 - 1;
+ underBottomBarScreenRect.left = 0;
+ underBottomBarScreenRect.right = 320 - 1;
CLBlitter_CopyViewRect(p_mainview, p_underBarsView, &underBottomBarScreenRect, &underBottomBarBackupRect);
}
@@ -918,15 +918,15 @@ void EdenGame::restoreFriezes() {
// Original name: restaurefriseshaut
void EdenGame::restoreTopFrieze() {
- underTopBarScreenRect.sx = scroll_pos;
- underTopBarScreenRect.ex = scroll_pos + 320 - 1;
+ underTopBarScreenRect.left = scroll_pos;
+ underTopBarScreenRect.right = scroll_pos + 320 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underTopBarBackupRect, &underTopBarScreenRect);
}
// Original name: restaurefrisesbas
void EdenGame::restoreBottomFrieze() {
- underBottomBarScreenRect.sx = scroll_pos;
- underBottomBarScreenRect.ex = scroll_pos + 320 - 1;
+ underBottomBarScreenRect.left = scroll_pos;
+ underBottomBarScreenRect.right = scroll_pos + 320 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underBottomBarBackupRect, &underBottomBarScreenRect);
}
@@ -1332,26 +1332,26 @@ void EdenGame::bars_out() {
if (showBlackBars)
return;
afficher();
- underTopBarScreenRect.sx = scroll_pos;
- underTopBarScreenRect.ex = scroll_pos + 320 - 1;
+ underTopBarScreenRect.left = scroll_pos;
+ underTopBarScreenRect.right = scroll_pos + 320 - 1;
CLBlitter_CopyViewRect(p_mainview, p_underBarsView, &underTopBarScreenRect, &underTopBarBackupRect);
- underBottomBarScreenRect.sx = underTopBarScreenRect.sx;
- underBottomBarScreenRect.ex = underTopBarScreenRect.ex;
+ underBottomBarScreenRect.left = underTopBarScreenRect.left;
+ underBottomBarScreenRect.right = underTopBarScreenRect.right;
CLBlitter_CopyViewRect(p_mainview, p_underBarsView, &underBottomBarScreenRect, &underBottomBarBackupRect);
int16 r19 = 14; // TODO - init in decl?
int16 r20 = 176;
int16 r25 = 14;
int16 r24 = 21;
- underTopBarScreenRect.sx = 0;
- underTopBarScreenRect.ex = 320 - 1;
- underTopBarBackupRect.sx = scroll_pos;
- underTopBarBackupRect.ex = scroll_pos + 320 - 1;
+ underTopBarScreenRect.left = 0;
+ underTopBarScreenRect.right = 320 - 1;
+ underTopBarBackupRect.left = scroll_pos;
+ underTopBarBackupRect.right = scroll_pos + 320 - 1;
while (r24 > 0) {
if (r25 > 0) {
- underTopBarScreenRect.sy = 16 - r25;
- underTopBarScreenRect.ey = 16 - 1;
- underTopBarBackupRect.sy = 0;
- underTopBarBackupRect.ey = r25 - 1;
+ underTopBarScreenRect.top = 16 - r25;
+ underTopBarScreenRect.bottom = 16 - 1;
+ underTopBarBackupRect.top = 0;
+ underTopBarBackupRect.bottom = r25 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underTopBarScreenRect, &underTopBarBackupRect);
scr40 = ((unsigned int *)p_mainview_buf) + r19 * 640 / 4;
scr41 = scr40 + 640 / 4;
@@ -1360,10 +1360,10 @@ void EdenGame::bars_out() {
*scr41++ = 0;
}
}
- underTopBarScreenRect.sy = 16;
- underTopBarScreenRect.ey = r24 + 16 - 1;
- underTopBarBackupRect.sy = 200 - r24;
- underTopBarBackupRect.ey = 200 - 1;
+ underTopBarScreenRect.top = 16;
+ underTopBarScreenRect.bottom = r24 + 16 - 1;
+ underTopBarBackupRect.top = 200 - r24;
+ underTopBarBackupRect.bottom = 200 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underTopBarScreenRect, &underTopBarBackupRect);
scr40 = ((unsigned int *)p_mainview_buf) + r20 * 640 / 4;
scr41 = scr40 + 640 / 4;
@@ -1406,22 +1406,22 @@ void EdenGame::showBars() {
drawBlackBars();
int16 r29 = 2;
int16 r28 = 2;
- underTopBarScreenRect.sx = 0;
- underTopBarScreenRect.ex = 320 - 1;
- underTopBarBackupRect.sx = scroll_pos;
- underTopBarBackupRect.ex = scroll_pos + 320 - 1;
+ underTopBarScreenRect.left = 0;
+ underTopBarScreenRect.right = 320 - 1;
+ underTopBarBackupRect.left = scroll_pos;
+ underTopBarBackupRect.right = scroll_pos + 320 - 1;
while (r28 < 24) {
if (r29 <= 16) {
- underTopBarScreenRect.sy = 16 - r29;
- underTopBarScreenRect.ey = 16 - 1;
- underTopBarBackupRect.sy = 0;
- underTopBarBackupRect.ey = r29 - 1;
+ underTopBarScreenRect.top = 16 - r29;
+ underTopBarScreenRect.bottom = 16 - 1;
+ underTopBarBackupRect.top = 0;
+ underTopBarBackupRect.bottom = r29 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underTopBarScreenRect, &underTopBarBackupRect);
}
- underTopBarScreenRect.sy = 16;
- underTopBarScreenRect.ey = 16 + r28;
- underTopBarBackupRect.sy = 200 - 1 - r28;
- underTopBarBackupRect.ey = 200 - 1;
+ underTopBarScreenRect.top = 16;
+ underTopBarScreenRect.bottom = 16 + r28;
+ underTopBarBackupRect.top = 200 - 1 - r28;
+ underTopBarBackupRect.bottom = 200 - 1;
CLBlitter_CopyViewRect(p_underBarsView, p_mainview, &underTopBarScreenRect, &underTopBarBackupRect);
r29 += 2;
r28 += 3;
@@ -1432,27 +1432,27 @@ void EdenGame::showBars() {
}
void EdenGame::sauvefondbouche() {
- rect_src.sx = cur_perso_rect->sx;
- rect_src.sy = cur_perso_rect->sy;
- rect_src.ex = cur_perso_rect->ex;
- rect_src.ey = cur_perso_rect->ey;
- rect_dst.sx = cur_perso_rect->sx + 320;
- rect_dst.sy = cur_perso_rect->sy;
- rect_dst.ex = cur_perso_rect->ex + 320;
- rect_dst.ey = cur_perso_rect->ey;
+ rect_src.left = cur_perso_rect->sx;
+ rect_src.top = cur_perso_rect->sy;
+ rect_src.right = cur_perso_rect->ex;
+ rect_src.bottom = cur_perso_rect->ey;
+ rect_dst.left = cur_perso_rect->sx + 320;
+ rect_dst.top = cur_perso_rect->sy;
+ rect_dst.right = cur_perso_rect->ex + 320;
+ rect_dst.bottom = cur_perso_rect->ey;
CLBlitter_CopyViewRect(p_mainview, p_mainview, &rect_src, &rect_dst);
fond_saved = 1;
}
void EdenGame::restaurefondbouche() {
- rect_src.sx = cur_perso_rect->sx;
- rect_src.sy = cur_perso_rect->sy;
- rect_src.ex = cur_perso_rect->ex;
- rect_src.ey = cur_perso_rect->ey;
- rect_dst.sx = cur_perso_rect->sx + 320;
- rect_dst.sy = cur_perso_rect->sy;
- rect_dst.ex = cur_perso_rect->ex + 320;
- rect_dst.ey = cur_perso_rect->ey;
+ rect_src.left = cur_perso_rect->sx;
+ rect_src.top = cur_perso_rect->sy;
+ rect_src.right = cur_perso_rect->ex;
+ rect_src.bottom = cur_perso_rect->ey;
+ rect_dst.left = cur_perso_rect->sx + 320;
+ rect_dst.top = cur_perso_rect->sy;
+ rect_dst.right = cur_perso_rect->ex + 320;
+ rect_dst.bottom = cur_perso_rect->ey;
CLBlitter_CopyViewRect(p_mainview, p_mainview, &rect_dst, &rect_src);
}
@@ -1523,8 +1523,8 @@ void EdenGame::displayAdamMapMark(int16 location) {
x += (location & 15) * 4;
y += ((location - 16) >> 4) * 3;
saveAdamMapMark(x, y);
- byte *pix = p_underBarsView->p_buffer;
- int16 w = p_underBarsView->width;
+ byte *pix = p_underBarsView->_bufferPtr;
+ int16 w = p_underBarsView->_width;
pix += x + w * y;
pix[1] = 0xC3;
pix[2] = 0xC3;
@@ -1546,8 +1546,8 @@ void EdenGame::restoreAdamMapMark() {
int16 x = saved_repadam.x;
int16 y = saved_repadam.y;
- byte *pix = p_underBarsView->p_buffer;
- int16 w = p_underBarsView->width;
+ byte *pix = p_underBarsView->_bufferPtr;
+ int16 w = p_underBarsView->_width;
pix += x + w * y;
pix[1] = keep01; //TODO keep is array?
pix[2] = keep02;
@@ -1565,8 +1565,8 @@ void EdenGame::restoreAdamMapMark() {
void EdenGame::saveAdamMapMark(int16 x, int16 y) {
saved_repadam.x = x;
saved_repadam.y = y;
- byte *pix = p_underBarsView->p_buffer;
- int16 w = p_underBarsView->width;
+ byte *pix = p_underBarsView->_bufferPtr;
+ int16 w = p_underBarsView->_width;
pix += x + w * y;
keep01 = pix[1];
keep02 = pix[2];
@@ -2927,12 +2927,12 @@ void EdenGame::af_subtitle() {
}
void EdenGame::sauvefondbulle(int16 y) {
- underSubtitlesScreenRect.sy = y - num_text_lines * FONT_HEIGHT;
- underSubtitlesScreenRect.sx = scroll_pos + subtitles_x_scr_margin;
- underSubtitlesScreenRect.ex = scroll_pos + subtitles_x_scr_margin + subtitles_x_width - 1;
- underSubtitlesScreenRect.ey = y;
- underSubtitlesBackupRect.sy = 0;
- underSubtitlesBackupRect.ey = num_text_lines * FONT_HEIGHT;
+ underSubtitlesScreenRect.top = y - num_text_lines * FONT_HEIGHT;
+ underSubtitlesScreenRect.left = scroll_pos + subtitles_x_scr_margin;
+ underSubtitlesScreenRect.right = scroll_pos + subtitles_x_scr_margin + subtitles_x_width - 1;
+ underSubtitlesScreenRect.bottom = y;
+ underSubtitlesBackupRect.top = 0;
+ underSubtitlesBackupRect.bottom = num_text_lines * FONT_HEIGHT;
CLBlitter_CopyViewRect(p_mainview, p_underSubtitlesView, &underSubtitlesScreenRect, &underSubtitlesBackupRect);
savedUnderSubtitles = 1;
}
@@ -3984,9 +3984,9 @@ void EdenGame::effet1() {
rectanglenoir32();
if (!doubled) {
setRS1(0, 0, 16 - 1, 4 - 1);
- y = p_mainview->norm.dst_top;
+ y = p_mainview->_normal._dstTop;
for (i = 16; i <= 96; i += 4) {
- for (x = p_mainview->norm.dst_left; x < p_mainview->norm.dst_left + 320; x += 16) {
+ for (x = p_mainview->_normal._dstLeft; x < p_mainview->_normal._dstLeft + 320; x += 16) {
setRD1(x, y + i, x + 16 - 1, y + i + 4 - 1);
CLBlitter_CopyViewRect(p_view2, &ScreenView, &rect_src, &rect_dst);
setRD1(x, y + 192 - i, x + 16 - 1, y + 192 - i + 4 - 1);
@@ -3997,9 +3997,9 @@ void EdenGame::effet1() {
}
} else {
setRS1(0, 0, 16 * 2 - 1, 4 * 2 - 1);
- y = p_mainview->zoom.dst_top;
+ y = p_mainview->_zoom._dstTop;
for (i = 16 * 2; i <= 96 * 2; i += 4 * 2) {
- for (x = p_mainview->zoom.dst_left; x < p_mainview->zoom.dst_left + 320 * 2; x += 16 * 2) {
+ for (x = p_mainview->_zoom._dstLeft; x < p_mainview->_zoom._dstLeft + 320 * 2; x += 16 * 2) {
setRD1(x, y + i, x + 16 * 2 - 1, y + i + 4 * 2 - 1);
CLBlitter_CopyViewRect(p_view2, &ScreenView, &rect_src, &rect_dst);
setRD1(x, y + 192 * 2 - i, x + 16 * 2 - 1, y + 192 * 2 - i + 4 * 2 - 1);
@@ -4009,30 +4009,30 @@ void EdenGame::effet1() {
}
}
CLPalette_Send2Screen(global_palette, 0, 256);
- p_mainview->norm.height = 2;
- p_mainview->zoom.height = 4;
- ny = p_mainview->norm.dst_top;
- dy = p_mainview->zoom.dst_top;
+ p_mainview->_normal._height = 2;
+ p_mainview->_zoom._height = 4;
+ ny = p_mainview->_normal._dstTop;
+ dy = p_mainview->_zoom._dstTop;
for (i = 0; i < 100; i += 2) {
- p_mainview->norm.src_top = 99 - i;
- p_mainview->zoom.src_top = 99 - i;
- p_mainview->norm.dst_top = 99 - i + ny;
- p_mainview->zoom.dst_top = (99 - i) * 2 + dy;
+ p_mainview->_normal._srcTop = 99 - i;
+ p_mainview->_zoom._srcTop = 99 - i;
+ p_mainview->_normal._dstTop = 99 - i + ny;
+ p_mainview->_zoom._dstTop = (99 - i) * 2 + dy;
CLBlitter_CopyView2Screen(p_mainview);
- p_mainview->norm.src_top = 100 + i;
- p_mainview->zoom.src_top = 100 + i;
- p_mainview->norm.dst_top = 100 + i + ny;
- p_mainview->zoom.dst_top = (100 + i) * 2 + dy;
+ p_mainview->_normal._srcTop = 100 + i;
+ p_mainview->_zoom._srcTop = 100 + i;
+ p_mainview->_normal._dstTop = 100 + i + ny;
+ p_mainview->_zoom._dstTop = (100 + i) * 2 + dy;
CLBlitter_CopyView2Screen(p_mainview);
CLBlitter_UpdateScreen();
wait(1);
}
- p_mainview->norm.height = 200;
- p_mainview->zoom.height = 400;
- p_mainview->norm.src_top = 0;
- p_mainview->zoom.src_top = 0;
- p_mainview->norm.dst_top = ny;
- p_mainview->zoom.dst_top = dy;
+ p_mainview->_normal._height = 200;
+ p_mainview->_zoom._height = 400;
+ p_mainview->_normal._srcTop = 0;
+ p_mainview->_zoom._srcTop = 0;
+ p_mainview->_normal._dstTop = ny;
+ p_mainview->_zoom._dstTop = dy;
p_global->ff_F1 = 0;
}
@@ -4103,16 +4103,16 @@ void EdenGame::effet4() {
int16 w, h, ww;
int16 r17, r23, r16, r18, r19, r22, r27, r31;
CLPalette_Send2Screen(global_palette, 0, 256);
- w = ScreenView.width;
- h = ScreenView.height;
- ww = ScreenView.pitch;
+ w = ScreenView._width;
+ h = ScreenView._height;
+ ww = ScreenView._pitch;
if (!doubled) {
- x = p_mainview->norm.dst_left;
- y = p_mainview->norm.dst_top;
+ x = p_mainview->_normal._dstLeft;
+ y = p_mainview->_normal._dstTop;
for (i = 32; i > 0; i -= 2) {
- scr = ScreenView.p_buffer;
+ scr = ScreenView._bufferPtr;
scr += (y + 16) * ww + x;
- pix = p_mainview->p_buffer + 16 * 640;
+ pix = p_mainview->_bufferPtr + 16 * 640;
r17 = 320 / i;
r23 = 320 - 320 / i * i; //TODO: 320 % i ?
r16 = 160 / i;
@@ -4171,12 +4171,12 @@ void EdenGame::effet4() {
wait(3);
}
} else {
- x = p_mainview->zoom.dst_left;
- y = p_mainview->zoom.dst_top;
+ x = p_mainview->_zoom._dstLeft;
+ y = p_mainview->_zoom._dstTop;
for (i = 32; i > 0; i -= 2) {
- scr = ScreenView.p_buffer;
+ scr = ScreenView._bufferPtr;
scr += (y + 16 * 2) * ww + x;
- pix = p_mainview->p_buffer + 16 * 640;
+ pix = p_mainview->_bufferPtr + 16 * 640;
r17 = 320 / i;
r23 = 320 % i;
r16 = 160 / i;
@@ -4241,13 +4241,13 @@ void EdenGame::ClearScreen() {
byte *scr;
int16 x, y, xx, yy;
int16 w, h, ww;
- w = ScreenView.width;
- h = ScreenView.height;
- ww = ScreenView.pitch;
+ w = ScreenView._width;
+ h = ScreenView._height;
+ ww = ScreenView._pitch;
if (!doubled) {
- x = p_mainview->norm.dst_left;
- y = p_mainview->norm.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_normal._dstLeft;
+ y = p_mainview->_normal._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 16) * ww + x;
for (yy = 0; yy < 160; yy++) {
for (xx = 0; xx < 320; xx++)
@@ -4255,9 +4255,9 @@ void EdenGame::ClearScreen() {
scr += ww - 320;
}
} else {
- x = p_mainview->zoom.dst_left;
- y = p_mainview->zoom.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_zoom._dstLeft;
+ y = p_mainview->_zoom._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 32) * ww + x;
for (yy = 0; yy < 160; yy++) {
for (xx = 0; xx < 320; xx++) {
@@ -4278,13 +4278,13 @@ void EdenGame::colimacon(int16 pattern[16]) {
int16 x, y;
int16 w, h, ww;
int16 i, j, p, r27, r25;
- w = ScreenView.width;
- h = ScreenView.height;
- ww = ScreenView.pitch;
+ w = ScreenView._width;
+ h = ScreenView._height;
+ ww = ScreenView._pitch;
if (!doubled) {
- x = p_mainview->norm.dst_left;
- y = p_mainview->norm.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_normal._dstLeft;
+ y = p_mainview->_normal._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 16) * ww + x;
for (i = 0; i < 16; i++) {
p = pattern[i];
@@ -4295,9 +4295,9 @@ void EdenGame::colimacon(int16 pattern[16]) {
wait(1);
}
} else {
- x = p_mainview->zoom.dst_left;
- y = p_mainview->zoom.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_zoom._dstLeft;
+ y = p_mainview->_zoom._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 16 * 2) * ww + x;
for (i = 0; i < 16; i++) {
p = pattern[i];
@@ -4314,11 +4314,11 @@ void EdenGame::colimacon(int16 pattern[16]) {
}
CLPalette_Send2Screen(global_palette, 0, 256);
if (!doubled) {
- pix = p_mainview->p_buffer;
- x = p_mainview->norm.dst_left;
- y = p_mainview->norm.dst_top;
+ pix = p_mainview->_bufferPtr;
+ x = p_mainview->_normal._dstLeft;
+ y = p_mainview->_normal._dstTop;
pix += 640 * 16;
- scr = ScreenView.p_buffer;
+ scr = ScreenView._bufferPtr;
scr += (y + 16) * ww + x;
for (i = 0; i < 16; i++) {
p = pattern[i];
@@ -4331,11 +4331,11 @@ void EdenGame::colimacon(int16 pattern[16]) {
wait(1);
}
} else {
- pix = p_mainview->p_buffer;
- x = p_mainview->zoom.dst_left;
- y = p_mainview->zoom.dst_top;
+ pix = p_mainview->_bufferPtr;
+ x = p_mainview->_zoom._dstLeft;
+ y = p_mainview->_zoom._dstTop;
pix += 640 * 16;
- scr = ScreenView.p_buffer;
+ scr = ScreenView._bufferPtr;
scr += (y + 16 * 2) * ww + x;
for (i = 0; i < 16; i++) {
p = pattern[i];
@@ -4416,17 +4416,17 @@ void EdenGame::rectanglenoir32() {
}
void EdenGame::setRS1(int16 sx, int16 sy, int16 ex, int16 ey) {
- rect_src.sx = sx;
- rect_src.sy = sy;
- rect_src.ex = ex;
- rect_src.ey = ey;
+ rect_src.left = sx;
+ rect_src.top = sy;
+ rect_src.right = ex;
+ rect_src.bottom = ey;
}
void EdenGame::setRD1(int16 sx, int16 sy, int16 ex, int16 ey) {
- rect_dst.sx = sx;
- rect_dst.sy = sy;
- rect_dst.ex = ex;
- rect_dst.ey = ey;
+ rect_dst.left = sx;
+ rect_dst.top = sy;
+ rect_dst.right = ex;
+ rect_dst.bottom = ey;
}
void EdenGame::wait(int howlong) {
@@ -4445,21 +4445,21 @@ void EdenGame::effetpix() {
int16 r25, r18, r31, r30; //TODO: change to xx/yy
byte r24, r23; //TODO: change to p0/p1
int16 r26, r27, r20;
- w = ScreenView.width;
- h = ScreenView.height;
- ww = ScreenView.pitch;
+ w = ScreenView._width;
+ h = ScreenView._height;
+ ww = ScreenView._pitch;
r25 = ww * 80;
r18 = 640 * 80;
- pix = p_mainview->p_buffer + 16 * 640;
+ pix = p_mainview->_bufferPtr + 16 * 640;
if (!doubled) {
- x = p_mainview->norm.dst_left;
- y = p_mainview->norm.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_normal._dstLeft;
+ y = p_mainview->_normal._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 16) * ww + x;
} else {
- x = p_mainview->zoom.dst_left;
- y = p_mainview->zoom.dst_top;
- scr = ScreenView.p_buffer;
+ x = p_mainview->_zoom._dstLeft;
+ y = p_mainview->_zoom._dstTop;
+ scr = ScreenView._bufferPtr;
scr += (y + 16 * 2) * ww + x;
r25 *= 2;
}
@@ -4542,7 +4542,7 @@ void EdenGame::effetpix() {
}
}
} while (r27 != 1);
- assert(ScreenView.pitch == 320);
+ assert(ScreenView._pitch == 320);
}
////// datfile.c
@@ -4580,8 +4580,8 @@ void EdenGame::openbigfile() {
CLFile_MakeStruct(0, 0, "EDEN.DAT", &bigfilespec);
CLFile_Open(&bigfilespec, 1, h_bigfile);
CLFile_Read(h_bigfile, bigfile_header, &size);
- p_hnmcontext = CLHNM_New(128);
- CLHNM_SetFile(p_hnmcontext, &h_bigfile);
+ _hnmContext = CLHNM_New(128);
+ CLHNM_SetFile(_hnmContext, &h_bigfile);
}
void EdenGame::closebigfile() {
@@ -4604,7 +4604,7 @@ void EdenGame::shnmfl(uint16 num) {
int size = PLE32(&file->size);
int offs = PLE32(&file->offs);
debug("* Loading movie %d (%s) at 0x%X, %d bytes", num, file->name, offs, size);
- CLHNM_SetPosIntoFile(p_hnmcontext, offs);
+ CLHNM_SetPosIntoFile(_hnmContext, offs);
}
int EdenGame::ssndfl(uint16 num) {
@@ -4946,44 +4946,44 @@ void EdenGame::init_globals() {
p_global->persoSpritePtr = 0;
p_global->numGiveObjs = 0;
- rect_31C7A.sy = 0; //TODO: unused?
- rect_31C7A.sx = 0;
- rect_31C7A.ex = 320 - 1;
- rect_31C7A.ey = 200 - 1;
+ rect_31C7A.top = 0; //TODO: unused?
+ rect_31C7A.left = 0;
+ rect_31C7A.right = 320 - 1;
+ rect_31C7A.bottom = 200 - 1;
initrect();
- underSubtitlesScreenRect.sy = 0;
- underSubtitlesScreenRect.sx = subtitles_x_scr_margin;
- underSubtitlesScreenRect.ex = subtitles_x_scr_margin + subtitles_x_width - 1;
- underSubtitlesScreenRect.ey = 176 - 1;
+ underSubtitlesScreenRect.top = 0;
+ underSubtitlesScreenRect.left = subtitles_x_scr_margin;
+ underSubtitlesScreenRect.right = subtitles_x_scr_margin + subtitles_x_width - 1;
+ underSubtitlesScreenRect.bottom = 176 - 1;
- underSubtitlesBackupRect.sy = 0;
- underSubtitlesBackupRect.sx = subtitles_x_scr_margin;
- underSubtitlesBackupRect.ex = subtitles_x_scr_margin + subtitles_x_width - 1;
- underSubtitlesBackupRect.ey = 60 - 1;
+ underSubtitlesBackupRect.top = 0;
+ underSubtitlesBackupRect.left = subtitles_x_scr_margin;
+ underSubtitlesBackupRect.right = subtitles_x_scr_margin + subtitles_x_width - 1;
+ underSubtitlesBackupRect.bottom = 60 - 1;
}
void EdenGame::initrect() {
- underTopBarScreenRect.sy = 0;
- underTopBarScreenRect.sx = 0;
- underTopBarScreenRect.ex = 320 - 1;
- underTopBarScreenRect.ey = 16 - 1;
+ underTopBarScreenRect.top = 0;
+ underTopBarScreenRect.left = 0;
+ underTopBarScreenRect.right = 320 - 1;
+ underTopBarScreenRect.bottom = 16 - 1;
- underTopBarBackupRect.sy = 0;
- underTopBarBackupRect.sx = 0;
- underTopBarBackupRect.ex = 320 - 1;
- underTopBarBackupRect.ey = 16 - 1;
+ underTopBarBackupRect.top = 0;
+ underTopBarBackupRect.left = 0;
+ underTopBarBackupRect.right = 320 - 1;
+ underTopBarBackupRect.bottom = 16 - 1;
- underBottomBarScreenRect.sy = 176;
- underBottomBarScreenRect.sx = 0;
- underBottomBarScreenRect.ex = 320 - 1;
- underBottomBarScreenRect.ey = 200 - 1; //TODO: original bug? this cause crash in copyrect (this, underBottomBarBackupRect)
+ underBottomBarScreenRect.top = 176;
+ underBottomBarScreenRect.left = 0;
+ underBottomBarScreenRect.right = 320 - 1;
+ underBottomBarScreenRect.bottom = 200 - 1; //TODO: original bug? this cause crash in copyrect (this, underBottomBarBackupRect)
- underBottomBarBackupRect.sy = 16;
- underBottomBarBackupRect.sx = 0;
- underBottomBarBackupRect.ex = 320 - 1;
- underBottomBarBackupRect.ey = 40 - 1;
+ underBottomBarBackupRect.top = 16;
+ underBottomBarBackupRect.left = 0;
+ underBottomBarBackupRect.right = 320 - 1;
+ underBottomBarBackupRect.bottom = 40 - 1;
}
void EdenGame::closesalle() {
@@ -5094,7 +5094,7 @@ void EdenGame::afsalle() {
debug("drawroom: room 0x%X using bank %d", p_global->roomNum, p_global->roomImgBank);
use_bank(p_global->roomImgBank);
afsalle1(room);
- assert(ScreenView.pitch == 320);
+ assert(ScreenView._pitch == 320);
}
}
@@ -5302,7 +5302,7 @@ void EdenGame::initlieu(int16 roomNum) {
void EdenGame::maj2() {
char r9, r30;
aflieu();
- assert(ScreenView.pitch == 320);
+ assert(ScreenView._pitch == 320);
if (p_global->roomNum == 273 && p_global->prevLocation == 18)
p_global->ff_102 = 1;
if (p_global->eventType == EventType::etEventC) {
@@ -5310,7 +5310,7 @@ void EdenGame::maj2() {
showObjects();
}
FRDevents();
- assert(ScreenView.pitch == 320);
+ assert(ScreenView._pitch == 320);
r9 = 0;
if (p_global->curAreaType == AreaType::atValley && !(p_global->displayFlags & DisplayFlags::dfPanable))
r9 = 1;
@@ -5396,27 +5396,27 @@ void EdenGame::freebuf() {
void EdenGame::openwindow() {
p_underBarsView = CLView_New(320, 40);
- p_underBarsView->norm.width = 320;
+ p_underBarsView->_normal._width = 320;
p_view2 = CLView_New(32, 32);
- p_view2_buf = p_view2->p_buffer;
+ p_view2_buf = p_view2->_bufferPtr;
p_subtitlesview = CLView_New(subtitles_x_width, 60);
- p_subtitlesview_buf = p_subtitlesview->p_buffer;
+ p_subtitlesview_buf = p_subtitlesview->_bufferPtr;
p_underSubtitlesView = CLView_New(subtitles_x_width, 60);
- p_underSubtitlesView_buf = p_underSubtitlesView->p_buffer;
+ p_underSubtitlesView_buf = p_underSubtitlesView->_bufferPtr;
p_mainview = CLView_New(640, 200);
- p_mainview->norm.width = 320;
+ p_mainview->_normal._width = 320;
CLBlitter_FillView(p_mainview, 0xFFFFFFFF);
CLView_SetSrcZoomValues(p_mainview, 0, 0);
CLView_SetDisplayZoomValues(p_mainview, 640, 400);
CLScreenView_CenterIn(p_mainview);
- p_mainview_buf = p_mainview->p_buffer;
+ p_mainview_buf = p_mainview->_bufferPtr;
- mouse_x_center = p_mainview->norm.dst_left + p_mainview->norm.width / 2;
- mouse_y_center = p_mainview->norm.dst_top + p_mainview->norm.height / 2;
+ mouse_x_center = p_mainview->_normal._dstLeft + p_mainview->_normal._width / 2;
+ mouse_y_center = p_mainview->_normal._dstTop + p_mainview->_normal._height / 2;
CLMouse_SetPosition(mouse_x_center, mouse_y_center);
CLMouse_Hide();
@@ -5461,7 +5461,7 @@ void EdenGame::run() {
if (!bufferAllocationErrorFl) {
LostEdenMac_InitPrefs();
init_cube();
- p_mainview->doubled = doubled;
+ p_mainview->_doubled = doubled;
while (!quit_flag2) {
init_globals();
quit_flag3 = false;
@@ -5568,9 +5568,9 @@ void EdenGame::intro() {
machine_speed = speed;
}
if (machine_speed == 1) {
- doubled = 0;
- p_mainview->doubled = doubled;
- if (ScreenView.width < 640 || ScreenView.height < 400)
+ doubled = false;
+ p_mainview->_doubled = doubled;
+ if (ScreenView._width < 640 || ScreenView._height < 400)
allow_doubled = 0;
}
if (machine_speed < 3)
@@ -5655,7 +5655,7 @@ void EdenGame::FRDevents() {
if (CLKeyboard_IsScanCodeDown(0x30)) { //TODO: const
if (!keybd_held) {
doubled = !doubled;
- p_mainview->doubled = doubled;
+ p_mainview->_doubled = doubled;
CLBlitter_FillScreenView(0);
keybd_held = 1;
}
@@ -6101,46 +6101,46 @@ void EdenGame::mouse() {
////// film.c
// Original name: showfilm
void EdenGame::showMovie(char arg1) {
- CLHNM_Prepare2Read(p_hnmcontext, 0);
- CLHNM_ReadHeader(p_hnmcontext);
+ CLHNM_Prepare2Read(_hnmContext, 0);
+ CLHNM_ReadHeader(_hnmContext);
if (p_global->curVideoNum == 92) {
- p_hnmcontext->header.flag2 = 0;
+ // _hnmContext->_header._unusedFlag2 = 0; CHECKME: Useless?
CLSoundChannel_SetVolumeLeft(hnmsound_ch, 0);
CLSoundChannel_SetVolumeRight(hnmsound_ch, 0);
}
bool playing = true;
- if (CLHNM_GetVersion(p_hnmcontext) != 4)
+ if (CLHNM_GetVersion(_hnmContext) != 4)
return;
- CLHNM_AllocMemory(p_hnmcontext);
- p_hnmview = CLView_New(p_hnmcontext->header.width, p_hnmcontext->header.height);
+ CLHNM_AllocMemory(_hnmContext);
+ p_hnmview = CLView_New(_hnmContext->_header._width, _hnmContext->_header._height);
CLView_SetSrcZoomValues(p_hnmview, 0, 0);
- CLView_SetDisplayZoomValues(p_hnmview, p_hnmcontext->header.width * 2, p_hnmcontext->header.height * 2);
+ CLView_SetDisplayZoomValues(p_hnmview, _hnmContext->_header._width * 2, _hnmContext->_header._height * 2);
CLScreenView_CenterIn(p_hnmview);
- p_hnmview_buf = p_hnmview->p_buffer;
+ p_hnmview_buf = p_hnmview->_bufferPtr;
if (arg1) {
- p_hnmview->norm.height = 160;
- p_hnmview->zoom.height = 320; //TODO: width??
- p_hnmview->norm.dst_top = p_mainview->norm.dst_top + 16;
- p_hnmview->zoom.dst_top = p_mainview->zoom.dst_top + 32;
+ p_hnmview->_normal._height = 160;
+ p_hnmview->_zoom._height = 320; //TODO: width??
+ p_hnmview->_normal._dstTop = p_mainview->_normal._dstTop + 16;
+ p_hnmview->_zoom._dstTop = p_mainview->_zoom._dstTop + 32;
}
- CLHNM_SetFinalBuffer(p_hnmcontext, p_hnmview->p_buffer);
- p_hnmview->doubled = doubled;
+ CLHNM_SetFinalBuffer(_hnmContext, p_hnmview->_bufferPtr);
+ p_hnmview->_doubled = doubled;
do {
- hnm_position = CLHNM_GetFrameNum(p_hnmcontext);
- CLHNM_WaitLoop(p_hnmcontext);
- playing = CLHNM_NextElement(p_hnmcontext);
+ hnm_position = CLHNM_GetFrameNum(_hnmContext);
+ CLHNM_WaitLoop(_hnmContext);
+ playing = CLHNM_NextElement(_hnmContext);
if (specialTextMode)
displayHNMSubtitles();
else
musicspy();
CLBlitter_CopyView2Screen(p_hnmview);
- assert(ScreenView.pitch == 320);
+ assert(ScreenView._pitch == 320);
CLKeyboard_Read();
if (allow_doubled) {
if (CLKeyboard_IsScanCodeDown(0x30)) { //TODO: const
if (!keybd_held) {
doubled = !doubled;
- p_hnmview->doubled = doubled; //TODO: but mainview ?
+ p_hnmview->_doubled = doubled; //TODO: but mainview ?
CLBlitter_FillScreenView(0);
keybd_held = 1;
}
@@ -6158,7 +6158,7 @@ void EdenGame::showMovie(char arg1) {
}
} while (playing && !videoCanceled);
CLView_Free(p_hnmview);
- CLHNM_DeallocMemory(p_hnmcontext);
+ CLHNM_DeallocMemory(_hnmContext);
}
void EdenGame::playHNM(int16 num) {
@@ -6183,8 +6183,8 @@ void EdenGame::playHNM(int16 num) {
showVideoSubtitle = 0;
videoCanceled = 0;
shnmfl(num);
- CLHNM_Reset(p_hnmcontext);
- CLHNM_FlushPreloadBuffer(p_hnmcontext);
+ CLHNM_Reset(_hnmContext);
+ CLHNM_FlushPreloadBuffer(_hnmContext);
if (needToFade) {
fadetoblack(4);
ClearScreen();
@@ -6195,7 +6195,7 @@ void EdenGame::playHNM(int16 num) {
else
showMovie(1);
curs_keepx = curs_keepy = -1;
- p_mainview->doubled = doubled;
+ p_mainview->_doubled = doubled;
if (specialTextMode) {
mus_fade_flags = 3;
musicspy();
@@ -8605,7 +8605,7 @@ void EdenGame::affiche_polygone_mapping(cube_t *cube, cubeface_t *face) {
if (r31 > ymax)
ymax = r31;
trace_ligne_mapping(r20, r30, r26, r31, r19, r18, r25, r24, lines);
- affiche_ligne_mapping(ymin, ymax, p_mainview->p_buffer, face->texptr);
+ affiche_ligne_mapping(ymin, ymax, p_mainview->_bufferPtr, face->texptr);
}
void EdenGame::trace_ligne_mapping(int16 r3, int16 r4, int16 r5, int16 r6, int16 r7, int16 r8, int16 r9, int16 r10, int16 *lines) {
@@ -8673,7 +8673,7 @@ void EdenGame::affiche_ligne_mapping(int16 r3, int16 r4, byte *target, byte *tex
int r22;
uint16 r31, r30;
int16 height = r4 - r3;
- byte *trg, *trg_line = p_mainview->p_buffer + r3 * 640; //TODO: target??
+ byte *trg, *trg_line = p_mainview->_bufferPtr + r3 * 640; //TODO: target??
int16 *line = &lines[r3 * 8];
// debug("curs: beg draw %d - %d", r3, r4);
for (r22 = height; r22; r22--, line += 8, trg_line += 640) {
@@ -8718,7 +8718,7 @@ int16 EdenGame::OpenDialog(void *arg1, void *arg2) {
void EdenGame::LostEdenMac_InitPrefs() {
p_global->pref_language = 1;
- doubled = 0; // TODO: set to 1
+ doubled = false; // TODO: set to true
p_global->pref_10C[0] = 192;
p_global->pref_10C[1] = 192;
p_global->pref_10E[0] = 255;
diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h
index e0fa47cf47..7968bc3b14 100644
--- a/engines/cryo/eden.h
+++ b/engines/cryo/eden.h
@@ -561,7 +561,7 @@ private:
color3_t newColor;
color_t oldPalette[256]; // TODO palette_t ?
color_t newPalette[256];
- rect_t rect_dst, rect_src;
+ Common::Rect rect_dst, rect_src;
void *voiceSamplesBuffer; //TODO: sound sample buffer
file_t h_bigfile;
byte info_list[16];
@@ -597,22 +597,22 @@ private:
soundchannel_t *hnmsound_ch;
sound_t *voiceSound;
- view_t *p_view2;
- view_t *p_underSubtitlesView;
- view_t *p_subtitlesview;
- view_t *p_underBarsView;
- view_t *p_mainview;
- view_t *p_hnmview;
- hnm_t *p_hnmcontext;
+ View *p_view2;
+ View *p_underSubtitlesView;
+ View *p_subtitlesview;
+ View *p_underBarsView;
+ View *p_mainview;
+ View *p_hnmview;
+ hnm_t *_hnmContext;
filespec_t bigfilespec;
- rect_t underSubtitlesBackupRect, underSubtitlesScreenRect, underBottomBarBackupRect, underBottomBarScreenRect,
+ Common::Rect underSubtitlesBackupRect, underSubtitlesScreenRect, underBottomBarBackupRect, underBottomBarScreenRect,
underTopBarBackupRect, underTopBarScreenRect, rect_31C7A;
int demoCurrentTicks;
int demoStartTicks;
int currentTime;
int16 mouse_y;
int16 mouse_x;
- int16 doubled;
+ bool doubled;
int16 curs_x_pan;
int16 inventoryScrollDelay;
int16 curs_y, curs_x;