Forum

How do I have the engine know when I do something in qc?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Postby Baker » Fri Jul 09, 2010 10:54 pm

Mexicouger wrote:Well I couldn't find an inbetween size. It was either 3 is greater than 0, or player hull was less than 32. That means:

0 hull: 0-2

player: 3-32

Monsters: 32^

So there is no spot for a flipping ball size... So I was stuck....


No what I mean is the way you are trying to do this is so not close to what you need to be doing that the word "wrong" doesn't even adequately describe it.

You started asking about drawing an sbar item. And doing a stuffcmd from the server to the client would work just fine.

And now you are trying to apply it to the server. And you can't.

Quake has a client side and a server side. There can up to 16 clients connected so consider for a moment that there are 2 clients connected, when you are trying to have cl_mball pick the hull is that going to be for player 1 or player 2 or player 16?

I suggested the name of "cl_mball" where the "cl_" stands for client.

Ok, first of all ... have you added a field called something like .mball in defs.qc? In QuakeC you will need a field like that keep track of what state each of the 16 potential clients is in.

This "cl_mball" picking the hull thing ... you need to have that kind of thing in QuakeC. Don't think engine at all for game logic, hull selection ... QuakeC handles the game logic.

You can have sbar.c read a stuffcmd to know what it is supposed to display on the HUD. But maybe even better, when you are ball you can't fire right (I don't recall in Metroid prime being able to fire as a ball)? A more proper way to do this is having the "ball" state be a specific weapon, like 0. Then you won't need to even stuffcmd a cvar (nor add a field to defs.qc).

The next time I have time, which might be a day or 2 I'll give you some more specifics of how you might achieve this.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Fri Jul 09, 2010 11:14 pm

For starters, list all the weapons a player is going to have available (and describe them).

I'll show you how you can set this up in the QuakeC and in sbar.c in the engine.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Mexicouger » Fri Jul 09, 2010 11:23 pm

Erm.. Why do you want me to list the weapons... That has nothing to do with making the game know when I am in ball form. I just want to know what size to spesify in world.c. That is all. And I think Coding the ball in as a weapon would be better too. I have been pondering it for a while now. The current ball system is completely rigged. In almost every function there is this line of code:

if (self.mballtoggle == 1)
return;

It would just be easier to code it in otherwise... But I will explain each weapon for whatever benefit you have in mind.

Code: Select all
Blaster: Normal,casual weapon. Start out with this. It can charge.

Rocket launcher: A rocket is shot that explodes on contact.

Splaser: Purple beam that bounces off anything that can take damage.

sniper: Long range weapon. Can get headshots.

Magma beam: Shoots a molten lava rock that Bounces off walls and explodes. If charged, it burns the other player.

Lazer beam: it shoots a long lazer beam. low ammo.

Hyperbeam: A super weapon. Has to be charged

Morphball: The ball form of the player.


Some of these weapons haven't been coded yet. But they will. I have others in mind that Are iffy. So now go on with your purpose?
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Baker » Sat Jul 10, 2010 12:38 am

Modify this in defs.qc

Code: Select all
// items
float   IT_AXE               = 4096;
float   IT_SHOTGUN            = 1;
float   IT_SUPER_SHOTGUN      = 2;
float   IT_NAILGUN            = 4;
float   IT_SUPER_NAILGUN      = 8;
float   IT_GRENADE_LAUNCHER      = 16;
float   IT_ROCKET_LAUNCHER      = 32;
float   IT_LIGHTNING         = 64;
float   IT_EXTRA_WEAPON         = 128;


To something like this ...

Code: Select all
float   IT_MBALL               = 4096;
float   IT_BLASTER            = 1;
float   IT_ROCKET_LAUNCHER      = 2;
float   IT_SPLASER            = 4;
float   IT_SNIPER      = 8;
float   IT_MAGNABEAM      = 16;
float   IT_LASER      = 32;
float   IT_HYPERBEAM         = 64;
float   IT_EXTRA_WEAPON         = 128;


You can remove the mball field from defs.qc, from this point forward in the QuakeC you can test to see if the player is the morphball by seeing if what was formerly the axe is the currently selected weapon.

Likewise, change the weapon constants in the engine in quakedef.h

Now in cl_sbar.c you can simply check what the current weapon is an if it is IT_MBALL then you draw the sbar however you have you want it. There is no longer a need for a stuffcmd, your engine will handle this "naturally".

As for the hull stuff, when you are switching to the morphball you will need to use QuakeC to set the current hull. I don't have the QuakeC (in particular the Quake-Life) source conveniently available to see what it does when you crouch, but it is about the same thing.

Follow those and all your above issues should be solved or near solved.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Mexicouger » Sat Jul 10, 2010 1:21 am

Well that Wouldn't work because I would have to go and change every flipping thing.... Not worth it at this point in time.

So in the HULL thing, Would I put

if (cl.stats[ACTIVE_WEAPON] == IT_MBALL)
HULL stuffs.

Or would that change it for all players..
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Baker » Sat Jul 10, 2010 2:46 am

Mexicouger wrote:Well that Wouldn't work because I would have to go and change every flipping thing.... Not worth it at this point in time.


It shouldn't take that long. Get something like TextPad5 and do "open all" and do a search and replace.

So in the HULL thing, Would I put

if (cl.stats[ACTIVE_WEAPON] == IT_MBALL)
HULL stuffs.

Or would that change it for all players..


The only thing you do in the engine is define the 3 hull sizes.

In QuakeC you'd want to do that in ...

Code: Select all
/*
============
W_ChangeWeapon

============
*/
void() W_ChangeWeapon =


in weapon.qc

If someone switches to the morphball, you'd change the model and all the related stuff and set the hull. I'd have to look through the Quake-Life source to see what Avirox did there as I don't actively code QuakeC on a regular basis like I do engine stuffs.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Mexicouger » Sat Jul 10, 2010 3:14 am

No....

How do I determine the HULL size of the ball... I know what to do in the quakec.

What Number do I put for HULL 2? Like hull0 is determined by 0>3. What number do I put for the ball.
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Baker » Sat Jul 10, 2010 3:34 am

Mexicouger wrote:No....

How do I determine the HULL size of the ball... I know what to do in the quakec.

What Number do I put for HULL 2? Like hull0 is determined by 0>3. What number do I put for the ball.


There are 3 hulls: hull 0, hull 1, hull 2. hull 0 is point entity; it cannot be changed.

Your options are hull1 or hull2.

hull1 in Quake is player sized. hull2 is Shambler-sized. For your game, I'd recommend using hull1 for the regular player and all enemies and resize hull2 for the ball.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Mexicouger » Sat Jul 10, 2010 4:14 am

You aren't gettting my point/ I have resized the HULL in video_hardware_model, and brush.c

It's all been changed. I want to know HOW to tell the game when to use HULL 2. I was told to change it in world.c. But I don't have a value for the ball.

its size is '-12 -12 -24', '12 12 10'

How do I add that to the world.c thing
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Baker » Sat Jul 10, 2010 4:59 am

Mexicouger wrote:I want to know HOW to tell the game when to use HULL 2.


Open up the Quake-Life QuakeC source codes. Search for the word "crouch".

I'm not using a computer where I can download source codes so I can't answer the above because I don't have sources available.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby frag.machine » Sat Jul 10, 2010 3:14 pm

Huh... using setsize() in QuakeC ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Previous

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest