Archived

This topic is now archived and is closed to further replies.

Sal

Req: some example code

Recommended Posts

Sal    122
Does anyone have any code to load up and display some terrain with the bare minimum of other stuff going on? Basically all I''m trying to do is write an app to load up and display the default level in lstudio -- no BSP, no entities, no chars no particles, no skycube -- just terrain. I followed the high level engine snippets in the manual, and compared to the general outline of simpleland, but all to no avail. It definitely seems like the level is loaded (terrain object is not null), but if I actually call LS_DrawWorld the app crashes without drawing any frames. It would be very nice to have a basic framework for a terrain app and then add things in as I go, perhaps someone has done this before. Any help would be very appreciated, Thanks.

Share this post


Link to post
Share on other sites
_Random_    122
A while ago, I ripped out (almost) all of winutil to suit my existing app "harness" - It would crash in LS_DrawWorld() also because the entity root was always null. The short answer is that there is a call to set the base PR path for the app - this requires not (as you might expect) the results of something like getcwd(), you must append "\exename.exe" to the string - internally, I think the set path function is stripping off the last chunk of the string as you might get from argv[0]... If this is not set, the level doesn''t load any packages (but somethow the terrain comes out ok) And the load level function does not return a failure code. Hope this helps!



Cheers,
Random

Share this post


Link to post
Share on other sites
Sal    122
Thanks for taking a look, I tried changing the path, still no luck though... this is the code I added, maybe I didn''t get the right idea here...

getcwd(path, 256);
workpath = strcat(path, "\\CastleKeep.exe"); //name of game
PR_InitPath(workpath);

and then load the level as usual

PR_GoStartPath ();
chdir ("lvl1");
LS_LoadLevel ();

Is this what you meant?

Share this post


Link to post
Share on other sites
_Random_    122
Yup, except I used a std::string as a temporary in case the getcwd buffer was too small. You must not be seeing what happened to me I just started with the simpleland and started ripping stuff out - thankfully, it''s a pretty small sample. Sorry I couldn''t help!

Cheers,
Random

Share this post


Link to post
Share on other sites
Sal    122
Hey, thanks alot for looking at it anyways. Incidentally I figured out the problem -- apparently you must call InitializeCharacters() whether or not you have any, which in my opinion is kind of goofy.

Share this post


Link to post
Share on other sites