aboutsummaryrefslogtreecommitdiff
path: root/saga/text.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2004-12-15 00:24:12 +0000
committerEugene Sandulenko2004-12-15 00:24:12 +0000
commit502b279d243d79f46bb8a151ae610949d30bf757 (patch)
tree7f17defd563f74aa4944c7f8c6da0bc9ffc81c1a /saga/text.cpp
parent58eabb6a5fdafed605fcb0cd8f56dbcea8723d46 (diff)
downloadscummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.tar.gz
scummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.tar.bz2
scummvm-rg350-502b279d243d79f46bb8a151ae610949d30bf757.zip
Patch #1081904 ITE: MAC demo support
o Endianness-aware resource loading o Removed ys_dl_list in favor of our object implementation o Cleanup in actor code o Partial support for ITE Mac rereleased demo svn-id: r16051
Diffstat (limited to 'saga/text.cpp')
-rw-r--r--saga/text.cpp49
1 files changed, 13 insertions, 36 deletions
diff --git a/saga/text.cpp b/saga/text.cpp
index be14528995..f7237e4006 100644
--- a/saga/text.cpp
+++ b/saga/text.cpp
@@ -24,7 +24,6 @@
// Text / dialogue display management module
#include "saga/saga.h"
-#include "saga/yslib.h"
#include "saga/gfx.h"
#include "saga/font.h"
@@ -149,25 +148,18 @@ int SagaEngine::textDraw(int font_id, SURFACE *ds, const char *string, int text_
TEXTLIST *SagaEngine::textCreateList() {
TEXTLIST *new_textlist;
- new_textlist = (TEXTLIST *)malloc(sizeof *new_textlist);
+ new_textlist = new TEXTLIST;
if (new_textlist == NULL) {
return NULL;
}
- new_textlist->list = ys_dll_create();
-
- if (new_textlist->list == NULL) {
- free(new_textlist);
- return NULL;
- }
-
return new_textlist;
}
void SagaEngine::textClearList(TEXTLIST *tlist) {
if (tlist != NULL) {
- ys_dll_delete_all(tlist->list);
+ tlist->clear();
}
return;
@@ -175,21 +167,18 @@ void SagaEngine::textClearList(TEXTLIST *tlist) {
void SagaEngine::textDestroyList(TEXTLIST *tlist) {
if (tlist != NULL) {
- ys_dll_destroy(tlist->list);
- }
- free(tlist);
-
+ delete tlist;
+ }
return;
}
int SagaEngine::textDrawList(TEXTLIST *textlist, SURFACE *ds) {
TEXTLIST_ENTRY *entry_p;
- YS_DL_NODE *walk_p;
assert((textlist != NULL) && (ds != NULL));
- for (walk_p = ys_dll_head(textlist->list); walk_p != NULL; walk_p = ys_dll_next(walk_p)) {
- entry_p = (TEXTLIST_ENTRY *)ys_dll_get_data(walk_p);
+ for (TEXTLIST::iterator texti = textlist->begin(); texti != textlist->end(); ++texti) {
+ entry_p = (TEXTLIST_ENTRY *)texti.operator->();
if (entry_p->display != 0) {
textDraw(entry_p->font_id, ds, entry_p->string, entry_p->text_x, entry_p->text_y, entry_p->color,
entry_p->effect_color, entry_p->flags);
@@ -201,16 +190,13 @@ int SagaEngine::textDrawList(TEXTLIST *textlist, SURFACE *ds) {
int SagaEngine::textProcessList(TEXTLIST *textlist, long ms) {
TEXTLIST_ENTRY *entry_p;
- YS_DL_NODE *walk_p;
- YS_DL_NODE *temp_p;
- for (walk_p = ys_dll_head(textlist->list); walk_p != NULL; walk_p = temp_p) {
- temp_p = ys_dll_next(walk_p);
- entry_p = (TEXTLIST_ENTRY *)ys_dll_get_data(walk_p);
+ for (TEXTLIST::iterator texti = textlist->begin(); texti != textlist->end(); ++texti) {
+ entry_p = (TEXTLIST_ENTRY *)texti.operator->();
if (entry_p->flags & TEXT_TIMEOUT) {
entry_p->time -= ms;
if (entry_p->time <= 0) {
- ys_dll_delete(walk_p);
+ texti=textlist->eraseAndPrev(texti);
}
}
}
@@ -220,13 +206,10 @@ int SagaEngine::textProcessList(TEXTLIST *textlist, long ms) {
}
TEXTLIST_ENTRY *SagaEngine::textAddEntry(TEXTLIST *textlist, TEXTLIST_ENTRY *entry) {
- YS_DL_NODE *new_node = NULL;
-
if (entry != NULL) {
- new_node = ys_dll_add_tail(textlist->list, entry, sizeof *entry);
+ return textlist->pushBack(*entry).operator->();
}
-
- return (new_node != NULL) ? (TEXTLIST_ENTRY *)new_node->data : NULL;
+ return NULL;
}
int SagaEngine::textSetDisplay(TEXTLIST_ENTRY *entry, int val) {
@@ -239,18 +222,12 @@ int SagaEngine::textSetDisplay(TEXTLIST_ENTRY *entry, int val) {
}
int SagaEngine::textDeleteEntry(TEXTLIST *textlist, TEXTLIST_ENTRY *entry) {
- YS_DL_NODE *walk_p;
if (entry == NULL) {
return FAILURE;
}
-
- for (walk_p = ys_dll_head(textlist->list); walk_p != NULL; walk_p = ys_dll_next(walk_p)) {
- if (entry == ys_dll_get_data(walk_p)) {
- ys_dll_delete(walk_p);
- break;
- }
- }
+
+ textlist->remove(entry);
return SUCCESS;
}