Page 1 of 1

ChaosDM source

Posted: Thu Apr 20, 2006 1:08 am
by Paril
Hello.

I'm wondering where I can retrieve the ChaosDM source code. I would like to make an updated version, since most Quake2 mods have stopped development.

-Paril Kalashnikov

Posted: Thu Apr 20, 2006 11:46 am
by jb
Sent.

Umm

Posted: Fri Apr 21, 2006 12:29 am
by Paril
Missing a file I think.. File with Weapon_Generic2 is not found, I've been looking for the function but it is missing.


-Paril

Posted: Fri Apr 21, 2006 4:50 pm
by MrG{DRGN}
Odd it would be p_weapon.c that you're missing. However since Weapon_Generic2 is defined, and only used in that file it seems odd you'd be having an error refering to that function as being missing. In other words if you don't have that file there is no way the compiler would know it was missing. :!: :?:

Posted: Fri Apr 21, 2006 8:09 pm
by Paril
Weapon_Generic2 is not in p_weapon.c, Weapon_Generic is, which calls 2, but 2 is not found anywhere. I'll just steal it from the CTF code, but let me know if any changes were made to it (probably Vwep stuff)

-Paril

Posted: Fri Apr 21, 2006 9:12 pm
by jb
Wish I could help you but thats all we have...the code is as is from one of the old coders that has left... I did all the UT2k3/4 and some of the UT stuff so not sure whats going on in the Q2 code base :(

Posted: Sat Apr 22, 2006 4:32 pm
by MrG{DRGN}
from p_weapon.c right above Weapon_Generic.

Code: Select all

static void Weapon_Generic2 (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
{
	int		n;

	if (ent->s.modelindex != 255 && ent->client->invisible != true) // vwep
		return; // not on client, so VWep animations could do wacky things

	if (ent->client->weaponstate == WEAPON_DROPPING)
	{
		if (ent->client->ps.gunframe == FRAME_DEACTIVATE_LAST)
		{
			ChangeWeapon (ent);
			return;
		}
		
		ent->client->ps.gunframe++;
		return;
	}

	if (ent->client->weaponstate == WEAPON_ACTIVATING)
	{
		if (ent->client->ps.gunframe == FRAME_ACTIVATE_LAST)
		{
			ent->client->weaponstate = WEAPON_READY;
			ent->client->ps.gunframe = FRAME_IDLE_FIRST;
			return;
		}

		ent->client->ps.gunframe++;
		return;
	}

	if ((ent->client->newweapon) && (ent->client->weaponstate != WEAPON_FIRING))
	{
		ent->client->weaponstate = WEAPON_DROPPING;
		ent->client->ps.gunframe = FRAME_DEACTIVATE_FIRST;
		return;
	}

	if (ent->client->weaponstate == WEAPON_READY)
	{
		if ( ((ent->client->latched_buttons|ent->client->buttons) & BUTTON_ATTACK) )
		{
			ent->client->latched_buttons &= ~BUTTON_ATTACK;
			if ((!ent->client->ammo_index) || 
				( ent->client->pers.inventory[ent->client->ammo_index] >= ent->client->pers.weapon->quantity))
			{
				ent->client->ps.gunframe = FRAME_FIRE_FIRST;
				ent->client->weaponstate = WEAPON_FIRING;

				// start the animation
				ent->client->anim_priority = ANIM_ATTACK;
				if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
				{
					ent->s.frame = FRAME_crattak1-1;
					ent->client->anim_end = FRAME_crattak9;
				}
				else
				{
					ent->s.frame = FRAME_attack1-1;
					ent->client->anim_end = FRAME_attack8;
				}
			}
			else
			{
				if (level.time >= ent->pain_debounce_time)
				{
					gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
					ent->pain_debounce_time = level.time + 1;
				}
				NoAmmoWeaponChange (ent);
			}
		}
		else
		{
			if (ent->client->ps.gunframe == FRAME_IDLE_LAST)
			{
				ent->client->ps.gunframe = FRAME_IDLE_FIRST;
				return;
			}

			if (pause_frames)
			{
				for (n = 0; pause_frames[n]; n++)
				{
					if (ent->client->ps.gunframe == pause_frames[n])
					{
						if (rand()&15)
							return;
					}
				}
			}

			ent->client->ps.gunframe++;
			return;
		}
	}

	if (ent->client->weaponstate == WEAPON_FIRING)
	{
		for (n = 0; fire_frames[n]; n++)
		{
			if (ent->client->ps.gunframe == fire_frames[n])
			{
//ZOID
				if (!CTFApplyStrengthSound(ent))
//ZOID
				if (ent->client->quad_framenum > level.framenum)
					gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0);
//ZOID
				//CTFApplyHasteSound(ent);
//ZOID

				fire (ent);
				break;
			}
		}

		if (!fire_frames[n])
			ent->client->ps.gunframe++;

		if (ent->client->ps.gunframe == FRAME_IDLE_FIRST+1)
			ent->client->weaponstate = WEAPON_READY;
	}
}


hope this helps.

JB could you please send me a copy of the code so I can see if indeed anything is missing from it or what the problem might be It SHOULD be identical to what I have as I have the last code Frederico was working on.

Posted: Wed May 03, 2006 10:43 pm
by Paril
Alright, sorry. I was searching in the func list, didn't know it was static :)

Posted: Thu May 04, 2006 11:35 pm
by MrG{DRGN}
yep no problem. The function should be static since its only used in that file. Quake2 code isn't in great style but its very functional.

Posted: Fri May 05, 2006 12:10 am
by General_Sun
It's great to see Chaos fans everywhere. :wink: