Problem with thunderwalker cloak rune and vweps

Discuss programming in the QuakeC language.
Post Reply
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Problem with thunderwalker cloak rune and vweps

Post by Batman!]ZFA[ »

With the addition of vweps to Thunderwalker 6 it has broken on of the 6 runes we use in the game.

Cloak rune is like the ring of shadows except when the owner shots or is shot they are seen.

vweps and ring of shadows work fine together, but with cloak rune the owner should become hidden (with eyes.mdl) instead you see this below

Image

which seems to be using the default quakeworld skin instead of the eyes.mdl

the current vweps.c for tw 6 is here

currently the cloak rune code
incombat.cis:

Code: Select all

// ThunderWalker: De-cloak if hurt
    if (targ.twrune & Cloaking_Rune)
    {
        if (targ.floyd == 1)
        {
            sound (targ, CHAN_ITEM, "tw/twcloak2.wav", 1, ATTN_NORM);
            targ.floyd = 2;
        }
        setmodel (targ, "progs/player.mdl");
        targ.bippy = time + 4.5;
        targ.gene = time + 6.5;
        targ.jimmy = 2;
    }
    // react to the damage
    oldself = self;
    self = targ;

    if (self.th_pain)
    {
        self.th_pain (attacker, take);
    }
    self = oldself;
And the cloak rune code from weapons.c here:

Code: Select all

// ThunderWalker: Handles whether you should be visible or not with cloaking rune
    if (self.twrune & Cloaking_Rune)
    {
        if (time > self.bippy)
        {
            if (time < self.gene)
            {
                stuffcmd (self, "bf\n");
            }
            if (self.jimmy == 2)
            {
                sound (self, CHAN_ITEM, "tw/twcloak.wav", 1, ATTN_NORM);
                self.jimmy = 1;
            }
            setmodel (self, "progs/eyes.mdl");
            self.floyd = 1;
        }

Doc one of our coders tried adding two different codes to fix this but both were not able to correct the problem.


First try: This one removed the weapon models but you still saw the player with the base skin

Code: Select all

if (self.model == "progs/eyes.mdl");
{
self.vw_index = 0;
return;
}
2nd one broke the viewable weapons so they did not work at all

Code: Select all

if (self.floyd == 1) 
{
self.vw_index = 0;
return;
}
Anyone have idea where we went wrong with what we added to vweps.c?

All the latest TW 6 code is available here
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

Okay I found the bug in the client-side vwep code

in ezQuake: in cl_ents.c, CL_LinkPlayers....

Code: Select all

if ((cl.vwep_enabled && r_drawvweps.value && state->vw_index)&& (state->modelindex != cl_modelindices[mi_eyes])) 				 
		{
			qbool vwep;
			vwep = CL_AddVWepModel (&ent, state->vw_index, cent->old_vw_frame);
it wasnt checking against the eyes model :(
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

.jimmy .bippy .gene and .floyd? These variable names are sillier than mine.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

To really fix this we need to be able to control it from the server though.

I added a couple calls to VWEPS_SetModel();
Doc wrote: one when your model is set to eyes.mdl and also when your model is changed
back to player.mdl
I doubt this will fix it but thought it was worth a try.
Image

This is what I get from that try.
Tonik
Posts: 3
Joined: Thu Oct 19, 2006 4:57 pm
Location: Moscow, Russia
Contact:

Post by Tonik »

The client patch is redundant. The client doesn't have to worry about eyes or not, the logic there is most straightforward:

Code: Select all

if  (self.vw_index == 0)  then
       draw whatever model self.modelindex is set to
else
       draw vwplayer.mdl and the vwep
Don't tell it to draw the vwep, and it won't! If the original Doc's patch is not working, that's because something in your code is setting self.vw_index again later!

If you don't wanna bother figuring out what exactly is happening and just want a quick fix, you can just put the lines

Code: Select all

if (self.modelindex == modelindex_eyes)
        self.vw_index = 0;  
at the very end of PlayerPostThink()

(no, you can't check self.model because it doesn't change when you go into eyes mode; only self.modelindex does)
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

this is correct, the 'eyes mode'l for me was the bandaide not the reason. I was sure that someone would correct this it was late nigth and Batman called me, and i just pooped and if != statement so we could play. so it was a fix to be fixed. :P
Last edited by r00k on Sun Jul 26, 2009 4:25 am, edited 1 time in total.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

Doc wrote: I added the self.modelindex check to PlayerPostThink() maybe this one will
work.
Image
Doc wrote: It looks like it's half working since it's removing the weapon model with the cloak rune.

I wonder if now there is something messed up with the player.mdl
or if maybe it has something to do with the 24 bit team and enemy skins
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

When I tested it with Zquake .17 it worked for me and in ezQuake that I modified with said code. I've slept since then so I could be wrong.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

Rook: your client update worked

This is server side, we are trying to change in the qwprogs.dat
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

now we have it fixed server side as well:
Doc wrote: I moved

Code: Select all

if (!stof(infokey(world, "vwep")))
return;
from Precache_VWEP(); to VWEPS_SetModel();

I added this to VWEPS_SetModel();
if (self.model == "progs/eyes.mdl" && self.invisible_time != 0)
{
vw_model = 0;
}
And here is where I think the problem was

In CheckPowerups();
I replaced this bit of code

Code: Select all

// use the eyes
self.frame = 0;
self.modelindex = modelindex_eyes;
VWEPS_SetModel(); // Viewable Player Weapons
}
else
{
self.modelindex = modelindex_player; // don't use eyes
}
NEW CODE

Code: Select all

// use the eyes
self.frame = 0;
self.modelindex = modelindex_eyes;
self.vw_index = 0; // Doc remove weapon models
}
else
{
self.modelindex = modelindex_player; // don't use eyes
VWEPS_SetModel(); // Doc set player weapon model
}
thanks again everyone for all the help on this!!
Post Reply