[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.96,1.97 costume.cpp,1.39,1.40 scumm.h,1.188,1.189 scummvm.cpp,1.189,1.190 sdl_gl.cpp,1.4,1.5
Max Horn
fingolfin at users.sourceforge.net
Mon Jul 22 11:12:06 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv13160
Modified Files:
actor.cpp costume.cpp scumm.h scummvm.cpp sdl_gl.cpp
Log Message:
moved some utility functions out of class Scumm
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- actor.cpp 18 Jul 2002 15:45:10 -0000 1.96
+++ actor.cpp 22 Jul 2002 18:11:48 -0000 1.97
@@ -109,7 +109,7 @@
{
if (_gameId == GID_DIG) {
double temp = atan2((double)x, (double)-y);
- return Scumm::normalizeAngle((int)(temp * 180 / 3.1415926535));
+ return normalizeAngle((int)(temp * 180 / 3.1415926535));
} else {
if (abs(y) * 2 < abs(x)) {
if (x > 0)
@@ -189,7 +189,7 @@
if (specdir & 0x8000) {
dir = specdir & 0x3FFF;
} else {
- error("getProgrDirChange: special dir not implemented");
+ error("remapDirection: special dir not implemented");
}
}
@@ -231,7 +231,7 @@
}
}
/* Or 1024 in to signal direction interpolation should be done */
- return Scumm::normalizeAngle(dir) | 1024;
+ return normalizeAngle(dir) | 1024;
}
int Actor::updateActorDirection()
@@ -245,12 +245,12 @@
dirType = _vm->akos_hasManyDirections(this);
- from = Scumm::toSimpleDir(dirType, facing);
+ from = toSimpleDir(dirType, facing);
dir = remapDirection(newDirection);
shouldInterpolate = (dir & 1024);
- to = Scumm::toSimpleDir(dirType, dir & 1023);
+ to = toSimpleDir(dirType, dir & 1023);
diff = to - from;
- num = Scumm::numSimpleDirDirections(dirType);
+ num = numSimpleDirDirections(dirType);
if (shouldInterpolate) {
// Turn left or right, depending on which is shorter.
@@ -266,7 +266,7 @@
} else
from = to;
- dir = Scumm::fromSimpleDir(dirType, from & (num - 1));
+ dir = fromSimpleDir(dirType, from % num);
return dir;
}
@@ -464,7 +464,7 @@
} else {
cmd = anim >> 2;
- dir = Scumm::oldDirToNewDir(anim & 3);
+ dir = oldDirToNewDir(anim & 3);
// Convert into old cmd code
cmd = 0x3F - cmd + 2;
@@ -497,7 +497,7 @@
if (facing == direction)
return;
- facing = Scumm::normalizeAngle(direction);
+ facing = normalizeAngle(direction);
if (costume == 0)
return;
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/costume.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- costume.cpp 18 Jul 2002 18:42:50 -0000 1.39
+++ costume.cpp 22 Jul 2002 18:11:48 -0000 1.40
@@ -725,7 +725,7 @@
byte width, height, pcolor;
int color;
int step = _scaleIndexXStep;
- int x;
+ uint x;
uint y;
uint scrheight;
@@ -1359,7 +1359,7 @@
void CostumeRenderer::setFacing(uint16 facing)
{
- _mirror = Scumm::newDirToOldDir(facing) != 0 || (_loaded._ptr[7] & 0x80);
+ _mirror = newDirToOldDir(facing) != 0 || (_loaded._ptr[7] & 0x80);
}
void CostumeRenderer::setCostume(int costume)
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- scumm.h 18 Jul 2002 15:45:10 -0000 1.188
+++ scumm.h 22 Jul 2002 18:11:48 -0000 1.189
@@ -783,16 +783,7 @@
uint32 *_classData;
- static int newDirToOldDir(int dir);
- static int oldDirToNewDir(int dir);
-
- static int normalizeAngle(int angle);
int getAngleFromPos(int x, int y);
- static int fromSimpleDir(int dirtype, int dir);
- static int toSimpleDir(int dirtype, int dir);
- static int numSimpleDirDirections(int dirType);
- void startAnimActorEx(Actor *a, int frame, int direction);
- int getProgrDirChange(Actor *a, int mode);
void walkActors();
void playActorSounds();
@@ -1490,5 +1481,15 @@
void CDECL warning(const char *s, ...);
void CDECL debug(int level, const char *s, ...);
void checkHeap();
+
+/* Direction conversion functions (between old dir and new dir format) */
+int newDirToOldDir(int dir);
+int oldDirToNewDir(int dir);
+
+int normalizeAngle(int angle);
+int fromSimpleDir(int dirtype, int dir);
+int toSimpleDir(int dirtype, int dir);
+int numSimpleDirDirections(int dirType);
+
#endif
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- scummvm.cpp 21 Jul 2002 06:55:32 -0000 1.189
+++ scummvm.cpp 22 Jul 2002 18:11:48 -0000 1.190
@@ -1103,7 +1103,16 @@
free(_classData);
}
-int Scumm::newDirToOldDir(int dir)
+const int new_dir_table[4] = {
+ 270,
+ 90,
+ 180,
+ 0,
+};
+
+const int16 many_direction_tab[16] = {71, 109, 251, 289, -1, -1, -1, -1, 22, 72, 107, 157, 202, 252, 287, 337};
+
+int newDirToOldDir(int dir)
{
if (dir >= 71 && dir <= 109)
return 1;
@@ -1114,29 +1123,20 @@
return 3;
}
-const int new_dir_table[4] = {
- 270,
- 90,
- 180,
- 0,
-};
-
-int Scumm::oldDirToNewDir(int dir)
+int oldDirToNewDir(int dir)
{
return new_dir_table[dir];
}
-int Scumm::numSimpleDirDirections(int dirType)
+int numSimpleDirDirections(int dirType)
{
return dirType ? 8 : 4;
}
-const int16 many_direction_tab[16] = {71, 109, 251, 289, -1, -1, -1, -1, 22, 72, 107, 157, 202, 252, 287, 337};
-
/* Convert an angle to a simple direction */
-int Scumm::toSimpleDir(int dirType, int dir)
+int toSimpleDir(int dirType, int dir)
{
int num = dirType ? 8 : 4;
const int16 *dirtab = &many_direction_tab[dirType * 8];
@@ -1149,7 +1149,7 @@
}
/* Convert a simple direction to an angle */
-int Scumm::fromSimpleDir(int dirType, int dir)
+int fromSimpleDir(int dirType, int dir)
{
if (!dirType)
return dir * 90;
@@ -1158,7 +1158,7 @@
}
-int Scumm::normalizeAngle(int angle)
+int normalizeAngle(int angle)
{
int temp;
Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl_gl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sdl_gl.cpp 21 Jul 2002 06:52:04 -0000 1.4
+++ sdl_gl.cpp 22 Jul 2002 18:11:48 -0000 1.5
@@ -237,7 +237,7 @@
void OSystem_SDL::set_palette(const byte *colors, uint start, uint num) {
const byte *b = colors;
uint i;
- SDL_Color *base = _cur_pal + start;
+
for(i=0;i!=num;i++) {
fb2gl_palette(i+start,b[0],b[1],b[2]);
b += 4;
More information about the Scummvm-git-logs
mailing list