Author Topic: Getting started with the Quake 2 source  (Read 30435 times)

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1373
    • View Profile
  • Rated:
Re: Getting started with the Quake 2 source
« Reply #15 on: June 26, 2011, 02:21:02 PM »
Set "Not using precompiled headers". It wasn't properly set in the downloaded project.
Move "game.def" to the Resource Files group.

__declspec ( dllexport ) blah, not sure why you are doing this, it's not portable so you are going to run into trouble when it comes to compiling on Linux.

In Linker | System, set Subsystem: Windows, this is probably why you needed the above.

Add this to the top of q_shared.h: (Note: some pragmas are redundant following what is already set in q_shared.h)
Code: [Select]
#ifdef _WIN32
#pragma warning(disable : 4244) // C4244 conversion from 'type1' to 'type2', possible loss of data
#pragma warning(disable : 4100) // C4100 unreferenced formal parameter
#if _MSC_VER > 1500
#pragma warning(disable : 4996) // disable warnings from VS 2010 about deprecated CRT functions (_CRT_SECURE_NO_WARNINGS).
#endif
#endif

Add this to the top of g_local.h, just before the #include "q_shared.h" line.
Code: [Select]
//QW// Here's where I finally get smart and add some debugging stuff to the game.
// Don't forget to add null definitions for stuff not useable in Linux.
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN //non-MFC
#include <windows.h>
#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
_CrtMemState startup1; // memory diagnostics
#else
#define OutputDebugString //not doing Windows
#endif

Modify the ShutdownGame function in g_main.c to look like this:
Code: [Select]
void ShutdownGame (void)
{
gi.dprintf ("==== ShutdownGame ====\n");
gi.FreeTags (TAG_LEVEL);
gi.FreeTags (TAG_GAME);

#ifdef _WIN32
OutputDebugString("ShutdownGame() was called.\n");
_CrtMemDumpAllObjectsSince(&startup1);
_CrtMemDumpStatistics (&startup1);
_CrtDumpMemoryLeaks();
#endif
}

Now your game will compile clean without warning about the CRT Microsoft-deprecated functions (whos replacements are not portable) and it will report memory leaks it finds when you are debugging in Windows.
« Last Edit: June 26, 2011, 02:23:42 PM by QwazyWabbit »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline uzi9mmauto

  • Newbie
  • *
  • Posts: 4
    • View Profile
  • Rated:
Re: Getting started with the Quake 2 source
« Reply #16 on: June 02, 2013, 08:01:58 PM »
Thought that I'd start a thread for beginners who want to get started with the quake 2 source. For right now I'm going to link to the original source and then include the clean code base later. I'm not as familiar with compiling clean code so once I get time to take a look I'll revise this.
  :oops:
Yeah- the post is 'old' but the topic sure isn't. Many places on the NET refer New Modders to this thread. I had small issue with trying your method BUT managed to compile the .dll!! (However- I had other issues and now I am were I was before) Except this time I went the
LCC route with the Lcchack file. To make a long story shirt- I followed what was mentioned here: http://zeliepa.net/dna/quake2/lcc.htm I did everything mentioned actually several times to the point I was able to do it blindly but I assume NOT correctly.
Here is my video of what kept on happening and the questions I had. 
http://www.youtube.com/watch?v=E3_KYSlqnnA  :rocketright: I was unable to  compile a .DLL  :help:

Offline uzi9mmauto

  • Newbie
  • *
  • Posts: 4
    • View Profile
  • Rated:
Re: Getting started with the Quake 2 source
« Reply #17 on: June 03, 2013, 04:17:00 AM »
Found my post- but not on the Main pages address.
 :dohdohdoh: I emailed the Admin and probably confused BOTH of us.  :exqueezeme:
I have 2 forums I run and I'm just not used to this format??  :sorry:
Ok- I need to eat something and come back AFTER I have some coffee...
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1373
    • View Profile
  • Rated:
Re: Getting started with the Quake 2 source
« Reply #18 on: September 21, 2013, 11:34:07 PM »
Necrotic thread but I watched your video and I never saw you actually compile your project. You created a project and opened the files in the editor but I never saw you run LCC.

The compiler (if it's keeping to its Linux roots) will evaluate the Makefile and use it as a guide to build the project.

In Linux, the command is done from a shell window in your project source folder and the command is simply 'make'. The make progam looks for Makefile and that file tells it what files to use to build the project and what to call it.

As it says in the instructions you were following, the DLL will be located in the source directory where you built it. The gamex86.dll files are always located in the mod folder for their respective mods. When you tell the quake2.exe what mod to run with the +set game mymodname command line the engine will look into the mymodname folder for your DLL, expecting it to be named gamex86.dll, it loads that DLL and that becomes the modification to the game engine and your running your mod.

OK, so I'm a curious guy and I have some time on my hands tonight so I installed LCCWin and copied the Quake2 v3.21 source into the lcc folder in one big chunk since I don't know where your Combat18 mod source is.

OK, I followed it all up to the point of adding the game.def file and since I was using the "working" game.def as-is from my copy of the Q2 sources I left it alone. Later I tried to write GetGameAPI=GetGameAPI into the file but Wedit but it wouldn't make the change. I don't believe it needs to read that way anymore. I believe that was the old VC 6.0 syntax.

Anyway, once you have all your files "loaded" into wedit, you need to build the project.

Click Compiler, Generate Makefile.The system will create the Makefile.
Click Compiler, Rebuild All. The compiler will run scrolling output to a split window in wedit, finally ending in a list of warnings and errors.

Errors will stop the build process. Warnings won't. Double clicking on a warning or error line will take you to the source file where the warning occurred. If you have so much as one error, your dll won't be built, don't look for it. Warnings are permissible and you can deal with them as needed. I am strict about my code, I want it to produce no warnings so I will investigate and fix them.

If you don't see "Return code: 0" at the bottom of the warnings list, you don't have a DLL.

The ultimate question is Where's my DLL? The answer to that question is found in the wedit project configuration.
Click Project, Configuration and then the Linker tab. The output filename you find there is where your DLL will be if there were no errors in the build. I ended up finding it at c:\lcc\Quake2source\game\lcc\gamex86.dll.

I also found all the .obj files in that same folder. The .obj files are built by the compiler from each source file.
« Last Edit: September 21, 2013, 11:45:36 PM by QwazyWabbit »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline dfut

  • Newbie
  • *
  • Posts: 4
    • View Profile
  • Rated:
Re: Getting started with the Quake 2 source
« Reply #19 on: January 24, 2018, 11:14:36 AM »
Amazing tutorial, thank you! :)
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

Costigan_Q2

November 11, 2024, 06:41:06 AM
"Stay cozy folks.

Everything is gonna be fine."

There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.

Show 50 latest
Welcome, Guest. Please login or register.
November 24, 2024, 03:21:03 AM

Login with username, password and session length