diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index fe494a8cd539128405cc5b12c4ef78a1ac65f496..d6244b7561687a9bcea64545a8adde9873ef0ccc 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
-{.$DEFINE HAS_COLLIDE_BITMAP}
unit g_gfx;
interface
procedure g_GFX_OnceAnim(X, Y: Integer; Anim: TAnimation; AnimType: Byte = 0);
-procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
+//procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
procedure g_GFX_Update();
procedure g_GFX_Draw();
-{$IF DEFINED(HAS_COLLIDE_BITMAP)}
-var
- gCollideMap: Array of Array of Byte;
-{$ENDIF}
-
-
implementation
uses
STATE_STICK = 2;
var
- Particles: Array of TParticle;
- OnceAnims: Array of TOnceAnim;
+ Particles: array of TParticle;
+ OnceAnims: array of TOnceAnim;
MaxParticles: Integer;
CurrentParticle: Integer;
end;
-procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
{$IF DEFINED(HAS_COLLIDE_BITMAP)}
+procedure g_Mark(x, y, Width, Height: Integer; t: Byte; st: Boolean);
var
yy, y2, xx, x2: Integer;
-{$ENDIF}
begin
-{$IF DEFINED(HAS_COLLIDE_BITMAP)}
if x < 0 then
begin
Width := Width + x;
for xx := x to x2 do
gCollideMap[yy][xx] := gCollideMap[yy][xx] and t;
end;
-{$ENDIF}
end;
+{$ENDIF}
+
-procedure CreateCollideMap();
{$IF DEFINED(HAS_COLLIDE_BITMAP)}
+procedure CreateCollideMap();
var
a: Integer;
-{$ENDIF}
begin
-{$IF DEFINED(HAS_COLLIDE_BITMAP)}
g_Game_SetLoadingText(_lc[I_LOAD_COLLIDE_MAP]+' 1/6', 0, False);
SetLength(gCollideMap, gMapInfo.Height+1);
for a := 0 to High(gCollideMap) do
g_Mark(X, Y, Width, Height, MARK_WALL, True);
end;
end;
-{$ENDIF}
end;
+{$ENDIF}
+
procedure g_GFX_Init();
begin
- CreateCollideMap();
+ //CreateCollideMap();
end;
+
procedure g_GFX_Free();
var
a: Integer;
begin
Particles := nil;
SetLength(Particles, MaxParticles);
+ for a := 0 to High(Particles) do Particles[a].State := STATE_FREE;
CurrentParticle := 0;
if OnceAnims <> nil then
OnceAnims := nil;
end;
-
- {$IF DEFINED(HAS_COLLIDE_BITMAP)}
- gCollideMap := nil;
- {$ENDIF}
end;
procedure CorrectOffsets(id: Integer);
-{$IF not DEFINED(HAS_COLLIDE_BITMAP)}
var
part: PParticle;
-{$ENDIF}
begin
-{$IF DEFINED(HAS_COLLIDE_BITMAP)}
- with Particles[id] do
- begin
- if (X >= 0) and (Y > 0) and
- (Y < Length(gCollideMap)) and (X < Length(gCollideMap[0])) and
- (ByteBool(gCollideMap[Y-1, X] and MARK_BLOCKED)) then
- offsetY := 1 // Ñòåíà ñâåðõó
- else
- offsetY := 0;
-
- if (X > 0) and (Y >= 0) and
- (Y < Length(gCollideMap)) and (X < Length(gCollideMap[0])) and
- (ByteBool(gCollideMap[Y, X-1] and MARK_BLOCKED)) then
- offsetX := 1 // Ñòåíà ñëåâà
- else
- offsetX := 0;
- end;
-{$ELSE}
part := @Particles[id];
part.offsetX := 0;
part.offsetY := 0;
if isBlockedAt(part.X, part.Y-1) then part.offsetY := 1;
// check for left wall
if isBlockedAt(part.X-1, part.Y) then part.offsetX := 1;
-{$ENDIF}
end;
end;
procedure g_GFX_SetMax(Count: Integer);
+var
+ a: Integer;
begin
- if Count > 50000 then
- Count := 50000;
+ if Count > 50000 then Count := 50000;
+ if (Count < 1) then Count := 1;
SetLength(Particles, Count);
+ for a := 0 to High(Particles) do Particles[a].State := STATE_FREE;
MaxParticles := Count;
- if CurrentParticle >= Count then
+ //if CurrentParticle >= Count then
CurrentParticle := 0;
end;