[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.79,1.80 akos.h,1.22,1.23 script_v8.cpp,2.181,2.182
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Mon Jun 16 08:12:19 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv3316
Modified Files:
akos.cpp akos.h script_v8.cpp
Log Message:
Comitted the partial (but seemintly good enough) actorHit implementation
from patch #754895.
Ship-to-ship combat is still rather glitchy, but there are probably other
reasons for that.
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- akos.cpp 14 Jun 2003 18:52:29 -0000 1.79
+++ akos.cpp 16 Jun 2003 15:11:24 -0000 1.80
@@ -353,22 +353,29 @@
do {
if (*scaleytab++ < _scaleY) {
- masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+ if (_actorHitMode) {
+ if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+ _actorHitResult = true;
+ return;
+ }
+ } else {
+ masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
- if (color && y < _outheight && !masked && !skip_column) {
- pcolor = palette[color];
- if (_shadow_mode == 1) {
- if (pcolor == 13)
- pcolor = _shadow_table[*dst];
- } else if (_shadow_mode == 2) {
- warning("codec1_spec2"); // TODO
- } else if (_shadow_mode == 3) {
- if (pcolor < 8) {
- pcolor = (pcolor << 8) + *dst;
- pcolor = _shadow_table[pcolor];
+ if (color && y < _outheight && !masked && !skip_column) {
+ pcolor = palette[color];
+ if (_shadow_mode == 1) {
+ if (pcolor == 13)
+ pcolor = _shadow_table[*dst];
+ } else if (_shadow_mode == 2) {
+ warning("codec1_spec2"); // TODO
+ } else if (_shadow_mode == 3) {
+ if (pcolor < 8) {
+ pcolor = (pcolor << 8) + *dst;
+ pcolor = _shadow_table[pcolor];
+ }
}
+ *dst = pcolor;
}
- *dst = pcolor;
}
dst += _outwidth;
mask += _numStrips;
@@ -644,7 +651,11 @@
v1.skip_width = _width;
v1.scaleXstep = _mirror ? 1 : -1;
- _vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id);
+ if (_actorHitMode) {
+ if (_actorHitX < x_left || _actorHitX >= x_right || _actorHitY < y_top || _actorHitY >= y_bottom)
+ return 0;
+ } else
+ _vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id);
if (y_top >= (int)_outheight || y_bottom <= 0)
return 0;
@@ -717,6 +728,11 @@
byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
+ if (_actorHitMode) {
+ warning("codec5: _actorHitMode not yet implemented");
+ return 0;
+ }
+
if (!_mirror) {
clip_left = (_actorX - xmoveCur - _width) + 1;
} else {
@@ -923,6 +939,11 @@
int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh;
int32 skip_x, skip_y, cur_x, cur_y;
const byte transparency = (_vm->_features & GF_HUMONGOUS) ? 0 : 255;
+
+ if (_actorHitMode) {
+ warning("codec16: _actorHitMode not yet implemented");
+ return 0;
+ }
if (!_mirror) {
clip_left = (_actorX - xmoveCur - _width) + 1;
Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- akos.h 1 Jun 2003 13:09:30 -0000 1.22
+++ akos.h 16 Jun 2003 15:11:24 -0000 1.23
@@ -65,7 +65,12 @@
aksq = 0;
akof = 0;
akcd = 0;
+ _actorHitMode = false;
}
+
+ bool _actorHitMode;
+ int16 _actorHitX, _actorHitY;
+ bool _actorHitResult;
void setPalette(byte *palette);
void setFacing(Actor *a);
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.181
retrieving revision 2.182
diff -u -d -r2.181 -r2.182
--- script_v8.cpp 15 Jun 2003 00:54:13 -0000 2.181
+++ script_v8.cpp 16 Jun 2003 15:11:24 -0000 2.182
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "akos.h"
#include "charset.h"
#include "intern.h"
#include "sound.h"
@@ -1469,52 +1470,21 @@
}
case 0xD9: { // actorHit - used, for example, to detect ship collision
// during ship-to-ship combat.
-#if 0
Actor *a = derefActor(args[1], "actorHit");
- int x = args[2];
- int y = args[3];
-
- // TODO: this should perform a collision test, i.e. check if
- // point (x,y) lies on the given actor or not.
- // To achieve this, one needs to consider the current costume
- // etc. What the original code seems to do is to draw the
- // actor/costume (but maybe in a custom buffer?), and let the
- // draw code perform the hit test.
- // But I am not 100% clear on this. For example, it probably
- // shouldn't touch the gfx usage bits, and some other things...
- // So maybe we need dedicated code for this after all?
-
- warning("actorHit(%d, %d, %d) NYI", args[1], x, y);
-
-#endif
-
- push(1); // FIXME - for now always return 1
-/*
- // Rough sketch, thanks to DanielFox and ludde
- struct SomeStruct {
- int RoomHeight, RoomWidth;
- byte *ScreenBuffer;
- }
-
- dword_4FC150 = args[3]; // X
- dword_4FC154 = args[2]; // Y
- Actor &a = pActors[args[1]];
- Point rel = GetScreenCoordsRelativeToRoom(), pt, scale;
- SomeStruct tmp;
+ AkosRenderer *ar = (AkosRenderer *) _costumeRenderer;
+ bool old_need_redraw = a->needRedraw;
- pt.x = a.x + a.field_18 - rel.x; // 18/1C are some kind of
- pt.y = a.y + a.field_1C - rel.y; // X/Y offsets...
- scale.x = a.scale_x;
- scale.y = a.scale_y;
+ ar->_actorHitX = args[2];
+ ar->_actorHitY = args[3] + _screenTop;
+ ar->_actorHitMode = true;
+ ar->_actorHitResult = false;
- dword_4FC148 = 2;
- graphics_getBuffer1Info(&tmp); // Some kind of get_virtscreen?
- chore_drawActor(tmp, actor_nr, &pt, &scale);
+ a->needRedraw = true;
+ a->drawActorCostume();
+ a->needRedraw = old_need_redraw;
- if (dword_4FC148 != 1) // Guess this is changed by
- dword_4FC148 = 0; // chore_drawActor
- push(dword_4FC148);
-*/
+ ar->_actorHitMode = false;
+ push(ar->_actorHitResult);
break;
}
case 0xDA: // lipSyncWidth
More information about the Scummvm-git-logs
mailing list