Recent

Author Topic: C-Evo game port to FreePascal/Lazarus...  (Read 27599 times)

Core

  • Newbie
  • Posts: 6
C-Evo game port to FreePascal/Lazarus...
« on: November 11, 2009, 10:06:28 pm »
It's been awhile to get really going, but it's going now!

http://c-evo.org/forum/index.html

C-evo is a very well designed & developed game from Steffen Gerlach that has been programmed in Delphi4.

Once this port is complete, we'll be looking to port to Linux & MacOS.  If anyone would like to lend a hand or somehow be involved let me know. =)

« Last Edit: September 22, 2014, 08:00:16 am by Core »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #1 on: November 15, 2009, 09:15:13 pm »
is it open source project?

while porting, try to get rid of as much WinAPI as possible! This would help making Linux/OSX versions

Core

  • Newbie
  • Posts: 6
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #2 on: November 15, 2009, 09:54:52 pm »
Yes, all Open Source... it is Delphi4 at the moment.  I want anyone to help on this, especially those who love both FP & Delphi.  Once that's ported, will have a different project to port to MacOS & Linux.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #3 on: November 15, 2009, 10:04:54 pm »
is there a link for the sources?

Core

  • Newbie
  • Posts: 6
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #4 on: November 15, 2009, 10:11:58 pm »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #5 on: November 15, 2009, 10:14:53 pm »
sorry! i've just found it.

Core

  • Newbie
  • Posts: 6
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #6 on: November 15, 2009, 10:26:10 pm »
Okay, please note that this is the quite the game, old skool and of commercial quality, it's 1st class and i've been playing it for many years. 

I could not do justice to just say Steffen has put a tremendous amount of thought and time in to its development and still continues to. 

I have only a wish to create a FreePascal port/fork so that it may also become a game on MacOS and many Unixes.  This is a good thing to try and do, even the FreePascal/Lazarus community will see good things from this.  =)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #7 on: November 15, 2009, 11:45:03 pm »
here's the first step. Lazarus compiles the project.
http://havefunsoft.com/fpc/CevoLaz.zip

But if you launch the .exe, it will fail with an exception!
So there're a lot of work to do (and i'm not going to do it)

Some notes about the C-evo project and porting it to Lazarus:

1st) there's guicomponents dir, there additional packages stored for Lazarus.  Install the package first, or you'll have problems opening the project

2nd) the project has been adapted by Lazarus "Delphi to Laz" converter, this make the project uncompilable by delphi due to lazarus units used.

3d) the project itself uses TBitmap.Scanline property a lot!!! all these places has been "closed" by {$ifndef fpc}...{$endif}.
The code must be changed to use Lazarus images.
Search for: "todo:" in the sources.

4th) in some places WinAPI functions were used, like:
ScrollDC, OpenClipboard... they must be replaced, but the proper code.
Search for: "todo:" in the sources.

5th) some ShellExecute(.., 'open','http://...') calls were replaced by OpenURL () calls.

Summary: if points 3 and 4 are fixed, then you'll have c-evo for all 3 platforms: Win, OSX and Linux ;)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #8 on: November 16, 2009, 06:54:05 pm »
3d) the project itself uses TBitmap.Scanline property a lot!!! all these places has been "closed" by {$ifndef fpc}...{$endif}.
The code must be changed to use Lazarus images.
Search for: "todo:" in the sources.

Maybe a hint about what this means would be helpful. In TRasterImage I see this:

    // property ScanLine[Row: Integer]: Pointer; -> Use TLazIntfImage for such things

TLazIntfImage has this:

    function  GetDataLineStart(y: integer): Pointer;// similar to Delphi TBitmap.ScanLine. Only works with byte aligned lines.

So how to get from one to the other? Use CreateIntfImage? The source comments leave much to the imagination.

Thanks.

-Phil

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #9 on: November 16, 2009, 09:04:26 pm »
I wonder what was the reason to remove ScanLines from TBitmap?!
Maybe it would be easier, to restore them?

There're lot of delphi projects using ScanLines.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #10 on: November 16, 2009, 11:27:56 pm »
Scanline did never exist for lazarus, so it never got removed.
I can try to explain, but I guess its explained several times in this forum and on google.

Just try imagine what a scanline means on windows and how to implement the same thing on a remote Xserver.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Wodzu

  • Full Member
  • ***
  • Posts: 171
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #11 on: November 26, 2009, 07:05:14 pm »
Hello Marc.

I would be grateful if you could explain in detail the reason why ScanLine doesn't exists in Lazarus.
I've used a lot of ScanLine in Delphi. I am thinking about porting my graphical application and I am a bit confused by this.
Googling didn't help to much. I've found some info here:

http://forum.lazarus.freepascal.org/index.php?topic=3178.0

but I think it confused me even more ;-)

So, what is the fastest(in terms of performance) and best way to properly implement "scanline" functionality.?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #12 on: November 26, 2009, 07:21:29 pm »
I would be grateful if you could explain in detail the reason why ScanLine doesn't exists in Lazarus.
ScanLines for TBitmap is a bit more, than just raws of pixels in Windows.

http://wiki.freepascal.org/Developing_with_Graphics
Quote
Working with TBitmap

The first thing to remember is that Lazarus is meant to be platform independent, so any methods using Windows API functionality are out of the question. So a method like ScanLine is not supported by Lazarus because it is intended for Device Independant Bitmap and uses functions from the GDI32.dll.

Bear in mind that if you do not specify the height and width of your TBitmap it will have the standard one, which is quite small.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #13 on: November 27, 2009, 04:34:35 pm »
That quote does not answer his question.

I also note this:

"Since ScanLines property has been temporary removed from TBitmap class" (my emphasis)

However, while waiting for ScanLine to be restored, the example given on the wiki page should have enough information for modifying Delphi source that uses ScanLine.

Thanks.

-Phil

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
Re: C-Evo game port to FreePascal/Lazarus underway! =)
« Reply #14 on: November 28, 2009, 07:48:41 pm »
"Since ScanLines property has been temporary removed from TBitmap class" (my emphasis)

Scratch the temporary, it is permanent.

If you know the inner working of a scanline, then you would understand it never will work for a (display) client-server solution like X or for carbon. Both have no notion that a piece of "graphics" memory is changed.

//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018