PDA

View Full Version : DoomToFreepascal 2.1.4



L505
21-05-2007, 12:13 AM
Hello!

I compiled the famous DOOM game with FPC 2.1.4 and it works better now. Had to make minor syntax
modifications to compile it with 2.1.4.
http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=Doom-To-Freepascal
http://z505.com/pascal/games/doom2fpc-2.1.4.zip

Basically much better than the last doomtofreepascal.zip download.
Remember in the last zip file offered years ago, the graphics were distorted? In this latest zip, they are almost crystal clear all the time.

Does anyone have any explanation as to why this game is better with 2.1.4? What bug could have been fixed do you think?

Lars

Jimmy Valavanis
23-05-2007, 09:16 AM
Hi Lars,

I've recently downloaded FPC 2.1.4 and I 've managed to compile the
source.
About the walls/bricks problem it seems to be located in subtraction
operations between LongWord types. I didn't manage to locate
where exactly the problem appears (maybe because I'm not experienced with FPC), but during simultaneous debuging
with Delphi and FPC some calculations with the same numbers give different results!
Example:
in r_segs.pas locate the line:

offsetangle := abs(rw_normalangle - rw_angle1);

replace this with

offsetangle := abs(rw_normalangle - rw_angle1);
{$IFDEF FPC}
PInteger(@offsetangle)^ := abs(PInteger(@offsetangle)^);
{$ENDIF}

Then compile the source with FPC.

Some The rendering problems seems to be corrected!

If you don't use {$IFDEF FPC} / {$ENDIF} directive and
compile the same source with Delphi, the the Delphi EXE runs with rendering problems! Why this happens? Do you have any idea?

Is there a switch option in FPC for overflow checking/behavious in such calculations [i.e. function abs() or subtraction]?

Almindor
26-05-2007, 08:15 AM
You can use the -Cr and -Ci checks (eg: fpc -Cir program.pas) for overflow and range checks.

There are other checks available in the -C switches too.

The difference might be that fpc and delphi do some different thing when different types are operated on. Eg: "int := int + dword"; might behave differently when it overflows for some reason etc.

I know that recently some Delphi behaviors have been "fixed" in {$mode delphi} to be more delphi compatible. The only sure way to find the difference out is to test it on various values. The -Cir should report if an overflow or range error happens (it quits the program, and if you compiled with -gl it will write the code/line number of the error-causing code)

L505
02-06-2007, 08:38 PM
I won't be able to look into it for a while since I'm behind on a few projects. However this is exactly what I hoped would happen with FPC - we would improve the FPC compiler by compiling real world large applications.

BEGIN RANT
This is a real world program rather than silly programs on The Shootout contest pages. I can't believe Jimmy and I are the only ones who've tried compiling Doom and I can't believe how many people haven't played around with the Quake 2 source. FPC will improve only if people compile real world, large, huge source bases - not tiny little unit tests or shootout contests, thank you very much.
END RANT

WILL
03-06-2007, 12:43 AM
Uh... shootout contests? :scratch:

Jimmy Valavanis
05-06-2007, 07:36 AM
Hi,

I've just uploaded the newest version 0.5.232 witch corrects all rendering problems with Free Pascal Compiler!

The problems corrected by changing some lines of code in subtraction operations between LongWord type and calls to the abs() function!

Enjoy!

Download version 0.5.232 (Execurables and source code - ~835KB) (http://w13.easy-share.com/1164447.html)
Download version 0.5.232 (Executables, sources and demo file from shareware version ~2536KB) (http://w13.easy-share.com/1164480.html)

Reiter
15-06-2007, 10:42 AM
Hi there.

Nice projects!

Well, this a bug report or whatever.

L505: Your version seems to start fine but in-game there are still distortions. It seems as if the textures are gliding along the walls when moving. Often there are additional bugs where walls seem partly to disappear and so on. Don't know if you knew about this behaviour.

Jimmy Valavanis: On starting your binary I get the following error messege: "I_Error: W_InitMultipleFiles(): no files found". Same for both, Delphi and FPC version.

Didn't get the time to try compiling it myself yet.

Jimmy Valavanis
19-06-2007, 04:54 AM
You must have in the current directory a valid WAD file (Doom's data file).
You can download the shareware version of Doom using the following link ftp://ftp.ntua.gr/pub/vendors/idgames/idstuff/doom/doom19s.zip

or

http://www.doomworld.com/classicdoom/info/shareware.php

After installation copy the DOOM1.WAD file to the same folder as Doom32.exe (Delphi version) or doom32f.exe (Free Pascal version), or
specify the full pathname using for example
-mainwad c:\downloads\doom1\doom1.wad
command line parameter.


You can also download the executables, the source code and the data file
of shareware version here (~2536KB) (http://w13.easy-share.com/1164480.html).