summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 43b93cd)
raw | patch | inline | side by side (parent: 43b93cd)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 19 Aug 2017 13:58:31 +0000 (16:58 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 19 Aug 2017 19:17:13 +0000 (22:17 +0300) |
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index 9e6e2e0860e309c5b305634d542657c9883ac68e..e35fd3399dd7e8eb2dd83773b7ffbab1ccee11b1 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
SpawnTrigger: Integer;
Obj: TObj;
Animation: TAnimation;
+
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
end;
procedure g_Items_LoadData();
if Fall then
begin
m := g_Obj_Move(@Obj, True, True);
+ positionChanged(); // this updates spatial accelerators
// Ñîïðîòèâëåíèå âîçäóõà:
if gTime mod (GAME_TICK*2) = 0 then
Obj.Vel.Y := 0;
Obj.Accel.X := 0;
Obj.Accel.Y := 0;
+ positionChanged(); // this updates spatial accelerators
Live := True;
end;
end;
+
+procedure TItem.positionChanged ();
+begin
+end;
+
end.
index 57e3ce96c800185c10684cacf6aac3d6ebaf0473..0d8f3841d1eab4f1127def30e016d7eabdd7852b 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
procedure CatchFire(Attacker: Word);
procedure OnFireFlame(Times: DWORD = 1);
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
+
property MonsterType: Byte read FMonsterType;
property MonsterHealth: Integer read FHealth write FHealth;
property MonsterAmmo: Integer read FAmmo write FAmmo;
FState := STATE_SLEEP;
FCurAnim := ANIM_SLEEP;
+ positionChanged(); // this updates spatial accelerators
+
if g_Game_IsNet and g_Game_IsServer then
begin
MH_SEND_MonsterPos(FUID);
c, True, False);
g_Obj_Push(@gItems[it].Obj, (FObj.Vel.X div 2)-3+Random(7),
(FObj.Vel.Y div 2)-Random(4));
+ positionChanged(); // this updates spatial accelerators
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_ItemSpawn(True, it);
end;
if gTime mod (GAME_TICK*2) <> 0 then
begin
g_Obj_Move(@FObj, fall, True, True);
+ positionChanged(); // this updates spatial accelerators
Exit;
end;
// Äâèãàåìñÿ:
st := g_Obj_Move(@FObj, fall, True, True);
+ positionChanged(); // this updates spatial accelerators
// Âûëåòåë çà êàðòó - óäàëÿåì è çàïóñêàåì òðèããåðû:
if WordBool(st and MOVE_FALLOUT) or (FObj.X < -1000) or
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
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120) // íàëåâî
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // íàëåâî
+ end
else
+ begin
g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // íàïðàâî
+ end;
+ positionChanged(); // this updates spatial accelerators
+ end;
+ end;
end;
// Áîññû ìîãóò ïèíàòü òðóïû:
if (FMonsterType in [MONSTER_CYBER, MONSTER_SPIDER, MONSTER_ROBO]) and
if gTime mod (GAME_TICK*2) <> 0 then
begin
g_Obj_Move(@FObj, fall, True, True);
+ positionChanged(); // this updates spatial accelerators
Exit;
end;
// Äâèãàåìñÿ:
st := g_Obj_Move(@FObj, fall, True, True);
+ positionChanged(); // this updates spatial accelerators
// Âûëåòåë çà êàðòó - óäàëÿåì è çàïóñêàåì òðèããåðû:
if WordBool(st and MOVE_FALLOUT) or (FObj.X < -1000) or
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
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120) // íàëåâî
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // íàëåâî
+ end
else
+ begin
g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // íàïðàâî
+ end;
+ positionChanged(); // this updates spatial accelerators
+ end;
+ end;
end;
// Áîññû ìîãóò ïèíàòü òðóïû:
if (FMonsterType in [MONSTER_CYBER, MONSTER_SPIDER, MONSTER_ROBO]) and
end;
end;
+//WARNING! call this after monster position was changed, or coldet will not work right!
+procedure TMonster.positionChanged ();
+begin
+end;
+
end.
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index a0fb6eda640681ee89637144f95dc148f2f0595c..237c9dec3e939dd4148dc572683ef36042eaa833 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
SetHealth(MHealth);
SetState(MState);
+
+ positionChanged(); // this updates spatial accelerators
end;
end;
GameVelX := e_Raw_Read_LongInt(P);
GameVelY := e_Raw_Read_LongInt(P);
GameDirection := TDirection(e_Raw_Read_Byte(P));
+ positionChanged(); // this updates spatial accelerators
end;
end;
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
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 81db80314333fb159b8396ad7bafabf84fa22700..3585ef2b4d136f148003fcc717d9a172bc28f4e6 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
TextureID: DWORD;
Timeout: DWORD;
Stopped: Byte;
+
+ procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
end;
+
var
Shots: array of TShot = nil;
LastShotID: Integer = 0;
SHOT_FLAME_WIDTH = 4;
SHOT_FLAME_HEIGHT = 4;
- SHOT_FLAME_LIFETIME = 180;
+ SHOT_FLAME_LIFETIME = 180;
SHOT_SIGNATURE = $544F4853; // 'SHOT'
Obj.Y+Obj.Rect.Y+(Obj.Rect.Height div 2), X, Y);
g_Obj_PushA(@Obj, Round(15*(rad-m)/rad), _angle);
+ positionChanged(); // this updates spatial accelerators
end;
end;
end;
(ShotType <> WEAPON_FLAMETHROWER);
if Stopped = 0 then
- st := g_Obj_Move(@Obj, False, spl)
+ begin
+ st := g_Obj_Move(@Obj, False, spl);
+ end
else
+ begin
st := 0;
+ end;
+ positionChanged(); // this updates spatial accelerators
if WordBool(st and MOVE_FALLOUT) or (Obj.X < -1000) or
(Obj.X > gMapInfo.Width+1000) or (Obj.Y < -1000) then
end;
end;
+
+procedure TShot.positionChanged (); begin end;
+
+
end.