
Quake DeveLS - Porting to MultiModAPI
Author: Logic
Difficulty: Easy
This tutorial here will
show you how to 'port' existing quake2 mods for the MultiMod API project which
allows the creation of 'Plugins'. You'll need the MultiModAPI source too, which
can be downloaded at: http://www.planetquake.com/logic.
First, a little bit about
the Quake2 MultiMod API: This game modification permits concurrent execution of
game modifications that conform to the API. Any number of modules can be copied
to the MultiMod game directory and will execute in conjunction with other game
modifications. Included with the distribution are 5 plugins and the sources for
the plugins.
This tutorial outlines the
steps necessary to get a normal Quake2 mod running with the Plugin API.
Assuming you have already
read the qdevels Faster Blaster tutorial...
Create a new file called
faster.c:
#include "api_prototypes.h"#include "api.h"#include "module.h"#include "module_functions.h" void FAST_WeaponBlaster(edict_t *ent) { static int pause_frames[] = {19, 32, 0}; static int fire_frames[] = {5, 0}; Weapon_Generic (ent, 4, 5, 52, 55, pause_frames, fire_frames,Weapon_Blaster_Fire);}
This changes the pause
frames for the blaster. Now open api_support.c. In function GetModAPI(), find
this text:
/********************************************************************/ /* User-Defined functions here * * This is where author-defined functions are passed back to the * * main game */
And add:
RetVal->Weapon_Blaster = FAST_WeaponBlaster; ToggleMode(Weapon_Blaster, 1);
This tells the main game
that when it starts executing Weapon_Blaster, it should also execute
FAST_WeaponBlaster from your module. ToggleMode(Weapon_Blaster, 1) tells the
main game to stop its execution of Weapon_Blaster after this mod executes,
making this function a replacement for Weapon_Blaster.
Now, in module_functions.h, add:
void FAST_WeaponBlaster(edict_t *);
This allocates an address
for your function, so that it can be returned to the main game. Edit the
Makefile to include faster.c/faster.o to the library. That should do it! 3
lines of code to set up the plugin, and the function itself!
Tutorial by Logic.
|
This site, and all content and graphics
displayed on it, |