Recent

Author Topic: Porting a strategy game from Turbo Pascal  (Read 6889 times)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 917
    • Burdjia
Re: Porting a strategy game from Turbo Pascal
« Reply #15 on: May 07, 2018, 10:24:15 am »
You can make an array of color codes and use it with OpenGL. Something like:
Code: Pascal  [Select]
  1. type
  2.   RGBByte = packed record
  3.     r,g,b: byte
  4.   end;
  5. ...
  6. var colors: array[0..255] of RGBByte;
  7. ...
  8. glColor3bv(@colors[16]); // Would use index color 16 for all next drawings

If you're using OpenGL you should use proper OpenGL data types for the sake of portability (i.e. GLbyte or GLubyte instead of BYTE).  Also glColor3bv receives an array of bytes, so:
Code: Pascal  [Select]
  1. TYPE
  2.   TRGB_Interval = (rgbR, rgbG, rgnB);
  3.   RGBByte = ARRAY [TRGB_Interval] OF GLubyte;
  4. ...
  5. VAR
  6.   Colors: ARRAY [0..255] OF RGBByte;
  7. ...
  8. glColor3bv (@Colors[16]); { Would use index color 16 for all next drawings. }
Just as suggestion.
« Last Edit: May 07, 2018, 10:27:24 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

ZsurzsaLaszlo

  • New Member
  • *
  • Posts: 17
Re: Porting a strategy game from Turbo Pascal
« Reply #16 on: May 10, 2018, 01:16:26 pm »
Hey, I'm back! The colors work like a charm. I wrote a script that transforms the legacy artwork of mine to svg or whatever format I would need. I attach a small teaser image :D

Handoko

  • Hero Member
  • *****
  • Posts: 3158
  • My goal: build my own game engine using Lazarus
Re: Porting a strategy game from Turbo Pascal
« Reply #17 on: May 10, 2018, 01:21:18 pm »
Awesome!
Is that a gold mine?

ZsurzsaLaszlo

  • New Member
  • *
  • Posts: 17
Re: Porting a strategy game from Turbo Pascal
« Reply #18 on: May 10, 2018, 03:10:48 pm »
Yep, exactly. There is some inconsistency, as you see on the picture. In the original there were no brown color, that was also a greyish color. Still have to figure out why my R script turn them to brown :P

Lulu

  • Full Member
  • ***
  • Posts: 112
Re: Porting a strategy game from Turbo Pascal
« Reply #19 on: May 22, 2018, 08:15:54 pm »
good ! I like this kind of game :)
fpc 3.0.4 Lazarus 1.8.0  -  AMD A8-6600K  -  Windows 10  64bits
bad english... sorry :)