summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cf5121)
raw | patch | inline | side by side (parent: 5cf5121)
author | Stas'M <x86corez@gmail.com> | |
Sun, 27 Jan 2019 12:28:01 +0000 (15:28 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sun, 27 Jan 2019 12:28:01 +0000 (15:28 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history | |
src/game/g_panel.pas | patch | blob | history | |
src/game/g_triggers.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 1fdf62b2ab96e5d7cc16ce0880d91f1078732f43..6ba4297d6f5b4c4b8e61f4559fd7deb0e9444cba 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
aY2 := aY + aY2 - 1;
case LiftType of
- 0: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 72, 36, 0);
- 1: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 124, 96, 0);
- 2: e_DrawFillQuad(aX, aY, aX2, aY2, 200, 80, 4, 0);
- 3: e_DrawFillQuad(aX, aY, aX2, aY2, 252, 140, 56, 0);
+ LIFTTYPE_UP: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 72, 36, 0);
+ LIFTTYPE_DOWN: e_DrawFillQuad(aX, aY, aX2, aY2, 116, 124, 96, 0);
+ LIFTTYPE_LEFT: e_DrawFillQuad(aX, aY, aX2, aY2, 200, 80, 4, 0);
+ LIFTTYPE_RIGHT: e_DrawFillQuad(aX, aY, aX2, aY2, 252, 140, 56, 0);
end;
end;
end;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 35e8d46a6078d31326c79dc63af187ad03e74d17..fef17e0bde166a76136071daefde8f9907c31dd9 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
begin
// stop if the lift of the right type
result :=
- ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = 0)) or
- (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = 1)) or
- (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = 2)) or
- (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = 3)));
+ ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = LIFTTYPE_UP)) or
+ (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = LIFTTYPE_DOWN)) or
+ (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = LIFTTYPE_LEFT)) or
+ (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = LIFTTYPE_RIGHT)));
exit;
end;
result := true; // otherwise, stop anyway, 'cause `forEachAtPoint()` is guaranteed to call this only for correct panels
h := High(gLifts);
for a := 0 to h do
- if ((WordBool(PanelType and (PANEL_LIFTUP)) and (gLifts[a].LiftType = 0)) or
- (WordBool(PanelType and (PANEL_LIFTDOWN)) and (gLifts[a].LiftType = 1)) or
- (WordBool(PanelType and (PANEL_LIFTLEFT)) and (gLifts[a].LiftType = 2)) or
- (WordBool(PanelType and (PANEL_LIFTRIGHT)) and (gLifts[a].LiftType = 3))) and
+ if ((WordBool(PanelType and (PANEL_LIFTUP)) and (gLifts[a].LiftType = LIFTTYPE_UP)) or
+ (WordBool(PanelType and (PANEL_LIFTDOWN)) and (gLifts[a].LiftType = LIFTTYPE_DOWN)) or
+ (WordBool(PanelType and (PANEL_LIFTLEFT)) and (gLifts[a].LiftType = LIFTTYPE_LEFT)) or
+ (WordBool(PanelType and (PANEL_LIFTRIGHT)) and (gLifts[a].LiftType = LIFTTYPE_RIGHT))) and
g_Collide(X, Y, Width, Height,
gLifts[a].X, gLifts[a].Y,
gLifts[a].Width, gLifts[a].Height) then
if ((tag and GridTagLift) <> 0) then
begin
result :=
- ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = 0)) or
- (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = 1)) or
- (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = 2)) or
- (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = 3))) {and
+ ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = LIFTTYPE_UP)) or
+ (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = LIFTTYPE_DOWN)) or
+ (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = LIFTTYPE_LEFT)) or
+ (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = LIFTTYPE_RIGHT))) {and
g_Collide(X, Y, Width, Height, pan.X, pan.Y, pan.Width, pan.Height)};
exit;
end;
if ((pan.tag and GridTagLift) <> 0) then
begin
result :=
- ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = 0)) or
- (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = 1)) or
- (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = 2)) or
- (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = 3))) {and
+ ((WordBool(PanelType and PANEL_LIFTUP) and (pan.LiftType = LIFTTYPE_UP)) or
+ (WordBool(PanelType and PANEL_LIFTDOWN) and (pan.LiftType = LIFTTYPE_DOWN)) or
+ (WordBool(PanelType and PANEL_LIFTLEFT) and (pan.LiftType = LIFTTYPE_LEFT)) or
+ (WordBool(PanelType and PANEL_LIFTRIGHT) and (pan.LiftType = LIFTTYPE_RIGHT))) {and
g_Collide(X, Y, Width, Height, pan.X, pan.Y, pan.Width, pan.Height)};
end
else if ((pan.tag and GridTagBlockMon) <> 0) then
//TODO: make separate lift tags, and change tag here
case LiftType of
- 0: g_Mark(X, Y, Width, Height, MARK_LIFTUP);
- 1: g_Mark(X, Y, Width, Height, MARK_LIFTDOWN);
- 2: g_Mark(X, Y, Width, Height, MARK_LIFTLEFT);
- 3: g_Mark(X, Y, Width, Height, MARK_LIFTRIGHT);
+ LIFTTYPE_UP: g_Mark(X, Y, Width, Height, MARK_LIFTUP);
+ LIFTTYPE_DOWN: g_Mark(X, Y, Width, Height, MARK_LIFTDOWN);
+ LIFTTYPE_LEFT: g_Mark(X, Y, Width, Height, MARK_LIFTLEFT);
+ LIFTTYPE_RIGHT: g_Mark(X, Y, Width, Height, MARK_LIFTRIGHT);
end;
//if g_Game_IsServer and g_Game_IsNet then MH_SEND_PanelState(pguid);
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 0268c097b672b950344e3342b9d5e441152ec8ca..bcf0883385f89309450a420e89616af331eadbc7 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
TPanelArray = Array of TPanel;
+const
+ LIFTTYPE_UP = 0;
+ LIFTTYPE_DOWN = 1;
+ LIFTTYPE_LEFT = 2;
+ LIFTTYPE_RIGHT = 3;
+
var
g_dbgpan_mplat_active: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}true{$ENDIF};
g_dbgpan_mplat_step: Boolean = false; // one step, and stop
PanelType := PanelRec.PanelType;
Enabled := True;
Door := False;
- LiftType := 0;
+ LiftType := LIFTTYPE_UP;
hasTexTrigger := False;
case PanelType of
PANEL_OPENDOOR: begin Enabled := False; Door := True; end;
PANEL_CLOSEDOOR: Door := True;
- PANEL_LIFTUP: LiftType := 0; //???
- PANEL_LIFTDOWN: LiftType := 1;
- PANEL_LIFTLEFT: LiftType := 2;
- PANEL_LIFTRIGHT: LiftType := 3;
+ PANEL_LIFTUP: LiftType := LIFTTYPE_UP; //???
+ PANEL_LIFTDOWN: LiftType := LIFTTYPE_DOWN;
+ PANEL_LIFTLEFT: LiftType := LIFTTYPE_LEFT;
+ PANEL_LIFTRIGHT: LiftType := LIFTTYPE_RIGHT;
end;
// Íåâèäèìàÿ:
index 562c941855cf6f6a62e24ab459ee31bd5d976146..9f6df9f5ded1502c244836da3a402ad20c3c76b9 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
if (gLifts[PanelID].PanelType = PANEL_LIFTUP) or (gLifts[PanelID].PanelType = PANEL_LIFTDOWN) then
begin
case d of
- 0: t := 0;
- 1: t := 1;
- else t := IfThen(gLifts[PanelID].LiftType = 1, 0, 1);
+ 0: t := LIFTTYPE_UP;
+ 1: t := LIFTTYPE_DOWN;
+ else t := IfThen(gLifts[PanelID].LiftType = LIFTTYPE_DOWN, LIFTTYPE_UP, LIFTTYPE_DOWN);
end
end
else if (gLifts[PanelID].PanelType = PANEL_LIFTLEFT) or (gLifts[PanelID].PanelType = PANEL_LIFTRIGHT) then
begin
case d of
- 0: t := 2;
- 1: t := 3;
- else t := IfThen(gLifts[PanelID].LiftType = 2, 3, 2);
+ 0: t := LIFTTYPE_LEFT;
+ 1: t := LIFTTYPE_RIGHT;
+ else t := IfThen(gLifts[PanelID].LiftType = LIFTTYPE_LEFT, LIFTTYPE_RIGHT, LIFTTYPE_LEFT);
end;
end;