From 717f38f07358319ced0b14a46444fea7d1c68918 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sat, 24 Nov 2018 03:51:27 +1100 Subject: [PATCH] move constant code to modules --- gamemodes/irresistible/gta/vehicle_data.pwn | 28 ++++++++++++ gamemodes/sf-cnr.pwn | 49 --------------------- 2 files changed, 28 insertions(+), 49 deletions(-) diff --git a/gamemodes/irresistible/gta/vehicle_data.pwn b/gamemodes/irresistible/gta/vehicle_data.pwn index 5f361b1..d0f29e4 100644 --- a/gamemodes/irresistible/gta/vehicle_data.pwn +++ b/gamemodes/irresistible/gta/vehicle_data.pwn @@ -115,3 +115,31 @@ stock IsLowriderVehicle(model) } return false; } + +stock GetVehicleSeatCount(iModel) +{ + if (400 <= iModel <= 611) + { + static + s_MaxPassengers[] = + { + 271782163, 288428337, 288559891, -2146225407, 327282960, 271651075, 268443408, 286339857, 319894289, 823136512, 805311233, + 285414161, 286331697, 268513553, 18026752, 286331152, 286261297, 286458129, 856765201, 286331137, 856690995, 269484528, + 51589393, -15658689, 322109713, -15527663, 65343 + } + ; + return ((s_MaxPassengers[(iModel -= 400) >>> 3] >>> ((iModel & 7) << 2)) & 0xF); + } + return 0xF; +} + +stock IsPaintJobVehicle(value) { + static const valid_values[3] = { + 1, 3670016, 806680576 + }; + if (483 <= value <= 576) { + value -= 483; + return (valid_values[value >>> 5] & (1 << (value & 31))) || false; + } + return false; +} diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 3ec92a0..f9ab602 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -10258,27 +10258,6 @@ stock SetPlayerColorToTeam( playerid ) return 1; } -/*stock GivePlayerXP_Legacy( playerid, amount ) -{ - if ( p_PlayerLogged{ playerid } == true ) - { - new string[ 20 ]; - if ( amount < 0 ) format( string, sizeof( string ), "~r~%d XP", amount ); - else { - if ( IsDoubleXP( ) ) amount *= 2; - format( string, sizeof( string ), "+%d XP", amount ); - } - p_XP[ playerid ] += amount; - PlayerTextDrawSetString( playerid, p_ExperienceAwardTD[ playerid ], string ); - PlayerTextDrawShow( playerid, p_ExperienceAwardTD[ playerid ] ); - SetTimerEx( "Experience_HideIncrementTD", 3500, false, "d", playerid ); - if ( p_XP[ playerid ] > 99999999 ) p_XP[ playerid ] = 99999999; - autosaveStart( playerid ); // auto-save - return 1; - } - return 0; -}*/ - stock PutPlayerInEmptyVehicleSeat( vehicleid, playerid ) { new @@ -10318,23 +10297,6 @@ stock PutPlayerInEmptyVehicleSeat( vehicleid, playerid ) return seats; } -stock GetVehicleSeatCount(iModel) -{ - if (400 <= iModel <= 611) - { - static - s_MaxPassengers[] = - { - 271782163, 288428337, 288559891, -2146225407, 327282960, 271651075, 268443408, 286339857, 319894289, 823136512, 805311233, - 285414161, 286331697, 268513553, 18026752, 286331152, 286261297, 286458129, 856765201, 286331137, 856690995, 269484528, - 51589393, -15658689, 322109713, -15527663, 65343 - } - ; - return ((s_MaxPassengers[(iModel -= 400) >>> 3] >>> ((iModel & 7) << 2)) & 0xF); - } - return 0xF; -} - stock IsPointToPoint(Float: fRadius, Float: fX1, Float: fY1, Float: fZ1, Float: fX2, Float: fY2, Float: fZ2) return ((-fRadius < floatabs(fX2 - fX1) < fRadius) && (-fRadius < floatabs(fY2 - fY1) < fRadius) && (-fRadius < floatabs(fZ2 - fZ1) < fRadius)); @@ -10980,17 +10942,6 @@ stock IsMeleeWeapon(value) { return false; } -stock IsPaintJobVehicle(value) { - static const valid_values[3] = { - 1, 3670016, 806680576 - }; - if (483 <= value <= 576) { - value -= 483; - return (valid_values[value >>> 5] & (1 << (value & 31))) || false; - } - return false; -} - stock IsVehicleUpsideDown(vehicleid) { new