From: Ketmar Dark Date: Thu, 31 Aug 2017 20:17:12 +0000 (+0300) Subject: some triggers are working now X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=ebca2a974a49e96c507d87dcb3c320f5bb104d12;p=d2df-sdl.git some triggers are working now --- diff --git a/src/game/g_map.pas b/src/game/g_map.pas index 1695460..6ae077b 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -1190,7 +1190,7 @@ begin end; end; -procedure CreateTrigger(Trigger: TDynRecord; atpanid, ashotpanid: Integer; fTexturePanel1Type, fTexturePanel2Type: Word); +procedure CreateTrigger(Trigger: TDynRecord; atpanid, atrigpanid: Integer; fTexturePanel1Type, fTexturePanel2Type: Word); var _trigger: TTrigger; begin @@ -1203,14 +1203,15 @@ begin Width := Trigger.Width; Height := Trigger.Height; Enabled := ByteBool(Trigger.Enabled); - TexturePanel := Trigger.TexturePanel; + //TexturePanel := Trigger.TexturePanel; + TexturePanel := atpanid; TexturePanelType := fTexturePanel1Type; ShotPanelType := fTexturePanel2Type; TriggerType := Trigger.TriggerType; ActivateType := Trigger.ActivateType; Keys := Trigger.Keys; - trigPanelId := atpanid; - trigShotPanelId := ashotpanid; + trigPanelId := atrigpanid; + //trigShotPanelId := ashotpanid; //Data.Default := Trigger.DATA; trigData := Trigger.trigRec.clone(); end; @@ -1484,7 +1485,7 @@ var CurTex, ntn: Integer; rec, texrec: TDynRecord; pttit: PTRec; - pannum, trignum, cnt: Integer; + pannum, trignum, cnt, tgpid: Integer; // key: panel index; value: `TriggersTable` index hashTextPan: THashIntInt = nil; hashLiftPan: THashIntInt = nil; @@ -1925,6 +1926,11 @@ begin Inc(trignum); if (TriggersTable[trignum].texPan <> nil) then b := TriggersTable[trignum].texPan.PanelType else b := 0; if (TriggersTable[trignum].shotPan <> nil) then c := TriggersTable[trignum].shotPan.PanelType else c := 0; + tgpid := -1; + if (TriggersTable[trignum].LiftPanelIdx <> -1) then tgpid := TriggersTable[trignum].LiftPanelIdx + else if (TriggersTable[trignum].DoorPanelIdx <> -1) then tgpid := TriggersTable[trignum].DoorPanelIdx + else if (TriggersTable[trignum].ShotPanelIdx <> -1) then tgpid := TriggersTable[trignum].ShotPanelIdx + else tgpid := -1; (* if (rec.TexturePanel <> -1) then begin @@ -1960,7 +1966,7 @@ begin end; *) //e_LogWritefln('creating trigger #%s; texpantype=%s; shotpantype=%s (%d,%d)', [trignum, b, c, TriggersTable[trignum].texPanIdx, TriggersTable[trignum].ShotPanelIdx]); - CreateTrigger(rec, TriggersTable[trignum].texPanIdx, TriggersTable[trignum].ShotPanelIdx, Word(b), Word(c)); + CreateTrigger(rec, TriggersTable[trignum].texPanIdx, tgpid, Word(b), Word(c)); end; end; diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index be680ec..47037fc 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -60,11 +60,13 @@ type ShotAmmoCount: Word; ShotReloadTime: Integer; - trigShotPanelId: Integer; + //trigShotPanelId: Integer; trigPanelId: Integer; //TrigData: TTriggerData; trigData: TDynRecord; // triggerdata; owned by trigger + + property trigShotPanelId: Integer read trigPanelId write trigPanelId; end; function g_Triggers_Create(Trigger: TTrigger): DWORD; @@ -2104,6 +2106,17 @@ begin find_id := FindTrigger(); gTriggers[find_id] := Trigger; + writeln('trigger #', find_id, ': pos=(', Trigger.x, ',', Trigger.y, ')-(', Trigger.width, 'x', Trigger.height, ')', + '; TexturePanel=', Trigger.TexturePanel, + '; TexturePanelType=', Trigger.TexturePanelType, + '; ShotPanelType=', Trigger.ShotPanelType, + '; TriggerType=', Trigger.TriggerType, + '; ActivateType=', Trigger.ActivateType, + '; Keys=', Trigger.Keys, + '; trigPanelId=', Trigger.trigPanelId, + '; trigShotPanelId=', Trigger.trigShotPanelId + ); + with gTriggers[find_id] do begin ID := find_id;