Forge CE: No More Crashing
by, October 13th, 2010 at 06:54 PM (362 Views)
The OpenSauce project I was using for Forge CE was a TRAIN WRECK. I had all my reverse engineering work in this project as well and random stuff was everywhere that was not needed. It wasn't causing the crash, however it feels good to start a clean slate and know where everything is.
I started with a fresh download of OpenSauce and recoded the initial framework today. I reworked a few things so that I only had a few minor edits in original OS files. The D3DXCreateFont bug is fixed with the code reworking, whew! I have gotten a lot of the basic menu system done using TextBlock and using the _menu_globals struct as an outline for my menu key functions. I was just going to create a new instance of menu globals, but the file is inline and it kept saying it wasn't a part of the Menu namespace, plus I wanted to customize the functions more to my own menu's needs instead of just extending the struct.
One of the things I had to change in the original OS files was in the GameUI_Menu.inl file. At line 40, in the GetSelection function, I added a check to see if GetKeyState of the menu selection was equal to 1. Since I added a 'Forge Mode' option to the Yelo menu and always returned true in my AdjustSettings function, Forge Mode would flash on and off when I toggled it in the menu. If you hold a key down, it's state will iterate from 0, all the way to 255 and stay at 255 as long as the key is still being held down and 0 when it is let go. So if the GetKeyState function is checking if ANY number greater than 0 is returning, then my AdjustSettings function is constantly called even if I just quickly TAP the key. Checking if the key state is equal to 1 will guaruntee my AdjustSettings function is only run once per key press.
As well as the menu framework, I added the basic functions to move objects and it works exactly like the gravity gun that Kornman00 had created. It's pretty sick. I have intentions on making Forge in monitor / camera mode only, but it sure is fun carrying objects around in vehicles.
The rest of the night I am going to be working on the menu and hopefully have the Grab Object and Drop Object options done for starters.
Check back tomorrow night for another update!!