PDA

View Full Version : Delphi internal error



Wizard
01-12-2006, 09:57 AM
What is internal error PRO-2688?

My game is written in Delphi 6 and DelphiX, it works fine but it freezes and the above error is the only information I get.

What is this error and how can it be resolved?

savage
01-12-2006, 11:01 AM
Are you doing anything with critical sections? I saw a thing on Google about setting breakpoints inside critical sections.

Smotsholle
01-12-2006, 11:06 AM
The whole internet has never heard of this problem, I've been google-ing, but all I found were other Pro-errors.

You sure you typed in the right number? Either that or you've found an error listed nowhere.

Wizard
01-12-2006, 11:24 AM
Nope, no critical sections...and the error number is correct. I've also searched the internet and could'nt find it.

Some of my code:


//This is the player class
TPlayer = class(TImageSprite)
private
Fired: Integer; //This variable determines how many bullets have been fired, you can only fire 5 bullets a second.
public
procedure DoMove(MoveCount: Integer); override;
end;

//This is the Bomb class
TBomb = class(TImageSprite)
public
procedure DoMove(MoveCount: Integer); override;
procedure DoCollision(Sprite: TSprite; var Done: Boolean);override;
end;

function TForm1.NewPlayer;
begin
Player_No := Player_No + 1;
with TPlayer.Create(DXSpriteEngine1.Engine) do
begin
Player.Image := Form1.DXImageList1.Items.Find('Player');
Player.X := 500;
Player.Y := 710;
Player.Width := Player.Image.Width;
Player.Height := Player.Image.Height;
Result := True;
Lives:= Lives -1;
end;
end;

procedure TForm1.GameEnd;
begin
If Player_No >2 then
with DXDraw1.Surface.Canvas do
begin
DXTimer1.Enabled := False;
Timer1.Enabled := False;
DXWaveList1.Items.Find('Tada').Play(False);
Font.Size := 26;
Font.Color := clYellow;
DXDraw1.Surface.Fill(0);
TextOut(290,220,'GAME OVER,YOU LOST :)');
TextOut(290,270,'PRESS ESCAPE KEY AND TRY AGAIN');
end;
end;

procedure TPlayer.DoMove(MoveCount: Integer);
var
MyX: Double;
MyY : Double;
begin
If moveLeft and
(x>5) then
X := X - 10;

If moveright and
((X+Form1.DXImageList1.Items.Find('Player').Width)<Form1>5) then
Y := Y - 10;

if Movedown and
(y<form1.DXDraw1.Height-65)then
Y:= Y + 10;

MyX := X;
MyY := y;

//Check whether button1 is pressed (SPACEBAR)
If isButton1 in Form1.DXInput1.States Then
begin
if Fired <= 3 then
begin
Inc(Fired);
with TBullet.Create(Form1.DXSpriteEngine1.Engine) do
begin
Image := Form1.DXImageList1.Items.Find('Bullet');
Form1.DXWaveList1.Items.Find('Fire').Play(False);
X := MyX + 30; //Set it's X pos to our current X pos
Y := MyY; //Set it's Y pos to our current Y pos
Width := Image.Width; //Set it's size
Height := Image.Height;
end;
end;
end;
end;


procedure TBomb.DoMove(MoveCount: integer);
begin

Y := Y + 25;
Collision;
if (Y >= Form1.DXDraw1.Height +20) Then
Dead;
end;


procedure TBomb.DoCollision(Sprite: TSprite; var Done: Boolean);
begin
If (Sprite is TPlayer) Then
begin
Sprite.Collisioned := False;
Sprite.Dead; //Kill the Sprite
Form1.DXWaveList1.Items.Find('hit').Play(False);
Player.Dead;
Done := False;
end;
end;


Called in DXTimer:
if (player.Deaded) and (Player_No <= 2) then
NewPlayer;
GameEnd;


I suspect that it might have to do with the bomb collision, the freeze happens when the bomb hits my player...funny thing is that it works as it should some times and not other times.

EDITED - to include pascal BB tag.

savage
01-12-2006, 11:30 AM
I edited you post for better legibility.

Should you be calling "Collision;" inside the DoMove method of your Bomb? Won't the Collision code be called at some other point in your game loop?

Wizard
01-12-2006, 11:41 AM
Thanks for your feedback :-)

I'm not sure, the collision is called in the doMove method in the example that game with DelphiX. It's supposed to check for collisions and if it is found then the doCollision method will be executed.

Where do you think it should be?

Sascha Willems
01-12-2006, 11:54 AM
When you get internal errors it has rarely to do with your sources themselves, but more often with the IDE having problems with something (maybe a defect file or such).

But the first stop for those errors is Borland's quality central (http://qc.borland.com) where users report prolbems and bugs with Borladn's IDEs and where Borland also tells what to do and how to fix them (for internal errors it's often a patch to a newer version).

Have you updated your Delphi 6? If I remember correct then there are 2 or more service packs for D6. If nothing of that helps, create a new empty project and drop your current source into it and see if that works.

savage
01-12-2006, 01:23 PM
I have not used DelphiX for generations, so I may be wrong here, but Collision should be called whereever all the collision calculations are done.

ie..

while GameLoop do
MoveObjects; // In here all the DoMove methods are called
CheckCollisions; // In here all the DoCollision methods are called
RenderObjects; // In here all the Draw methods are called.
end;


You'll probably have a way to handling enemy AI as well in there.