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

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1366
    • 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: 1366
    • 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

Today at 01:35:05 PM
Et tu rikwad?

Please don't feed the degenerate lies of a sexually-perverted devil-worshipping barking dog like Focalor.
 

RyU

Today at 07:21:23 AM
lol
Been here since 2006


But I don’t mean you personally

By you I meant WE all suck at Q2
I guess I was just trying to be funny …

 
 

Costigan_Q2

October 08, 2024, 06:16:31 PM
Who the fuck are you?

Stop feeding degenerate lies, there are too many liberals and commies in this filthy rotting husk of a gaming community as it is.
 

RyU

October 08, 2024, 06:18:00 AM
whether you want to be a man a woman, a women that wants to be a man, a man that wants to be a woman,
a broom,
a mop,
Or even a horse,
Just know you still suck at Q2 ..  ;)
 

RyU

October 08, 2024, 02:38:09 AM
Some funny shit  :D
 

Costigan_Q2

October 06, 2024, 03:09:02 PM
Members
Total Members: 2921
Latest: provider
Date Registered: March 20, 2024

Members
Total Members: 2922
Latest: Shihan
Date Registered: August 28, 2024

'2921'

'2922'

http://forum.tastyspleen.net/quake/index.php?action=profile;u=####

Nice try.
 

|iR|Focalor

September 26, 2024, 05:49:19 PM
 

|iR|Focalor

September 26, 2024, 05:22:51 PM
No, YOU are the liar, Erica had nothing to do with it. YOU sent pictures to everyone in IRC and YOU propagated the story, no one else.

What suffering are you talking about? Are YOU suffering? Is that why you keep coming here being an asshole posting dumb shit like that? Are you the victim?
 

Costigan_Q2

September 26, 2024, 04:45:01 PM
Okay, we're done here, fuck off.

Show 50 latest
Welcome, Guest. Please login or register.
October 09, 2024, 03:22:24 PM

Login with username, password and session length