aboutsummaryrefslogtreecommitdiff
path: root/kyra
diff options
context:
space:
mode:
authorGregory Montoir2005-09-10 00:15:40 +0000
committerGregory Montoir2005-09-10 00:15:40 +0000
commit689b89b2be74df1d48bb60184f441dba7b88f147 (patch)
tree4c226f6c097a6dd48073a735aaea76557dd7b6fb /kyra
parent732f33bd3adcc27ba6b4d3cc8266f3e612627462 (diff)
downloadscummvm-rg350-689b89b2be74df1d48bb60184f441dba7b88f147.tar.gz
scummvm-rg350-689b89b2be74df1d48bb60184f441dba7b88f147.tar.bz2
scummvm-rg350-689b89b2be74df1d48bb60184f441dba7b88f147.zip
fixed line breaks ; cleanup
svn-id: r18800
Diffstat (limited to 'kyra')
-rw-r--r--kyra/kyra.cpp32
-rw-r--r--kyra/kyra.h14
-rw-r--r--kyra/screen.cpp8
-rw-r--r--kyra/screen.h2
4 files changed, 38 insertions, 18 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp
index 72642cd07d..d5f3fdea84 100644
--- a/kyra/kyra.cpp
+++ b/kyra/kyra.cpp
@@ -189,9 +189,26 @@ int KyraEngine::go() {
_screen->loadFont(Screen::FID_8_FNT, _res->fileData("8FAT.FNT", &sz));
_screen->setScreenDim(0);
seq_intro();
+ startup();
+ mainLoop();
return 0;
}
+void KyraEngine::startup() {
+ debug(9, "KyraEngine::startup()");
+ static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 };
+ _screen->setTextColorMap(colorMap);
+ _screen->setFont(Screen::FID_6_FNT);
+ _screen->setAnimBlockPtr(3750);
+ memset(_flagsTable, 0, sizeof(_flagsTable));
+ // XXX
+}
+
+void KyraEngine::mainLoop() {
+ debug(9, "KyraEngine::mainLoop()");
+ // XXX
+}
+
void KyraEngine::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData) {
debug(9, "KyraEngine::copyBitmap('%s', %d, %d, 0x%X)", filename, tempPage, dstPage, palData);
uint32 fileSize;
@@ -238,7 +255,6 @@ int KyraEngine::getCenterStringX(const char *str, int x1, int x2) {
}
int KyraEngine::getCharLength(const char *str, int len) {
- debug(9, "KyraEngine::preprocessString('%s', %d)", str, len);
debug(9, "KyraEngine::getCharLength('%s', %d)", str, len);
int charsCount = 0;
if (*str) {
@@ -258,9 +274,10 @@ int KyraEngine::getCharLength(const char *str, int len) {
int KyraEngine::dropCRIntoString(char *str, int offs) {
debug(9, "KyraEngine::dropCRIntoString('%s', %d)", str, offs);
int pos = 0;
+ str += offs;
while (*str) {
if (*str == ' ') {
- *str = 0xD;
+ *str = '\r';
return pos;
}
++str;
@@ -275,7 +292,7 @@ char *KyraEngine::preprocessString(const char *str) {
strcpy(_talkBuffer, str);
char *p = _talkBuffer;
while (*p) {
- if (*p == 0xD) {
+ if (*p == '\r') {
return _talkBuffer;
}
++p;
@@ -309,9 +326,9 @@ int KyraEngine::buildMessageSubstrings(const char *str) {
int currentLine = 0;
int pos = 0;
while (*str) {
- if (*str == 0xD) {
+ if (*str == '\r') {
assert(currentLine < TALK_SUBSTRING_NUM);
- _talkSubstrings[currentLine * TALK_SUBSTRING_LEN + pos] = 0;
+ _talkSubstrings[currentLine * TALK_SUBSTRING_LEN + pos] = '\0';
++currentLine;
pos = 0;
} else {
@@ -500,6 +517,7 @@ void KyraEngine::seq_introStory() {
debug(9, "KyraEngine::seq_introStory()");
loadBitmap("MAIN_ENG.CPS", 3, 3, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
+ // XXX wait 360 ticks
}
void KyraEngine::seq_introMalcomTree() {
@@ -512,12 +530,10 @@ void KyraEngine::seq_introMalcomTree() {
void KyraEngine::seq_introKallakWriting() {
debug(9, "KyraEngine::seq_introKallakWriting()");
seq_makeHandShapes();
- uint8 *p = (uint8 *)malloc(5060);
- _screen->setAnimBlockPtr(p, 5060);
+ _screen->setAnimBlockPtr(5060);
_screen->_charWidth = -2;
_screen->clearPage(3);
seq_playSpecialSequence(_seq_introData_KallakWriting, true);
- free(p);
seq_freeHandShapes();
}
diff --git a/kyra/kyra.h b/kyra/kyra.h
index 1986de1aef..67861fe3cd 100644
--- a/kyra/kyra.h
+++ b/kyra/kyra.h
@@ -63,11 +63,11 @@ struct Shape {
struct Room {
uint8 id;
- uint16 room_north_exit;
- uint16 room_east_exit;
- uint16 room_south_exit;
- uint16 room_west_exit;
- uint8 items_table[12];
+ uint16 northExit;
+ uint16 eastExit;
+ uint16 southExit;
+ uint16 westExit;
+ uint8 itemsTable[12];
};
struct TalkCoords {
@@ -112,8 +112,9 @@ protected:
int go();
int init(GameDetector &detector);
+ void startup();
+ void mainLoop();
void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData);
-
void setTalkCoords(uint16 y);
int getCenterStringX(const char *str, int x1, int x2);
int getCharLength(const char *str, int len);
@@ -156,6 +157,7 @@ protected:
uint16 _talkMessageY;
uint16 _talkMessageH;
bool _talkMessagePrinted;
+ uint8 _flagsTable[51];
bool _seq_copyViewOffs;
uint8 *_seq_handShapes[3];
diff --git a/kyra/screen.cpp b/kyra/screen.cpp
index a0f36c9306..28f61bfbd7 100644
--- a/kyra/screen.cpp
+++ b/kyra/screen.cpp
@@ -68,6 +68,8 @@ Screen::~Screen() {
}
free(_currentPalette);
free(_screenPalette);
+ free(_decodeShapeBuffer);
+ free(_animBlockPtr);
}
void Screen::updateScreen() {
@@ -317,9 +319,9 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum)
}
}
-void Screen::setAnimBlockPtr(uint8 *p, int size) {
- debug(9, "Screen::setAnimBlockPtr(0x%X, %d)", p, size);
- _animBlockPtr = p;
+void Screen::setAnimBlockPtr(int size) {
+ debug(9, "Screen::setAnimBlockPtr(%d)", size);
+ _animBlockPtr = (uint8 *)malloc(size);
_animBlockSize = size;
}
diff --git a/kyra/screen.h b/kyra/screen.h
index 712aa39a38..e044c8a75e 100644
--- a/kyra/screen.h
+++ b/kyra/screen.h
@@ -94,7 +94,7 @@ public:
void copyCurPageBlock(int x, int y, int h, int w, uint8 *dst);
void shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent);
void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1);
- void setAnimBlockPtr(uint8 *p, int size);
+ void setAnimBlockPtr(int size);
void setTextColorMap(const uint8 *cmap);
void setTextColor(const uint8 *cmap, int a, int b);
void loadFont(FontId fontId, uint8 *fontData);