proquake psp source help
Moderator: InsideQC Admins
16 posts
• Page 1 of 2 • 1, 2
proquake psp source help
hey! ive decided to post this here instead of the proquake forum cuz it's old. Ive really been coming along with quake c and decided to move on to the source code. it's so similar! im finally beginning to understand it! i've successfully manipulated the menus and im trying to take it one step further. if anyone doesn't mind, can they share some knowledge with me?
Im looking to:
changing font
i found this written in menu.c
im guessing where it says * draw_chars is the original font for characters? how do i replace it with a custom one?
2. crosshair
this was in gl_draw.c
I wish to replace the original crosshair with an .lmp file. im guessing it's pretty simple but ive been unsuccessful so far. I also want the crosshairs to change when you are aiming at someone hostile.
3. last one
changing health display to show as a health bar instead
im stuck here. anyone?
THANKS A MILLION
Im looking to:
changing font
i found this written in menu.c
- Code: Select all
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
qpic_t *draw_backtile;
int translate_texture;
int char_texture;
bool tex_scale_down = true;
typedef byte texel;
im guessing where it says * draw_chars is the original font for characters? how do i replace it with a custom one?
2. crosshair
this was in gl_draw.c
- Code: Select all
// gl_draw.c -- this is the only file outside the refresh that touches the vid buffer
#include "quakedef.h"
extern unsigned char d_15to8table[65536];
cvar_t gl_nobind = {"gl_nobind", "0"};
#ifdef DX8QUAKE_GET_GL_MAX_SIZE
int gl_max_size = 1024;
#else
cvar_t gl_max_size = {"gl_max_size", "1024"};
#endif
cvar_t gl_picmip = {"gl_picmip", "0", true};
cvar_t gl_crosshairalpha = {"crosshairalpha", "1", true};
cvar_t gl_texturemode = {"gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", false}; // Let's not save to config
#ifdef SUPPORTS_GL_DELETETEXTURES
cvar_t gl_free_world_textures = {"gl_free_world_textures","1",true};//R00k
#endif
cvar_t crosshaircolor = {"crosshaircolor", "15", true};
cvar_t crosshairsize = {"crosshairsize", "1", true};
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
qpic_t *draw_backtile;
int translate_texture;
int char_texture;
extern cvar_t crosshair, cl_crosshaircentered, cl_crossx, cl_crossy; //, crosshaircolor, crosshairsize;
qpic_t crosshairpic;
typedef struct
{
int texnum;
float sl, tl, sh, th;
} glpic_t;
byte conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)];
qpic_t *conback = (qpic_t *)&conback_buffer;
extern int GL_LoadPicTexture (qpic_t *pic);
extern qboolean VID_Is8bit();
int gl_lightmap_format = 4;
int gl_solid_format = 3;
int gl_alpha_format = 4;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR;
int texels;
#define NUMCROSSHAIRS 5
int crosshairtextures[NUMCROSSHAIRS];
static byte crosshairdata[NUMCROSSHAIRS][64] = {
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff,
0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
I wish to replace the original crosshair with an .lmp file. im guessing it's pretty simple but ive been unsuccessful so far. I also want the crosshairs to change when you are aiming at someone hostile.
3. last one
changing health display to show as a health bar instead
im stuck here. anyone?
THANKS A MILLION
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
Re: proquake psp source help
Changing the character set is done via altering conchars ... I think it is conchars.lmp in gfx folder but it could be in gfx.wad ... on OS X at the moment and there isn't a Pakscape or TexMex for the Mac that I know of so I can't check.
A health bar is easy, you do a Draw_Fill. Open cl_sbar.c (basically the same file as GLQuake sbar.c and look at uses of Draw_Fill).
Crosshairs ... in my opinion, if you are going to be modding on the PSP you must have Kurok mod experience. Load up Kurok on the PSP, do impulse 9 to give yourself all guns and type crosshair 2 in the console and switching to some different guns to see their crosshairs.
Use Pakscape to poke around the Kurok mod game data structure to see the different crosshairs.
Kurok mod homepage: http://www.bladebattles.com/kurok/files.html
ProQuake PSP 4.70 fully supports the Kurok mod.
Some utilities you need to have to do the kind of stuff you want to do: Fimg, Pakscape. You get download those at http://quakeone.com/navigator and click the Resources tab.
A health bar is easy, you do a Draw_Fill. Open cl_sbar.c (basically the same file as GLQuake sbar.c and look at uses of Draw_Fill).
Crosshairs ... in my opinion, if you are going to be modding on the PSP you must have Kurok mod experience. Load up Kurok on the PSP, do impulse 9 to give yourself all guns and type crosshair 2 in the console and switching to some different guns to see their crosshairs.
Use Pakscape to poke around the Kurok mod game data structure to see the different crosshairs.
Kurok mod homepage: http://www.bladebattles.com/kurok/files.html
ProQuake PSP 4.70 fully supports the Kurok mod.
Some utilities you need to have to do the kind of stuff you want to do: Fimg, Pakscape. You get download those at http://quakeone.com/navigator and click the Resources tab.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
i c, but im talking about the very small text. ie when it says "you found a secret area!" and can i add 2 fonts?
so i cant directly say "crosshair == "gfx/cross.lmp" (or something similar?)
so i cant directly say "crosshair == "gfx/cross.lmp" (or something similar?)
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
behind_you wrote:i c, but im talking about the very small text. ie when it says "you found a secret area!" and can i add 2 fonts?
so i cant directly say "crosshair == "gfx/cross.lmp" (or something similar?)
Important!
You need to be looking at the pspgu/video_hardware_*.cpp files.
Those gl_draw.c and such are for the desktop operating systems!
The PSP uses video_hardware_draw.cpp instead of gl_draw.c when the PSP engine compiles.
Check out the PSPGU folder.
2 fonts ... technically possible but I don't think anyone has ever done it. It'd be a pain. What would be more reasonable is to use a different SECOND set.
Quake character set is this setup like this:

Notice how it is basically 2 sets of the same thing. You could modify the second "set" to be a different fixed-width and same-size font. Would require work.
behind_you wrote:so i cant directly say "crosshair == "gfx/cross.lmp" (or something similar?)
Your crosshair stuff ... you can see a sample implementation in the engine code of ProQuake 4.70 where it has Kurok support.
(pspgu folder) video_hardware_draw.cpp --- these .lmp files are customized per weapon crosshairs used by Kurok
if (kurok)
{
// Read the pad state.
SceCtrlData pad;
sceCtrlPeekBufferPositive(&pad, 1);
if (crosshair.value >= 2)
{
if (cl.stats[STAT_ACTIVEWEAPON] == KIT_AXE) // Knife
pic = Draw_CachePic ("gfx/ch_axe.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == KIT_TEKBOW) // Tekbow
pic = Draw_CachePic ("gfx/ch_tekbo.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_SHOTGUN) // Pistol
pic = Draw_CachePic ("gfx/ch_sgun.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_SUPER_SHOTGUN) // Shotgun
pic = Draw_CachePic ("gfx/ch_ssgun.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_NAILGUN) // Assualt rifle
pic = Draw_CachePic ("gfx/ch_ngun.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == KIT_UZI) // Uzi
pic = Draw_CachePic ("gfx/ch_uzi.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == KIT_M99) // Sniper rifle
pic = Draw_CachePic ("gfx/ch_snip.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_SUPER_NAILGUN) // Minigun
pic = Draw_CachePic ("gfx/ch_sngun.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_GRENADE_LAUNCHER) // Grenade launcher
pic = Draw_CachePic ("gfx/ch_gl.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_ROCKET_LAUNCHER) // Rocket launcher
pic = Draw_CachePic ("gfx/ch_rl.lmp");
else if (cl.stats[STAT_ACTIVEWEAPON] == IT_LIGHTNING) // Remote Mines
pic = Draw_CachePic ("gfx/ch_light.lmp");
else
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
ok. can i do that same kurok cross hair thing, but in quake? I really want it in quake because kurok is more painful for me
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
Sweet! I got it! thanks so much!
now,
where do i find that image file of all the characters?
and how do i make it so that when you aim at a hostile entity, the crosshairs change?
and
is that image file for the small text quake uses?
ps thanks a million!
now,
where do i find that image file of all the characters?
and how do i make it so that when you aim at a hostile entity, the crosshairs change?
and
is that image file for the small text quake uses?
ps thanks a million!
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
behind_you wrote:Sweet! I got it! thanks so much!
now,
where do i find that image file of all the characters?
Open up gfx.wad with Adqedit and extract or edit the conchars. Gfx.wad is usually hiding in pak0.pak so you'd need Pakscape.
See that quakeone.com/navigator to find various tools like above. You might be able to Fimg somehow too (haven't done much native original Quake 2D gfx files modding lately, so can't remember).
and how do i make it so that when you aim at a hostile entity, the crosshairs change?
You would probably need to delve into QuakeC and do a stuffcmd or some such "hack" to tell the engine to change the crosshair. I'm not really Mr. QuakeC so you'd need to ask in the QuakeC section.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
oh. i never sought to checkout that gfx.wad file. thanks for pointing that out!!!!
SO... anyone else know how i can change the crosshairs when im aiming at an enemy?
SO... anyone else know how i can change the crosshairs when im aiming at an enemy?
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
what you're going to want to do in QuakeC is make a traceline (infinite or distance of your choice) coming from the player every frame. and have it check to see if the trace.ent.classname (i think thats right) is a classname of your enemy or enemies. Have that stuffcmd a new cvar you will make in the engine to be true, and for your crosshair, have if (new cvar == true) have your alternative crosshair show up. else your normal one.
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
Here is a code I wrote to change the colors of the Crosshairs:
And in PlayerPreThink:
I coded the red crosshairs as a cvar in the engine
- Code: Select all
void() CH_Red =
{
local vector src, dir;
dir = aim (self, 100000);
makevectors(self.v_angle);
src = self.origin + v_forward*10;
src_z = self.absmin_z + self.size_z * 0.7;
if (self.weapon == SHOTGUN)
traceline (src, src + dir*100, FALSE, self);
else if (self.weapon == PISTOL)
traceline (src, src + dir*1500, FALSE, self);
else if (self.weapon == BATTLERIFLE)
traceline (src, src + dir*1500, FALSE, self);
else if (self.weapon == CARBINE)
traceline (src, src + dir*1500, FALSE, self);
else if (self.weapon == SMG)
traceline (src, src + dir*400, FALSE, self);
else if (self.weapon == ASSAULT_RIFLE)
traceline (src, src + dir*550, FALSE, self);
else if (self.weapon == ROCKET_LAUNCHER)
traceline (src, src + dir*800, FALSE, self);
else if (self.weapon == PLASMA_PISTOL)
traceline (src, src + dir*500, FALSE, self);
else if (self.weapon == PLASMA_REPEATER)
traceline (src, src + dir*500, FALSE, self);
else
traceline (src, src + dir*300, FALSE, self);
puff_org = trace_endpos - dir*4;
if (trace_ent.takedamage)
{
if (trace_ent.team != self.team) //Mexicouger: Don't target team mates
stuffcmd (self, "cl_ch_red 1\n");
}
else if (!trace_ent.takedamage)
stuffcmd (self, "cl_ch_red 0\n");
crosshair_time = time + 0.1;
};
And in PlayerPreThink:
- Code: Select all
if (self.ishuman == TRUE)
if (crosshair_time < time)
CH_Red();
I coded the red crosshairs as a cvar in the engine
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
wow, ill try that out!
btw is there a way to make the crosshair change lmp? also i wanna make it flicker between the lmps when im targeting someone.
btw is there a way to make the crosshair change lmp? also i wanna make it flicker between the lmps when im targeting someone.
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
you can in the Engine in the Crosshair Code.
Just create a new Cvar, and toggle the cvar using that Red crosshair Code.
In the crosshair code in the engine, just go
if ((int)red_crosshair.value == 1)
*draw a red lmp*
else
*draw the regular crosshair*
Then in the QC, just send out a traceline, and if it hits something that takes damage, toggle the red_crosshair cvar to 1, and if the traceline doesn't hit something, then make it 0.
Just create a new Cvar, and toggle the cvar using that Red crosshair Code.
In the crosshair code in the engine, just go
if ((int)red_crosshair.value == 1)
*draw a red lmp*
else
*draw the regular crosshair*
Then in the QC, just send out a traceline, and if it hits something that takes damage, toggle the red_crosshair cvar to 1, and if the traceline doesn't hit something, then make it 0.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
alrit. im gonna head home nd i dnt have internet at home. so b4 i leave, can you tell me how i create a traceline and cvar? ive tried and failed at it...
-

behind_you - Posts: 237
- Joined: Sat Feb 05, 2011 6:57 am
- Location: Tripoli, Libya
// Find the crosshair cvar in the source, put this below it.
cvar_t r_red_crosshair= {"red_crosshair", "0"};
// Find where it registers the crosshair cvar in the engine source
// Put this below it
Cvar_RegisterVariable (&red_crosshair, NULL);
Or find the appropriate places in cl_view.c and put them in there.
cvar_t r_red_crosshair= {"red_crosshair", "0"};
// Find where it registers the crosshair cvar in the engine source
// Put this below it
Cvar_RegisterVariable (&red_crosshair, NULL);
Or find the appropriate places in cl_view.c and put them in there.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
16 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest