// ----------------------------------------------------------------------------
//
// Combo Display script for Russian Overkill
//
// 6th of August 2012 by KeksDose
//
// This piece of code allows you to see a table of combos on certain weapons
// by holding the reload button. It looks kind of like a moves list you'd see
// in a fighting game, just more straightforward in that you don't pause the
// whole game in the process. @_@
//
// ----------------------------------------------------------------------------

#Library "Combo Display"
#Include "zdefs.acs"

#LibDefine CS_USEWORDS		FALSE	// Use full words instead of arrow graphics
#LibDefine CS_HUDX			50.1	// .1 is placing by top left image corner.
#LibDefine CS_HUDY			50.1	// Better keep it that way or fuck up. :p
#LibDefine CS_HUDWIDTH		800
#LibDefine CS_HUDHEIGHT		600
#LibDefine CS_COMBOOFFSET	40		// Vertical offset between command
#LibDefine CS_MOVESOFFSET	10		// Vertical offset of arrows below title
#LibDefine CS_SYMBOLOFFSET	30		// Horizontal offset between arrows
#LibDefine CS_WEAPONCOUNT	3		// Count of weapons that can do combos
#LibDefine CS_COMBOCOUNT	5		// Just a maximum value
#LibDefine CS_SYMBOLCOUNT	16		// Maximum symbols of a combo
#LibDefine CS_SYMBOLIMAGES	6		// Symbols available
#LibDefine UP				0		// Symbol translator identifiers
#LibDefine LEFT				1
#LibDefine DOWN				2
#LibDefine RIGHT			3
#LibDefine FIRE				4
#LibDefine ALTFIRE			5
#LibDefine HOLDFIRE			6
#LibDefine END				7

Str CS_HUDFONT	= "DOOMFONT";	// Why a variable? Because string #defines screw up.

Str Symbols[7] = { "CSUP", "CSLEFT", "CSDOWN", "CSRIGHT", "BAL1A0", "BAL2A0", "BAL1A0" };
Str Weapons[CS_WEAPONCOUNT] = { "Punchokrator", "Shooter", "TreesFists" };
Str ComboNames[CS_WEAPONCOUNT][CS_COMBOCOUNT] = {
{ "\cgFalcon Punch", "\cnIce Uppercut", "\ciCowsplosion", "\ctDomination", "    " },
{ "\ccMachinegun", "\cuCannonball", "\cgCRT Monitor", "\ckRocket Propelled Chainsaw", "\cnConcrete Donkey" },
{ "\cfAHH-ATATATATATATATA", "\chClyde", "\cgBicycle Kick", "\ciSparta Kick", "    " }
};

Str SymbolStrings[7] = { "+forward", "+moveleft", "+back", "+moveright", "+attack", "+altattack", "+attack" };

// ComboCommand and ComboNames all go in the same order. Kinda ugly to just
// assume this but it's ACS. If it were me, I'd rather have a C struct with all
// the godforsaken instructions. But nooooo, ACS compiler would shit all over
// my face apparently. </rant>

Int ComboCommand[CS_WEAPONCOUNT][CS_COMBOCOUNT][CS_SYMBOLCOUNT] = {
{
	{ LEFT, RIGHT, UP, UP, DOWN, FIRE, END },											// Falcon Punch
	{ LEFT, RIGHT, DOWN, DOWN, UP, FIRE, END },											// Ice Uppercut
	{ UP, LEFT, DOWN, RIGHT, UP, LEFT, DOWN, RIGHT, ALTFIRE, END },						// Cowplosion
	{ LEFT, DOWN, RIGHT, DOWN, LEFT, UP, ALTFIRE, END },
	{ END }
},

{
	{ LEFT, RIGHT, HOLDFIRE, END },														// Machinegun
	{ UP, DOWN, HOLDFIRE, END },														// Cannonball
	{ UP, DOWN, UP, DOWN, UP, ALTFIRE, END },											// Dr Hax Finger Point of Death
	{ LEFT, RIGHT, RIGHT, UP, DOWN, DOWN, ALTFIRE, END },								// Rocket Chainsaw
	{ LEFT, RIGHT, LEFT, RIGHT, DOWN, LEFT, RIGHT, LEFT, RIGHT, UP, ALTFIRE, END }		//Concrete Donkey
},


{
	{ UP, LEFT, DOWN, RIGHT, UP, DOWN, UP, RIGHT, DOWN, LEFT, UP, DOWN, FIRE, END },	// Hyakuretsu Ken
	{ LEFT, UP, RIGHT, DOWN, DOWN, DOWN, LEFT, UP, RIGHT, FIRE, END },					// Blue Screen of Death-Punch
	{ LEFT, DOWN, RIGHT, UP, UP, UP, ALTFIRE, END },									// Bicycle Kick
	{ RIGHT, DOWN, LEFT, UP, UP, UP, ALTFIRE, END },									// Sparta Kick
	{ END }
}

};

Script 719 (Int Which) clientside
{
	SetHUDSize(CS_HUDWIDTH, CS_HUDHEIGHT, 1);
	
	Int X = 0.0;
	Int Y = 0.0;
	Int Command;
	
	While(CheckWeapon(Weapons[Which]))
	{
		If(CheckInventory("RO_GotoReload") > 0)
		{
			For(Int Combo = 0; Combo < CS_COMBOCOUNT; Combo++)
			{
				SetFont(CS_HUDFONT);
				
				Y = (Combo * CS_COMBOOFFSET) << 16;
				
				HUDMessage(s:ComboNames[Which][Combo]; HUDMSG_FADEOUT, 0,
						   CR_UNTRANSLATED, CS_HUDX, CS_HUDY + Y, 1);
				
				For(Int Symbol = 0; Symbol < CS_SYMBOLCOUNT; Symbol++)
				{
					Command = ComboCommand[Which][Combo][Symbol];
					
					If(Command == END)
					{
						Break;
					}
						
					X = (Symbol * CS_SYMBOLOFFSET) << 16;
					
					If(Command == FIRE || Command == ALTFIRE || CS_USEWORDS) // Special handling...
					{
						SetFont(CS_HUDFONT);
						
						HUDMessage(k:SymbolStrings[Command]; HUDMSG_FADEOUT, 0, CR_UNTRANSLATED,
								CS_HUDX + X, CS_HUDY + Y + (CS_MOVESOFFSET << 16), 1);
					}
					
					Else If(Command == HOLDFIRE)
					{
						Setfont(CS_HUDFONT);
						
						HUDMessage(s:"Hold\n", k:SymbolStrings[Command]; HUDMSG_FADEOUT, 0, CR_UNTRANSLATED,
								CS_HUDX + X + 0.4, CS_HUDY + Y + (CS_MOVESOFFSET << 16), 1);
					}
					
					Else
					{
						SetFont(Symbols[Command]);
						
						HUDMessage(s:"A"; HUDMSG_FADEOUT, 0, CR_UNTRANSLATED,
								CS_HUDX + X, CS_HUDY + Y + (CS_MOVESOFFSET << 16), 1);
					}
				}
			}
		}
		
		Delay(Const:1);
	}
}
