|
Intro to Verge 2.5
Verge 2.5 can be daunting at first, because of the many changes it brings. I'm writing this article to ease the porting process.
When you first unzip V2K, the first thing you should do (AFTER reading the README!) is copy dos4gw.exe into your Windows folder (or any other folder in your PATH), then delete the original. If you don't do this, when you try to run Verge or compile you'll get a Dos4gw error. No idea why it does this, but when it's in your windows folder Verge can find it easily, so it's no longer a problem.
Next, you'll need to create a new function, Autoexec(), in system.vc. Instead of starting on a map, V2 now starts at that function. This way you can easily initialize any images, sounds, fonts, etc; at the beginning before your game begins. You would then use the Map(); command to go to the starting map from there. Of course, for us coder types, this also means that you can make a game without maps now! ^_^
Now I'll bet you want to know about the hicolor aspect of V2! Unfortunately, there's good news and bad news. I'll start with the bad to get it out of the way: V2 doesn't yet support 16 bit VSPs or CHRs. That's gonna be in a later version (keep in mind this is really still a beta version). You can only use 16/24 bit images, and all the drawing functions, in hicolor.
There also seems to be a bug in the VESA 2 code, where some video cards won't show the colors properly. This should be fixed in a future version, other than that 16 bit color works as it should. If you're getting funky colors, you can also try using Scitech Display Doctor, that may fix it for you.
Now on to the good stuff! To access hicolor, simply put hicolor in user.cfg somewhere. Otherwise V2 will start in 8-bit color as normal.
Here's the biggest thing you need remember: V2 16 bit no longer has a palette! This means that functions such as PaletteMorph() no longer work! With no palette, instead of passing palette indexes like in 8 bit, you pass the color directly. This is done with the new RGB function. It basically compresses each of the three colors into a single number which represents the combination of the three. For example, say I wanted to store the color red in a variable. I would do this:
int red;
red = RGB(255, 0, 0);
And then use the drawing commands as normal, passing Red instead of the palette index, or using the RGB() color directly.
Here's an important thing for all those people who use Malloc() to store images: because of the 16 bit color, each pixel takes up TWO bytes! Which means it takes twice as much memory. To take this into account, multiply the dimensions you're using by 2. For example, to store a 320x240 image, you would use this:
buffer=Malloc(320 * 240 * 2);
There are a few new things that aren't mentioned in the readme. The mouse system is fixed, and you can also directly write to the mx/my variables now. Entity.isob and entity.canob were also added, corresponding to if the entity is an obstruction and can be obstructed. And of course, the ChangeChr function, which changes an entity's chr file (more details are in the undocumented functions article).
Finally, don't forget to VCC all when you're done! (BTW, don't mind the 0 lines compiled part... that's just another fact of it being beta software ;)
I believe that's all, if you still have questions/problems e-mail me at the link below or come to #vchelp on Espernet.
|