News: SMF - Just Installed!
 
Welcome, Guest. Please login or register.
+  AnthraxBio
|-+  Return to Castle Wolfenstein
| |-+  Coding Tutorials
| | |-+  Adding Classes
« previous next »
Pages: [1] Print
Author Topic: Adding Classes  (Read 260 times)
SkreamerVirii
Administrator
Full Member
*****
Posts: 133


View Profile
« on: September 03, 2008, 11:19:39 PM »

In this tutorial Fretn ill show you how to add player classes
this Tutorial is still in the works
but if you read it and do WORd FOR WORD

you will be able to add new classes
So to bve gin open up

g_client.c
==========
find:
-----
int pc = client->sess.playerType;
change it to:
-------------
int pc = mp_playerType.integer;
g_main.c
========
find:
-----
vmCvar_t sv_screenshake;
add following:
--------------
// fretn
vmCvar_t mp_playerType;
find:
-----
{ &g_gameskill, "g_gameskill", "3", CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse },
// done
add following:
--------------
//fretn stuff
{ &mp_playerType, "mp_playerType", "0", CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse },
g_local.h
=========
find:
-----
extern vmCvar_t g_swapteams;
add following:
--------------
// fretn
extern vmCvar_t mp_playerType;
menudef.h
=========
add:
----
#define WM_MYCLASS 5;
ui_main.c
=========
find something like:
--------------------
if ( playerType == 1 )
s = "IamMedic";
else if ( playerType == 2 )
s = "IamEngineer";
else if ( playerType == 3 )
s = "IamLieutenant";
else
s = "IamSoldier";
change to:
----------
if ( playerType == 1 )
s = "IamMedic";
else if ( playerType == 2 )
s = "IamEngineer";
else if ( playerType == 3 )
s = "IamLieutenant";
else if ( playerType == 4 )
s = "IamMyclass";
else
s = "IamSoldier";
find:
-----
if ( playerType == 0 )
classStr = "soldier";
else if ( playerType == 1 )
classStr = "medic";
else if ( playerType == 2 )
classStr = "engineer";
else if ( playerType == 3 )
classStr = "lieutenant";
change to this:
---------------
if ( playerType == 0 )
classStr = "soldier";
else if ( playerType == 1 )
classStr = "medic";
else if ( playerType == 2 )
classStr = "engineer";
else if ( playerType == 3 )
classStr = "lieutenant";
else if ( playerType == 4 )
classStr = "myclass"; // "for in game: you will spawn as an ..."
find:
-----
{ "player_window_soldier", PT_KNIFE | PT_PISTOL | PT_RIFLE | PT_GRENADES },
{ "player_window_medic", PT_KNIFE | PT_PISTOL | PT_MEDKIT },
{ "player_window_engineer", PT_KNIFE | PT_PISTOL | PT_LIGHTONLY | PT_EXPLOSIVES | PT_GRENADES },
{ "player_window_lieutenant", PT_KNIFE | PT_PISTOL | PT_RIFLE | PT_EXPLOSIVES }
change to:
----------
{ "player_window_soldier", PT_KNIFE | PT_PISTOL | PT_RIFLE | PT_GRENADES },
{ "player_window_medic", PT_KNIFE | PT_PISTOL | PT_MEDKIT },
{ "player_window_engineer", PT_KNIFE | PT_PISTOL | PT_LIGHTONLY | PT_EXPLOSIVES | PT_GRENADES },
{ "player_window_lieutenant", PT_KNIFE | PT_PISTOL | PT_RIFLE | PT_EXPLOSIVES },
{ "player_window_fretn", PT_KNIFE | PT_PISTOL | PT_RIFLE | PT_EXPLOSIVES }
find:
-----
WM_setItemPic( "window_classLieutButton", "ui_mp/assets/button.tga" );
add:
----
WM_setItemPic( "window_classmyclassButton", "ui_mp/assets/button.tga" );
find something like:
--------------------
if ( playerType == 0 )
WM_setItemPic( "window_classSoldierButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 1 )
WM_setItemPic( "window_classMedicButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 2 )
WM_setItemPic( "window_classEngrButton", "ui_mp/assets/button_click.tga" );
else WM_setItemPic( "window_classLieutButton", "ui_mp/assets/button_click.tga" );
change to:
----------
if ( playerType == 0 )
WM_setItemPic( "window_classSoldierButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 1 )
WM_setItemPic( "window_classMedicButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 2 )
WM_setItemPic( "window_classEngrButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 3 )
WM_setItemPic( "window_classLieutButton", "ui_mp/assets/button_click.tga" );
else if ( playerType == 4 )
WM_setItemPic( "window_classmyclassButton", "ui_mp/assets/button_click.tga" );

wm_limbo.menu
=============
find: WM_LIEUTENANT
change to: WM_MYCLASS
find: window_classLieutButton
change to: window_classmyclassButton
find: LIEUTENANT
change to: MYCLASS
cg_draw.c
=========
find:
-----
if ( val == 0 )
classType[0] = 'S';
else if ( val == 1 )
classType[0] = 'M';
else if ( val == 2 )
classType[0] = 'E';
else if ( val == 3 )
classType[0] = 'L';
else
classType[0] = 'S';
change to:
----------
if ( val == 0 )
classType[0] = 'S';
else if ( val == 1 )
classType[0] = 'M';
else if ( val == 2 )
classType[0] = 'E';
else if ( val == 3 )
classType[0] = 'L';
else if ( val == 4 )
classType[0] = 'X'; // used in de HUD

else
classType[0] = 'S';
NEXT:
=====
do a search in the files on PC_LT
and add everywhere you find PC_LT : PC_MYCLASS
also for WM_LT and add: WM_MYCLASS
g_client.c
==========
give the myclass dude some weapons
============================================
that's it ... maybe not all the code is in it, but the most important things are inhere
maybe there will be some typfaults in it ... it's made in a hurry ...
launch your mod and enjoy your myclass
fretn
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Free SMF 1.1.5 Forum Theme by Tamuril. © 2008.