[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.330,1.331 akos.cpp,1.211,1.212 akos.h,1.36,1.37 base-costume.cpp,2.28,2.29 scumm.cpp,1.388,1.389 scumm.h,1.550,1.551
Max Horn
fingolfin at users.sourceforge.net
Sat Mar 26 17:08:44 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.329,1.330 akos.h,1.35,1.36 base-costume.cpp,2.27,2.28 base-costume.h,1.36,1.37 costume.cpp,1.171,1.172 costume.h,1.34,1.35 scumm.h,1.549,1.550
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui chooser.cpp,1.13,1.14 ListWidget.cpp,1.44,1.45 ListWidget.h,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4949
Modified Files:
actor.cpp akos.cpp akos.h base-costume.cpp scumm.cpp scumm.h
Log Message:
Tie the AKOS code into the new costume infrastructure, too
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -d -r1.330 -r1.331
--- actor.cpp 27 Mar 2005 00:42:48 -0000 1.330
+++ actor.cpp 27 Mar 2005 01:07:20 -0000 1.331
@@ -320,14 +320,16 @@
int Actor::updateActorDirection(bool is_walking) {
int from;
- int dirType;
+ bool dirType = false;
int dir;
bool shouldInterpolate;
if ((_vm->_version == 6) && _ignoreTurns)
return _facing;
- dirType = (_vm->_version >= 7) ? _vm->akos_hasManyDirections(_costume) : false;
+ if (_vm->_version >= 7) {
+ dirType = ((AkosCostumeLoader *)_vm->_costumeLoader)->hasManyDirections(_costume);
+ }
from = toSimpleDir(dirType, _facing);
dir = remapDirection(_targetFacing, is_walking);
@@ -467,7 +469,7 @@
_needRedraw = true;
if (f == _initFrame)
_cost.reset();
- _vm->costumeDecodeData(this, f, (uint) - 1);
+ _vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1);
_frame = f;
}
} else {
@@ -501,7 +503,7 @@
_cost.reset();
_auxBlock.visible = false;
}
- _vm->costumeDecodeData(this, f, (uint) - 1);
+ _vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1);
_frame = f;
}
}
@@ -570,7 +572,7 @@
vald = _cost.frame[i];
if (vald == 0xFFFF)
continue;
- _vm->costumeDecodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask);
+ _vm->_costumeLoader->costumeDecodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask);
}
_needRedraw = true;
@@ -1128,25 +1130,10 @@
if (_animProgress >= _animSpeed) {
_animProgress = 0;
- BaseCostumeLoader *cost = 0;
-
- if (_vm->_features & GF_NEW_COSTUMES) {
- byte *akos = _vm->getResourceAddress(rtCostume, _costume);
- assert(akos);
- if (_vm->akos_increaseAnims(akos, this)) {
- _needRedraw = true;
- }
- } else {
- if (_vm->_features & GF_NES)
- cost = new NESCostumeLoader(_vm);
- else
- cost = new ClassicCostumeLoader(_vm);
- cost->loadCostume(_costume);
- if (cost->increaseAnims(this)) {
- _needRedraw = true;
- }
+ _vm->_costumeLoader->loadCostume(_costume);
+ if (_vm->_costumeLoader->increaseAnims(this)) {
+ _needRedraw = true;
}
- delete cost;
}
}
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- akos.cpp 17 Mar 2005 10:53:28 -0000 1.211
+++ akos.cpp 27 Mar 2005 01:07:20 -0000 1.212
@@ -137,20 +137,21 @@
}
}
-bool ScummEngine::akos_hasManyDirections(int costume) {
- byte *akos;
- const AkosHeader *akhd;
+void AkosCostumeLoader::loadCostume(int id) {
+ _akos = _vm->getResourceAddress(rtCostume, id);
+ assert(_akos);
+}
- akos = getResourceAddress(rtCostume, costume);
- assert(akos);
+bool AkosCostumeLoader::hasManyDirections() {
+ const AkosHeader *akhd;
- akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos);
+ akhd = (const AkosHeader *)_vm->findResourceData(MKID('AKHD'), _akos);
return (akhd->flags & 2) != 0;
}
-void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) {
+void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
uint anim;
- const byte *akos, *r;
+ const byte *r;
const AkosHeader *akhd;
uint offs;
int i;
@@ -161,20 +162,19 @@
if (a->_costume == 0)
return;
- if (_version >= 7 && akos_hasManyDirections(a->_costume))
+ loadCostume(a->_costume);
+
+ if (_vm->_version >= 7 && hasManyDirections())
anim = toSimpleDir(1, a->getFacing()) + frame * 8;
else
anim = newDirToOldDir(a->getFacing()) + frame * 4;
- akos = getResourceAddress(rtCostume, a->_costume);
- assert(akos);
-
- akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos);
+ akhd = (const AkosHeader *)_vm->findResourceData(MKID('AKHD'), _akos);
if (anim >= READ_LE_UINT16(&akhd->num_anims))
return;
- r = findResourceData(MKID('AKCH'), akos);
+ r = _vm->findResourceData(MKID('AKCH'), _akos);
assert(r);
offs = READ_LE_UINT16(r + anim * sizeof(uint16));
@@ -182,8 +182,8 @@
return;
r += offs;
- const uint8 *akst = findResourceData(MKID('AKST'), akos);
- const uint8 *aksf = findResourceData(MKID('AKSF'), akos);
+ const uint8 *akst = _vm->findResourceData(MKID('AKST'), _akos);
+ const uint8 *aksf = _vm->findResourceData(MKID('AKSF'), _akos);
i = 0;
mask = READ_LE_UINT16(r); r += 2;
@@ -201,7 +201,7 @@
a->_cost.seq3[i] = 0;
if (akst) {
- int size = getResourceDataSize(akst) / 8;
+ int size = _vm->getResourceDataSize(akst) / 8;
if (size > 0) {
bool found = false;
while (size--) {
@@ -231,7 +231,7 @@
a->_cost.seq1[i] = 0;
a->_cost.seq2[i] = 0;
if (aksf) {
- int size = getResourceDataSize(aksf) / 6;
+ int size = _vm->getResourceDataSize(aksf) / 6;
if (size > 0) {
bool found = false;
while (size--) {
@@ -256,7 +256,7 @@
a->_cost.curpos[i] = start;
a->_cost.seq3[i] = 0;
if (akst) {
- int size = getResourceDataSize(akst) / 8;
+ int size = _vm->getResourceDataSize(akst) / 8;
if (size > 0) {
bool found = false;
while (size--) {
@@ -1239,6 +1239,10 @@
return 0;
}
+byte AkosCostumeLoader::increaseAnims(Actor *a) {
+ return _vm->akos_increaseAnims(_akos, a);
+}
+
bool ScummEngine::akos_increaseAnims(const byte *akos, Actor *a) {
const byte *aksq, *akfo;
int i;
Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- akos.h 27 Mar 2005 00:42:50 -0000 1.36
+++ akos.h 27 Mar 2005 01:07:21 -0000 1.37
@@ -37,18 +37,26 @@
struct AkosHeader;
struct AkosOffset;
-/* TODO:
class AkosCostumeLoader : public BaseCostumeLoader {
+protected:
+ const byte *_akos;
+
public:
- AkosCostumeLoader(ScummEngine *vm);
+ AkosCostumeLoader(ScummEngine *vm) : BaseCostumeLoader(vm) {}
void loadCostume(int id);
byte increaseAnims(Actor *a);
void costumeDecodeData(Actor *a, int frame, uint usemask);
//void animateLimb(int limb, int f);
+ bool hasManyDirections(int id) {
+ loadCostume(id);
+ return hasManyDirections();
+ }
+
+protected:
+ bool hasManyDirections();
};
-*/
class AkosRenderer : public BaseCostumeRenderer {
protected:
Index: base-costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.cpp,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -d -r2.28 -r2.29
--- base-costume.cpp 27 Mar 2005 00:42:50 -0000 2.28
+++ base-costume.cpp 27 Mar 2005 01:07:21 -0000 2.29
@@ -88,18 +88,4 @@
return false;
}
-void ScummEngine::costumeDecodeData(Actor *a, int frame, uint usemask) {
- // TODO: This should eventually become a method of the appropriate
- // BaseCostumeLoader subclasses.
- if (_features & GF_NEW_COSTUMES)
- akos_decodeData(a, frame, usemask);
- else if (_features & GF_NES) {
- NESCostumeLoader lc(this);
- lc.costumeDecodeData(a, frame, usemask);
- } else {
- ClassicCostumeLoader lc(this);
- lc.costumeDecodeData(a, frame, usemask);
- }
-}
-
} // End of namespace Scumm
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.388
retrieving revision 1.389
diff -u -d -r1.388 -r1.389
--- scumm.cpp 27 Mar 2005 00:23:38 -0000 1.388
+++ scumm.cpp 27 Mar 2005 01:07:21 -0000 1.389
@@ -857,6 +857,7 @@
_existLanguageFile = false;
_languageBuffer = NULL;
_languageIndex = NULL;
+ _costumeLoader = NULL;
_costumeRenderer = NULL;
_2byteFontPtr = 0;
_V1TalkingActor = 0;
@@ -1154,6 +1155,7 @@
free(_languageBuffer);
free(_audioNames);
+ delete _costumeLoader;
delete _costumeRenderer;
free(_shadowPalette);
@@ -1270,12 +1272,16 @@
_charset = new CharsetRendererClassic(this);
// Create the costume renderer
- if (_features & GF_NEW_COSTUMES)
+ if (_features & GF_NEW_COSTUMES) {
_costumeRenderer = new AkosRenderer(this);
- else if (_features & GF_NES)
+ _costumeLoader = new AkosCostumeLoader(this);
+ } else if (_features & GF_NES) {
_costumeRenderer = new NESCostumeRenderer(this);
- else
+ _costumeLoader = new NESCostumeLoader(this);
+ } else {
_costumeRenderer = new ClassicCostumeRenderer(this);
+ _costumeLoader = new ClassicCostumeLoader(this);
+ }
// Create FT INSANE object
if (_gameId == GID_FT)
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.550
retrieving revision 1.551
diff -u -d -r1.550 -r1.551
--- scumm.h 27 Mar 2005 00:42:53 -0000 1.550
+++ scumm.h 27 Mar 2005 01:07:22 -0000 1.551
@@ -43,6 +43,7 @@
namespace Scumm {
class Actor;
+class BaseCostumeLoader;
class BaseCostumeRenderer;
class CharsetRenderer;
class IMuse;
@@ -470,7 +471,8 @@
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette
int _numCharsets; // FIXME - should be protected, used by CharsetRenderer
- BaseCostumeRenderer* _costumeRenderer;
+ BaseCostumeLoader *_costumeLoader;
+ BaseCostumeRenderer *_costumeRenderer;
int _NESCostumeSet;
void NES_loadCostumeSet(int n);
@@ -845,7 +847,6 @@
void setTalkingActor(int variable);
// Generic costume code
- void costumeDecodeData(Actor *a, int frame, uint usemask);
bool isCostumeInUse(int i) const;
// Akos Class
@@ -863,8 +864,6 @@
bool akos_increaseAnim(Actor *a, int i, const byte *aksq, const uint16 *akfo, int numakfo);
void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
void akos_processQueue();
- void akos_decodeData(Actor *a, int frame, uint usemask);
- bool akos_hasManyDirections(int costume);
protected:
/* Should be in Graphics class? */
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.329,1.330 akos.h,1.35,1.36 base-costume.cpp,2.27,2.28 base-costume.h,1.36,1.37 costume.cpp,1.171,1.172 costume.h,1.34,1.35 scumm.h,1.549,1.550
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui chooser.cpp,1.13,1.14 ListWidget.cpp,1.44,1.45 ListWidget.h,1.27,1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list