First, make sure scouter is in your hud.txt and that the number of entries
at the top is still correct. Then add a new member variables to your
CHudScouter class to hold the sprite and the rect so they are not being
loaded every frame and so that you can debug it easier (looking at your
code, you may already have these);
HSPRITE m_hSprite;
wrect_t *m_prc;
Now do your loading in VidInit()
int CHudScouter::VidInit(void)
{
m_HUD_Scouter = gHUD.GetSpriteIndex( "lant_off" );
m_hSprite = gHUD.GetSprite(m_HUD_Scouter );
m_prc = &gHUD.GetSpriteRect(m_HUD_Scouter );
}
Now you can properly debug and see if m_hSprite is getting loaded and if
your rect (m_prc) is the correct size. If not, your hud.txt is
wrong. Next reduce your Draw to the bare minimum;
int CHudScouter::Draw(float flTime)
{
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_ALL ) )
return 1;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;
SPR_Set(m_hSprite, 255, 255, 255);
SPR_DrawHoles(0, 50, 50, m_prc);
return 1;
}
You can also comment out the first two checks there if you are paranoid and
add them in when you get it working.
Rob 'Commando' Prouse
http://www.tourofdutymod.com
At 12:29 AM 23/10/2002 -0700, you wrote:
Welp got debugging full fledged, ran it through It goes through my init, my
vidinit, and even my draw.
and it steps through all the code cleanly yet It still doesn't display my
sprite on the screen.
--Health.cpp--
...
int CHudScouter::Init(void)
{
HOOK_MESSAGE(Scouter);
m_iHealth = 0;
m_iKi = 0;
m_iPwrLvl = 0;
m_iFlags = 0;
gHUD.AddHudElem(this);
return 1;
}
...
int CHudScouter::VidInit(void)
{ m_hSprite = 0;
m_HUD_Scouter = gHUD.GetSpriteIndex( "scouter" );
m_iFlags |= HUD_ACTIVE;
return 1;
}
...
int CHudScouter::Draw(float flTime)
{
int r, g, b;
int a = 0, x, y;
ASSERT((m_iFlags & (HUD_ACTIVE)));
r = 255;
g = 255;
b = 255;
a = 255;
x = 50;
y = 50;
SPR_Set(gHUD.GetSprite(m_HUD_Scouter), r, g, b);
SPR_DrawHoles(0, x, y, &gHUD.GetSpriteRect(m_HUD_Scouter));
return 1;
}
...
--End of Health.cpp--
Now you look at that and tell me I haven't done anything wrong ?, I can get
the sprite index and display
my sprite for the scouter in place of my healthhud in my healthhud class, so
it isn't getspriteindex.
x and y are both in perfect position on the screen, The alpha test sprite
should display with full intensity
and when I run through the debugger and handset the x,y, values just in
case, It still doesn't display them.
Now Am I just loosing it or what ? because that seems like a problem with
the engine to me, *remember I said
I ran breakpoints and it went through my init, my vidinit, and then every
loop it runs to draw the hud pieces
it hit my scouters hud draw breakpoint, and I successfuly stepped into every
statement and return 1; successfully
and it continued to loop and draw it like normal* Anymore help would be
much appreciated, I just don't know
what else to do other then merge the scouter into my health hud which I
really want to avoid. Thankyou all ahead of time
for assistance. And i'm sorry for the length of code, but I'm sure one of
you would have mearly accused me
of just making typo's.
Pj Bean
Lead Coder of Sr(http://www.sr.flagrun.net)
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
Rob Prouse (Commando)
Tour of Duty Mod
http://www.tourofdutymod.com
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders