aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorLudvig Strigeus2002-04-13 21:06:48 +0000
committerLudvig Strigeus2002-04-13 21:06:48 +0000
commit82d4f89d5353184e35ff843cfb0b0b9bca619dac (patch)
treec99f9d385af595412f9395b9b8cb68c58899f6ff /simon
parentff6523f93fe3138d594024d1128f45ba0b44f5b3 (diff)
downloadscummvm-rg350-82d4f89d5353184e35ff843cfb0b0b9bca619dac.tar.gz
scummvm-rg350-82d4f89d5353184e35ff843cfb0b0b9bca619dac.tar.bz2
scummvm-rg350-82d4f89d5353184e35ff843cfb0b0b9bca619dac.zip
added null graphics driver (USE_NULL_DRIVER)
will make it nicer later. svn-id: r3931
Diffstat (limited to 'simon')
-rw-r--r--simon/simon.cpp16
-rw-r--r--simon/simon.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/simon/simon.cpp b/simon/simon.cpp
index f995b8a7f1..0a1aeb2aba 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -131,7 +131,7 @@ FILE *fopen_maybe_lowercase(const char *filename) {
byte *SimonState::allocateItem(uint size) {
byte *org = _itemheap_ptr;
- size = (size + 1) & ~1;
+ size = (size + 3) & ~3;
_itemheap_ptr += size;
_itemheap_curpos += size;
@@ -142,8 +142,16 @@ byte *SimonState::allocateItem(uint size) {
return org;
}
+void SimonState::alignTableMem() {
+ if ((uint32)_tablesheap_ptr & 3) {
+ _tablesheap_ptr += 2;
+ _tablesheap_curpos += 2;
+ }
+}
+
byte *SimonState::allocateTable(uint size) {
byte *org = _tablesheap_ptr;
+
size = (size + 1) & ~1;
_tablesheap_ptr += size;
@@ -527,7 +535,11 @@ void SimonState::readSubroutine(FILE *in, Subroutine *sub) {
}
Subroutine *SimonState::createSubroutine(uint id) {
- Subroutine *sub = (Subroutine*)allocateTable(sizeof(Subroutine));
+ Subroutine *sub;
+
+ alignTableMem();
+
+ sub = (Subroutine*)allocateTable(sizeof(Subroutine));
sub->id = id;
sub->first = 0;
sub->next = _subroutine_list;
diff --git a/simon/simon.h b/simon/simon.h
index 6e98eee821..8fbcf4d346 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -592,6 +592,7 @@ public:
byte *allocateItem(uint size);
byte *allocateTable(uint size);
+ void alignTableMem();
Child *findChildOfType(Item *i, uint child);
Child *allocateChildBlock(Item *i, uint type, uint size);