hello everyone, new to the forums.
i was wondering if i could get some help for doing something that seems simple enough, yet it also seems like something i won't be able to figure out by myself this year.
let me begin by saying that while i'm familiar with coding in C and C#,
(i have done stuff from simple command line applications to graphical interfaces to 2d finite state machine engines to VERY crude attempts at my own 3d engines)
this is something i'm not great at, reverse engineering other people's work (im guessing john carmack's) and it's even worse if they're in C++. i know the basic differences and what classes are, but i'm not exactly in my comfort zone if you guys know what i mean. it's been years since i was actually involved with any code, and though i wouldn't be too worried if i was working in my own stuff writing everything from scratch, this is a whole different beast but i believe i can do it if i can get you to point me in the right direction. (after all i always heard Q2 is C++ code written in a very C fashion)
ok so on to the problem i have:
i want to be able to change the quake2 so it will be able to load lightmaps as a .TGA file from the hard drive, like in quake3>
instead of looking them up inside the BSP file itself (the playable map)
i don't have any worries about the targa image format since i'm using KMquake2 port's source code instead of the old vanilla q2, so it should know what targa is, my problem is that i just can't find the line where quake2 actually loads the lightmap off the BSP file.
while looking around on the net and other idtech games i found a line in the game enemy territory, inside bsp.c that loads the lightmap off the disc:
Code:
=============== |
R_LoadLightmaps |
|
=============== |
|
// ydnar: clear lightmaps first |
tr.numLightmaps = tr.maxLightmaps = 0; |
tr.lightmaps = NULL; |
|
// get number of external lightmaps |
if (tr.worldDir) { |
ri.FS_ListFiles(tr.worldDir, ".tga", &numExternalLightmaps); |
} |
|
if im thinking correctly i just need to incorporate those bits onto quake2 so it can load the lightmaps off the disc,
i dont even need to generate the lightmaps myself since i'm using the quake3 compiler to recompile my maps and throwing the -external switch so the lightmaps get baked into a tga, then i just use old quake2 bsp format but hopefully with an externally loaded tga lightmap that i got from q3map2?
so in theory i wouldn't need to mess with the codes that lump the triangles and makes an array so they can be "uv mapped" as it were..
if i have the right idea i should be looking in KMQ2's lightmap.c or draw.c or surface.c, but i have no clue which, since they all reference lightmaps and none of them seem to have a lightmap loading routine, or i just cant find it.
how would i even go about doing such a thing? im at a loss, i thank you for taking the time to help out a C++ newb!
much appreciated!!!