From 3e574cfbf89ef7dc6126e64a1776595fea9fac7b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2011 01:02:05 +0200 Subject: CGE: Remove wtom() --- engines/cge/cge_main.cpp | 5 ++--- engines/cge/general.cpp | 11 ----------- engines/cge/general.h | 1 - engines/cge/sound.cpp | 16 ++++++++++------ 4 files changed, 12 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index a915a08689..c4719fe287 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -529,10 +529,9 @@ void CGEEngine::setMapBrick(int x, int z) { Square *s = new Square(this); if (s) { - static char n[] = "00:00"; + char n[6]; s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ); - wtom(x, n + 0, 10, 2); - wtom(z, n + 3, 10, 2); + sprintf(n, "%02d:%02d", x, z); Cluster::_map[z][x] = 1; s->setName(n); _vga->_showQ->insert(s, _vga->_showQ->first()); diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index 7cd44a81d0..13a92d38c2 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -63,17 +63,6 @@ char *forceExt(char *buf, const char *name, const char *ext) { return buf; } -char *wtom(uint16 val, char *str, int radix, int len) { - while (--len >= 0) { - uint16 w = val % radix; - if (w > 9) - w += ('A' - ('9' + 1)); - str[len] = '0' + w; - val /= radix; - } - return str; -} - void sndSetVolume() { // USeless for ScummVM } diff --git a/engines/cge/general.h b/engines/cge/general.h index 33abd1e852..b9e8e27be4 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -47,7 +47,6 @@ struct Dac { typedef uint16 Crypt(void *buf, uint16 siz, uint16 seed); -char *wtom(uint16 val, char *str, int radix, int len); int takeEnum(const char **tab, const char *text); uint16 chkSum(void *m, uint16 n); char *mergeExt(char *buf, const char *name, const char *ext); diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index fb0549ac22..547469aef8 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -132,11 +132,11 @@ int Fx::find(int ref) { void Fx::preload(int ref0) { Han *cacheLim = _cache + _size; + char filename[12]; for (int ref = ref0; ref < ref0 + 10; ref++) { - static char fname[] = "FX00000.WAV"; - wtom(ref, fname + 2, 10, 5); - VFile file = VFile(fname); + sprintf(filename, "FX%05d.WAV", ref); + VFile file = VFile(filename); DataCk *wav = loadWave(&file); if (wav) { Han *p = &_cache[find(0)]; @@ -144,20 +144,24 @@ void Fx::preload(int ref0) { break; p->_wav = wav; p->_ref = ref; + } else { + warning("Unable to load %s", filename); } } } DataCk *Fx::load(int idx, int ref) { - static char fname[] = "FX00000.WAV"; - wtom(ref, fname + 2, 10, 5); + char filename[12]; + sprintf(filename, "FX%05d.WAV", ref); - VFile file = VFile(fname); + VFile file = VFile(filename); DataCk *wav = loadWave(&file); if (wav) { Han *p = &_cache[idx]; p->_wav = wav; p->_ref = ref; + } else { + warning("Unable to load %s", filename); } return wav; } -- cgit v1.2.3