Req: some example code
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.
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
Cheers,
Random
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?
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?
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
Cheers,
Random
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement