Page 1 of 1

July 2012 FNF: Backpack Drop?

Posted: Tue Jul 17, 2012 7:00 pm
by Qent
For the July FNF Special, should we add the Quake-style backpack drop, if applicable? Note that it will require Zandronum 1.0-alpha!

RE: July 2012 FNF: Backpack Drop?

Posted: Tue Jul 17, 2012 7:04 pm
by Synert
Couldn't you add ALL of the mutators..?

jeez you guys make things awkward

RE: July 2012 FNF: Backpack Drop?

Posted: Tue Jul 17, 2012 7:06 pm
by Qent
I wish, but most of the others requested them with a specific WAD. :/

RE: July 2012 FNF: Backpack Drop?

Posted: Tue Jul 17, 2012 7:16 pm
by Ivan
Can't you make it Skulltag compatible ? I think the only part that needs to get erased is the pickup message part for it.

RE: July 2012 FNF: Backpack Drop?

Posted: Tue Jul 17, 2012 7:44 pm
by Synert
Qent wrote: I wish, but most of the others requested them with a specific WAD. :/
well hell if you're gonna do it that way
Ivan wrote: Can't you make it Skulltag compatible ? I think the only part that needs to get erased is the pickup message part for it.
Nope, it uses StrParam. Not just for the string, either- it's how it gets what weapon the player had, how much ammo, etc.

RE: July 2012 FNF: Backpack Drop?

Posted: Wed Jul 18, 2012 12:17 am
by Llewellyn
Synert wrote:
Ivan wrote: Can't you make it Skulltag compatible ? I think the only part that needs to get erased is the pickup message part for it.
Nope, it uses StrParam. Not just for the string, either- it's how it gets what weapon the player had, how much ammo, etc.
Backpack mod in 98d

It was the only function in the acs using StrParam, so my outdated ACC didn't spew an error when I compiled it.
Seems to work fine for me when I changed the backpack message to just

Code: Select all

Log("You got a backpack!");
I tried to make a shitty hack for Skulltag but it freezes even in Zando when I pick up a backpack...
Spoiler: CrappyCode (Open)

Code: Select all

str ammo2[4] = {"","","","",};
str space2[4] = {"","","","",};
str AMMONAMEx[4] = {"","","","",};
str s[4] = {"","","","",};
str comma2[4] = {"","","","",};

script 395 (int check, int packWepNum) clientside
{   
  int pln = PlayerNumber();
  int i, j, k, a =-1, b =-1, c =-1, d =-1;
	str comma = ", ";
	str space = " ";
	str weaponname = "", commaw = "", weapona = "";

    if (PlayerIsBot(pln)) { terminate; }
    if (CheckInventory("PickingUpDropPack") != check) { terminate; }


    for (i = 0; i < AMMOCOUNT; i++)
    {
        j = prevAmmos[i];
        if (j != 0)
        {
        k++;
					ammo2[i]=j;
					space2[i]=space;
					AMMONAMEx[i]=AMMONAME[i];
					s[i] = cond(j == 1, "", "s");
        comma2[i] = ", ";
        if (a ==-1)
            a=i;
        else if (b == -1)
            b=i;
        else if (c == -1)
            c=i;
        else 
            d=i;
        }
    }


	if (packWepNum != -1)
	{
	weaponname = WEPNAME[packWepNum];
	commaw = comma;
  weapona = " a ";
	}
    switch (k)
    {
    case 0:
    Log(s:"You got",s:weapona,s:weaponname,s:".");
    break;    
    case 1:
    Log(s:"You got",s:weapona,s:weaponname,s:commaw,d:ammo2[a],s:space2[a],s:AMMONAMEx[a],s:s[a],s:".");
    break;    
    case 2:
    Log(s:"You got",s:weapona,s:weaponname,s:commaw,d:ammo2[a],s:space2[a],s:AMMONAMEx[a],s:s[a],s:comma2[a],d:ammo2[b],s:space2[b],s:AMMONAMEx[b],s:s[b],s:".");
    break;
    case 3:
    Log(s:"You got",s:weapona,s:weaponname,s:commaw,d:ammo2[a],s:space2[a],s:AMMONAMEx[a],s:s[a],s:comma2[a],d:ammo2[b],s:space2[b],s:AMMONAMEx[b],s:s[b],s:comma2[b],d:ammo2[c],s:space2[c],s:AMMONAMEx[c],s:s[c],s:".");
    break;
    case 4:
    Log(s:"You got",s:weapona,s:weaponname,s:commaw,d:ammo2[a],s:space2[a],s:AMMONAMEx[a],s:s[a],s:comma2[a],d:ammo2[b],s:space2[b],s:AMMONAMEx[b],s:s[b],s:comma2[b],d:ammo2[c],s:space2[c],s:AMMONAMEx[c],s:s[c],s:comma2[c],d:ammo2[d],s:space2[d],s:AMMONAMEx[d],s:s[d],s:".");
    break;
    }
}
EDIT: It appears that if I try to declare more than 19(?) variables in a script Skulltag/Zando crash.

EDIT2: Replaced broken code with working code. Yay. [/sarcasm]

RE: July 2012 FNF: Backpack Drop?

Posted: Wed Jul 18, 2012 8:29 pm
by Synert
Llewellyn wrote: It was the only function in the acs using StrParam, so my outdated ACC didn't spew an error when I compiled it.
Oh, really? My bad :x
Llewellyn wrote: EDIT: It appears that if I try to declare more than 19(?) variables in a script Skulltag/Zando crash.
AFAIK that's some kind of limitation- ijon's been running into this problem as well.

RE: July 2012 FNF: Backpack Drop?

Posted: Thu Jul 19, 2012 2:54 am
by Llewellyn
Synert wrote: AFAIK that's some kind of limitation- ijon's been running into this problem as well.
Sounds like a bug that needs to be reported?

Anyway, after a while of being a derp, I realized "duh, just use arrays."
Image

And have updated the earlier post with WORKING code, so you guys can replace Ijon's (sorry bro) neat looking code with my messy hack if you want to run it in Skulltag.

Also, the forum broke because it still inherits the width of the spoiler even before it is opened. Sounds like another bug. Lol.

RE: July 2012 FNF: Backpack Drop?

Posted: Thu Jul 19, 2012 5:43 am
by Qent
So... don't need 1.0 for this?

RE: July 2012 FNF: Backpack Drop?

Posted: Thu Jul 19, 2012 5:56 pm
by Llewellyn
Not if you use this version:
https://dl.dropbox.com/u/26269208/quakebpak1-2-1.pk3
Doesn't have the ACS lumps in it like the other one did but all credit goes to Ijon lol.

RE: July 2012 FNF: Backpack Drop?

Posted: Fri Jul 20, 2012 3:02 am
by Ijon Tichy
Synert wrote: Nope, it uses StrParam. Not just for the string, either- it's how it gets what weapon the player had, how much ammo, etc.

Code: Select all

ubuntu@ubuntu pk3/acs $ grep -Ein "StrParam|^script" quakebpak.c
93:script 393 (int mode)
191:script 394 (int check, int a1, int a2) clientside
197:script 395 (int check, int packWepNum) clientside
208:        logStr = StrParam(s:logStr, s:" a ", s:WEPNAME[packWepNum]);
215:        if ((packWepNum != -1) || (i > 0)) { logStr = StrParam(s:logStr, s:", "); }
217:        logStr = StrParam(s:logStr, d:j, s:" ", s:AMMONAME[i], s:cond(j == 1, "", "s"));
nop
Llewellyn wrote: And have updated the earlier post with WORKING code, so you guys can replace Ijon's (sorry bro) neat looking code with my messy hack if you want to run it in Skulltag.
yeah that's basically why StrParam is awesome - you don't need (as much) hackiness anymore

edit: also mirrored

edit2:
Llewellyn wrote: EDIT: It appears that if I try to declare more than 19(?) variables in a script Skulltag/Zando crash.
oh yes, that bug - it turns out acc blindly allocates 36 bytes (enough for exactly 19 ints) that can be used for variables - it probably actually allocates 40, but the first 4 are used for the script number
either way it's a stupid limitation and a better compiler wouldn't have the issue

RE: July 2012 FNF: Backpack Drop?

Posted: Fri Jul 20, 2012 3:17 am
by Minigunner
Why not use the unused fat backpack sprite from skulltag_data (and put it into the mod)? The sprite was intended for use as a cooperative backpack.