diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index f4c54db99b1deaa191ea23dd9a5bb92c650ae7bc..f4e3b0fff39acd98b14a65fa9bc9bcfe82bdb5d6 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure JetpackOff;
procedure CatchFire(Attacker: Word);
+ //WARNING! this does nothing for now, but still call it!
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
+
property Name: String read FName write FName;
property Model: TPlayerModel read FModel;
property Health: Integer read FHealth write FHealth;
RAngle: Integer;
Color: TRGB;
Obj: TObj;
+
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
end;
+
TShell = record
SpriteID: DWORD;
Live: Boolean;
Timeout: Cardinal;
CX, CY: Integer;
Obj: TObj;
+
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
end;
TCorpse = class (TObject)
procedure SaveState(var Mem: TBinMemoryWriter);
procedure LoadState(var Mem: TBinMemoryReader);
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
+
property Obj: TObj read FObj;
property State: Byte read FState;
property Mess: Boolean read FMess;
BotNames: Array of String;
BotList: Array of TBotProfile;
+
+procedure TGib.positionChanged (); begin end;
+procedure TShell.positionChanged (); begin end;
+
+
function Lerp(X, Y, Factor: Integer): Integer;
begin
Result := X + ((Y - X) div Factor);
Obj.X := fX;
Obj.Y := fY;
g_Obj_Push(@Obj, dX + Random(4)-Random(4), dY-Random(4));
+ positionChanged(); // this updates spatial accelerators
RAngle := Random(360);
Timeout := gTime + SHELL_TIMEOUT;
Obj.X := fX-GibsArray[a].Rect.X-(GibsArray[a].Rect.Width div 2);
Obj.Y := fY-GibsArray[a].Rect.Y-(GibsArray[a].Rect.Height div 2);
g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
+ positionChanged(); // this updates spatial accelerators
RAngle := Random(360);
if gBloodCount > 0 then
begin
vel := Obj.Vel;
mr := g_Obj_Move(@Obj, True, False, True);
+ positionChanged(); // this updates spatial accelerators
if WordBool(mr and MOVE_FALLOUT) then
begin
begin
vel := Obj.Vel;
mr := g_Obj_Move(@Obj, True, False, True);
+ positionChanged(); // this updates spatial accelerators
if WordBool(mr and MOVE_FALLOUT) or (gShells[i].Timeout < gTime) then
begin
resetWeaponQueue();
end;
+procedure TPlayer.positionChanged ();
+begin
+end;
+
procedure TPlayer.Damage(value: Word; SpawnerUID: Word; vx, vy: Integer; t: Byte);
var
c: Word;
begin
id := g_Items_Create(FObj.X, FObj.Y, t, True, False);
if KillType = K_EXTRAHARDKILL then // -7..+7; -8..0
+ begin
g_Obj_Push(@gItems[id].Obj, (FObj.Vel.X div 2)-7+Random(15),
- (FObj.Vel.Y div 2)-Random(9))
+ (FObj.Vel.Y div 2)-Random(9));
+ gItems[id].positionChanged(); // this updates spatial accelerators
+ end
else
+ begin
if KillType = K_HARDKILL then // -5..+5; -5..0
+ begin
g_Obj_Push(@gItems[id].Obj, (FObj.Vel.X div 2)-5+Random(11),
- (FObj.Vel.Y div 2)-Random(6))
+ (FObj.Vel.Y div 2)-Random(6));
+ end
else // -3..+3; -3..0
+ begin
g_Obj_Push(@gItems[id].Obj, (FObj.Vel.X div 2)-3+Random(7),
(FObj.Vel.Y div 2)-Random(4));
+ end;
+ gItems[id].positionChanged(); // this updates spatial accelerators
+ end;
if g_Game_IsNet and g_Game_IsServer then
MH_SEND_ItemSpawn(True, id);
b := Abs(FObj.Vel.X);
if b > 1 then b := b * (Random(8 div b) + 1);
for a := 0 to High(gGibs) do
+ begin
if gGibs[a].Live and
g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
+ begin
// Ïèíàåì êóñêè
if FObj.Vel.X < 0 then
+ begin
g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120) // íàëåâî
+ end
else
+ begin
g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // íàïðàâî
+ end;
+ gGibs[a].positionChanged(); // this updates spatial accelerators
+ end;
+ end;
end;
SetAction(A_WALK);
end;
if FPhysics then
+ begin
g_Obj_Move(@FObj, True, True, True);
+ positionChanged(); // this updates spatial accelerators
+ end;
Exit;
end;
end;
if FPhysics then
- g_Obj_Move(@FObj, True, True, True)
+ begin
+ g_Obj_Move(@FObj, True, True, True);
+ positionChanged(); // this updates spatial accelerators
+ end
else
begin
FObj.Vel.X := 0;
Count := FLAG_TIME;
g_Obj_Push(@Obj, (FObj.Vel.X div 2)-2+Random(5),
(FObj.Vel.Y div 2)-2+Random(5));
+ positionChanged(); // this updates spatial accelerators
if FFlag = FLAG_RED then
s := _lc[I_PLAYER_FLAG_RED]
inherited;
end;
+procedure TCorpse.positionChanged (); begin end;
+
procedure TCorpse.Damage(Value: Word; vx, vy: Integer);
var
pm: TPlayerModel;
if gTime mod (GAME_TICK*2) <> 0 then
begin
g_Obj_Move(@FObj, True, True, True);
-
+ positionChanged(); // this updates spatial accelerators
Exit;
end;
FObj.Vel.X := z_dec(FObj.Vel.X, 1);
st := g_Obj_Move(@FObj, True, True, True);
+ positionChanged(); // this updates spatial accelerators
if WordBool(st and MOVE_FALLOUT) then
begin