JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.03k stars 615 forks source link

Extract common files #313

Open archseer opened 11 years ago

archseer commented 11 years ago

Lots of files appear both in code, codemp and codeJK2. If the files are the same, we should extract them into a common place, so that there is no need to apply the same changes to 3 files... This should be a top priority and done as soon as possible, so we reduce the effort needed to maintain these, and so that we get the files in sync as quickly as possible.

For instance, codemp/client/cl_cin.cpp and code/client/cl_cin.cpp are out of sync, which makes the singleplayer break on x64, whilst the same file has been fixed for multiplayer for 2 months.

ensiform commented 11 years ago

cl_cin.cpp has a lot of stuff thats different in SP than MP so its also harder to try to just merge and be done with it. MP's version is 64-bit and lots of other fixes too. Your cast fix was wrong in there too.

xycaleth commented 11 years ago

For files which are meant to provide identical functionality between SP and MP, this is fine. The difficulty comes when there are files which provide similar functionality, but not identical ones. What do we do in this case? We could factor out the common code in the similar files, and then put them into a third file but this is messy.

I agree something needs to be done about duplicate code, but I don't think it will be as simple as taking one of the files, and saying this is the one that SP and MP should use.

ensiform commented 11 years ago

For like eez wanting to have the shared renderer between the two. There is just so much differences that he doesn't seem to get either. Try running diff on sp and mp's renderer folders.... :D

xycaleth commented 11 years ago

I think the renderers can be merged. They both probably provide some functionality which the other doesn't, and merging them would give the best of both worlds :p It would just be a huge task.

ensiform commented 11 years ago

Right but SP also does things like saving out ghoul2 data etc :|

archseer commented 11 years ago

Ah yes, I didn't go into the cl_cin.cpp code, so that was a bad example.

@ensiform you say my cast was wrong there, yet you don't say what was wrong. I simply made it compilable, and I don't get around the quake source so well, so if you see something I did wrong, go and fix it, it's an open source project after all. You say the MP version is 64bit and fixed, and that's exactly what I want to point out, we want both MP and SP be 64bit and fixed.

For merging, getting an uniform interface for the renderer etc. and just using what's needed in sp and mp would probably be best, however the size of the task may be too large to handle.

ensiform commented 11 years ago

@archSeer https://github.com/Razish/OpenJK/blame/master/codemp/client/cl_cin.cpp#L976