summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d3ce22f)
raw | patch | inline | side by side (parent: d3ce22f)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 2 Sep 2017 00:08:14 +0000 (03:08 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 2 Sep 2017 00:40:11 +0000 (03:40 +0300) |
src/game/g_map.pas | patch | blob | history | |
src/game/g_triggers.pas | patch | blob | history |
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 00f39a188463600e838906f1726e382dbf102801..642beaade9c2576106db385248eef6d277819d09 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
FLAG_SIGNATURE = $47414C46; // 'FLAG'
-{
-type
- THashIntPanel = specialize THashBase<Integer, TPanel>;
-
-function hashNewIntPanel (): THashIntPanel;
-begin
- result := THashIntPanel.Create(hiihash, hiiequ);
-end;
-}
-
-
var
- //panByGUID: THashIntPanel = nil;
panByGUID: array of TPanel = nil;
- //panLastGUID: Integer = 0;
// ////////////////////////////////////////////////////////////////////////// //
PanelArray := nil;
end;
-function CreatePanel(PanelRec: TDynRecord; AddTextures: TAddTextureArray;
- CurTex: Integer; sav: Boolean): Integer;
+function CreatePanel (PanelRec: TDynRecord; AddTextures: TAddTextureArray; CurTex: Integer; sav: Boolean): Integer;
var
len: Integer;
panels: ^TPanelArray;
len := Length(panels^);
SetLength(panels^, len+1);
- //Inc(panLastGUID);
pguid := Length(panByGUID);
SetLength(panByGUID, pguid+1); //FIXME!
pan := TPanel.Create(PanelRec, AddTextures, CurTex, Textures, pguid);
+ assert(pguid >= 0);
+ assert(pguid < Length(panByGUID));
+ panByGUID[pguid] := pan;
panels^[len] := pan;
pan.arrIdx := len;
pan.proxyId := -1;
pan.tag := panelTypeToTag(PanelRec.PanelType);
if sav then pan.SaveIt := True;
- PanelRec.user['panel_guid'] := pan.guid;
- //panByGUID.put(pan.guid, pan);
+ PanelRec.user['panel_guid'] := pguid;
- result := len;
+ //result := len;
+ result := pguid;
end;
gCurrentMap.Free();
gCurrentMap := nil;
- //panByGUID.Free();
- //panByGUID := hashNewIntPanel();
- //panLastGUID := 0;
panByGUID := nil;
Result := False;
//e_LogWritefln('PANADD: pannum=%s', [pannum]);
- // Ñîçäàåì ïàíåëü è çàïîìèíàåì åå íîìåð
+ // Ñîçäàåì ïàíåëü è çàïîìèíàåì åå GUID
PanelID := CreatePanel(rec, AddTextures, CurTex, trigRef);
- //e_LogWritefln('panel #%s of type %s got id #%s', [pannum, rec.PanelType, PanelID]);
- // set 'gamePanelId' field to panel id
+ //e_LogWritefln('panel #%s of type %s got guid #%s', [pannum, rec.PanelType, PanelID]);
rec.userPanelId := PanelID; // remember game panel id, we'll fix triggers later
// setup lifts
BadTextNameHash := nil;
end;
- //panByGUID.Free();
- //panByGUID := nil;
- //panLastGUID := 0;
panByGUID := nil;
FreePanelArray(gWalls);
if gGameSettings.GameMode = GM_CTF then
begin
for a := FLAG_RED to FLAG_BLUE do
+ begin
if not (gFlags[a].State in [FLAG_STATE_NONE, FLAG_STATE_CAPTURED]) then
+ begin
with gFlags[a] do
begin
- if gFlags[a].Animation <> nil then
- gFlags[a].Animation.Update();
+ if gFlags[a].Animation <> nil then gFlags[a].Animation.Update();
m := g_Obj_Move(@Obj, True, True);
- if gTime mod (GAME_TICK*2) <> 0 then
- Continue;
+ if gTime mod (GAME_TICK*2) <> 0 then Continue;
- // Ñîïðîòèâëåíèå âîçäóõà:
+ // Ñîïðîòèâëåíèå âîçäóõà
Obj.Vel.X := z_dec(Obj.Vel.X, 1);
- // Òàéìàóò ïîòåðÿííîãî ôëàãà, ëèáî îí âûïàë çà êàðòó:
+ // Òàéìàóò ïîòåðÿííîãî ôëàãà, ëèáî îí âûïàë çà êàðòó
if ((Count = 0) or ByteBool(m and MOVE_FALLOUT)) and g_Game_IsServer then
begin
g_Map_ResetFlag(a);
Continue;
end;
- if Count > 0 then
- Count := Count - 1;
+ if Count > 0 then Count -= 1;
- // Èãðîê áåðåò ôëàã:
+ // Èãðîê áåðåò ôëàã
if gPlayers <> nil then
begin
j := Random(Length(gPlayers)) - 1;
-
for d := 0 to High(gPlayers) do
begin
Inc(j);
- if j > High(gPlayers) then
- j := 0;
-
+ if j > High(gPlayers) then j := 0;
if gPlayers[j] <> nil then
- if gPlayers[j].Live and
- g_Obj_Collide(@Obj, @gPlayers[j].Obj) then
+ begin
+ if gPlayers[j].Live and g_Obj_Collide(@Obj, @gPlayers[j].Obj) then
begin
- if gPlayers[j].GetFlag(a) then
- Break;
+ if gPlayers[j].GetFlag(a) then Break;
end;
+ end;
end;
end;
end;
+ end;
+ end;
end;
end;
index 437d1f6462c98f8c1c9973dfd3c099c5a4d906cf..1b52a64a1d25d68d0776d4062df24daf61d04517 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
procedure g_Triggers_SaveState(var Mem: TBinMemoryWriter);
procedure g_Triggers_LoadState(var Mem: TBinMemoryReader);
-function tr_Message(MKind: Integer; MText: string; MSendTo: Integer; MTime: Integer; ActivateUID: Integer): Boolean;
-
-{
-function tr_CloseDoor (PanelGUID: Integer; NoSound: Boolean; d2d: Boolean): Boolean;
-function tr_OpenDoor (PanelGUID: Integer; NoSound: Boolean; d2d: Boolean): Boolean;
-procedure tr_CloseTrap (PanelGUID: Integer; NoSound: Boolean; d2d: Boolean);
-function tr_SetLift (PanelGUID: Integer; d: Integer; NoSound: Boolean; d2d: Boolean): Boolean;
-
-function tr_Teleport (ActivateUID: Integer; TX, TY: Integer; TDir: Integer; Silent: Boolean; D2D: Boolean): Boolean;
-function tr_Push (ActivateUID: Integer; VX, VY: Integer; ResetVel: Boolean): Boolean;
-
-procedure tr_MakeEffect (X, Y, VX, VY: Integer; T, ST, CR, CG, CB: Byte; Silent, Send: Boolean);
-function tr_SpawnShot (ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Boolean; ShotTarget: Word): Integer;
-}
var
gTriggerClientID: Integer = 0;
gSecretsCount: Integer = 0;
gMonstersSpawned: array of LongInt = nil;
+
implementation
uses
begin
pan := g_Map_PanelByGUID(PanelGUID);
+ {
+ if (pan = nil) then
+ begin
+ e_LogWritefln('tr_CloseTrap: pguid=%s; NO PANEL!', [PanelGUID], MSG_WARNING);
+ end
+ else
+ begin
+ e_LogWritefln('tr_CloseTrap: pguid=%s; isGWall=%s; arrIdx=%s', [PanelGUID, pan.isGWall, pan.arrIdx]);
+ end;
+ }
if (pan = nil) or not pan.isGWall then exit; //!FIXME!TRIGANY!
PanelID := pan.arrIdx;