[Scummvm-cvs-logs] SF.net SVN: scummvm: [28831] scummvm/trunk/engines/agi
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Sep 2 23:31:51 CEST 2007
Revision: 28831
http://scummvm.svn.sourceforge.net/scummvm/?rev=28831&view=rev
Author: thebluegr
Date: 2007-09-02 14:31:51 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
Moved preagi common code to a more appropriate place (commit 1 of 2)
Modified Paths:
--------------
scummvm/trunk/engines/agi/preagi.cpp
scummvm/trunk/engines/agi/preagi_input.cpp
Modified: scummvm/trunk/engines/agi/preagi.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi.cpp 2007-09-02 19:07:33 UTC (rev 28830)
+++ scummvm/trunk/engines/agi/preagi.cpp 2007-09-02 21:31:51 UTC (rev 28831)
@@ -39,7 +39,6 @@
#include "sound/mixer.h"
#include "agi/agi.h"
-#include "agi/font.h"
#include "agi/graphics.h"
#include "agi/sprite.h"
#include "agi/opcodes.h"
@@ -50,12 +49,6 @@
// preagi engines
#include "agi/preagi_mickey.h"
-// default attributes
-#define IDA_DEFAULT 0x0F
-#define IDA_DEFAULT_REV 0xF0
-
-#define IDI_MAX_ROW_PIC 20
-
namespace Agi {
PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) {
@@ -279,63 +272,4 @@
return _loader->unloadResource(r, n);
}
-// String functions
-// TODO: These need to be moved elsewhere
-
-void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
- int code;
-
- for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
- code = buffer[iChar];
-
- switch (code) {
- case '\n':
- case 0x8D:
- if (++row == 200 / 8) return;
- col = 0;
- break;
-
- case '|':
- // swap attribute nibbles
- break;
-
- default:
- drawChar(col * 8, row * 8, attr, code, (const char*)mickey_fontdata);
-
- if (++col == 320 / 8) {
- col = 0;
- if (++row == 200 / 8) return;
- }
- }
- }
-}
-
-void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
- int col = (25 / 2) - (strlen(buffer) / 2); // 25 = 320 / 8 (maximum column)
- drawStr(row, col, attr, buffer);
-}
-
-void PreAgiEngine::clearTextArea() {
- // FIXME: this causes crashes, I imagine it's because we're not currently locking the screen in drawStr
- for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) {
- //drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces
- }
-}
-
-void PreAgiEngine::drawChar(int x, int y, int attr, int code, const char *fontdata) {
- int cx, cy;
- uint8 color;
-
- for (cy = 0; cy < 8; cy++) {
- for (cx = 0; cx < 8; cx++) {
- if (fontdata[(code * 8) + cy] & (1 << (7 - cx)))
- color = attr & 0x0f; // foreground color
- else
- color = (attr & 0xf0) / 0x10; // background color
-
- _gfx->putPixelsA(x + cx, y + cy, 1, &color);
- }
- }
-}
-
} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/preagi_input.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_input.cpp 2007-09-02 19:07:33 UTC (rev 28830)
+++ scummvm/trunk/engines/agi/preagi_input.cpp 2007-09-02 21:31:51 UTC (rev 28831)
@@ -27,13 +27,81 @@
#include "common/events.h"
#include "agi/agi.h"
+#include "agi/font.h"
#include "agi/graphics.h"
#include "agi/keyboard.h"
+// preagi engines
+#include "agi/preagi_mickey.h"
+
+// default attributes
+#define IDA_DEFAULT 0x0F
+#define IDA_DEFAULT_REV 0xF0
+
+#define IDI_MAX_ROW_PIC 20
+
namespace Agi {
-// Input
+// String functions
+void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
+ int code;
+
+ for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
+ code = buffer[iChar];
+
+ switch (code) {
+ case '\n':
+ case 0x8D:
+ if (++row == 200 / 8) return;
+ col = 0;
+ break;
+
+ case '|':
+ // swap attribute nibbles
+ break;
+
+ default:
+ drawChar(col * 8, row * 8, attr, code, (const char*)mickey_fontdata);
+
+ if (++col == 320 / 8) {
+ col = 0;
+ if (++row == 200 / 8) return;
+ }
+ }
+ }
+}
+
+void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
+ int col = (25 / 2) - (strlen(buffer) / 2); // 25 = 320 / 8 (maximum column)
+ drawStr(row, col, attr, buffer);
+}
+
+void PreAgiEngine::clearTextArea() {
+ // FIXME: this causes crashes, I imagine it's because we're not currently locking the screen in drawStr
+ for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) {
+ //drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces
+ }
+}
+
+void PreAgiEngine::drawChar(int x, int y, int attr, int code, const char *fontdata) {
+ int cx, cy;
+ uint8 color;
+
+ for (cy = 0; cy < 8; cy++) {
+ for (cx = 0; cx < 8; cx++) {
+ if (fontdata[(code * 8) + cy] & (1 << (7 - cx)))
+ color = attr & 0x0f; // foreground color
+ else
+ color = (attr & 0xf0) / 0x10; // background color
+
+ _gfx->putPixelsA(x + cx, y + cy, 1, &color);
+ }
+ }
+}
+
+// Input functions
+
void PreAgiEngine::waitAnyKeyAnim() {
waitAnyKey(true);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list