Battlefield 3 wiimote script (cod bravo settings)

(c) 2014 OFC-Giorgio - All right reserved ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle) NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex and world at war) for PS3 Battlefield 3 but this script can easily be altered for the PS4, XBOX 360 and XBOX One. The first version of my script I posted in the c o n t r o l l e r m a x forums (their "publish script to library" function in gtuner suspiciously did not work) and the overfortyclan forums. I removed my scripts from c o n t r o l l e r m a x and only publish them in the c o n s o l e t u n e r Titan One library. In the Titan One forums I posted information about the wii sensorbar that is needed for operating the wiimote. I knew of both the consoletuner dongle and the titan one dongle (and the dispute between the two). Initially I choose (and purchased) the consoletuner dongle because of their claim of a bigger community and better support. However to me the consoletuner "staff" appeared evasive and suspicious about the api, library, a couple of software/website bugs I informed them about, future fixes and future updates, as well as arrogant and rude in their communication towards me (and others). After asking the same questions in the Titan One forums of c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed there were software updates and even my request to have deadzone settings in MaxAIM DI was added to the new version over night. For now I assume that the Titan One team is the original developer and has the source code of the firmware, gtuner and the plugins. Based on this information I purchased a Titan One dongle and my scripts also worked on it. Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my scripts in the c o n s o l e t u n e r Titan One library. (c) 2014 OFC-Giorgio - All right reserved ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle) NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR
Version20141105-1
AuthorOFC-Giorgio
Publish DateSun, 26 Oct 2014 - 23:46
Last UpdateTue, 4 Nov 2014 - 23:41
Downloads272
RATE


4

1

Release Notes: * Updated copyright notice to prevent illegal copying and publishing on other places than consoletuner.com (makers of the Titan One usb dongle) * Empty battery indicator (led 3 on if battery level less or equal 20%)
Code: Select all
// GPC Online Library
// battlefield_3_wiimote_script_cod_bravo_settings.gpc
 
/*
   OFC-Giorgio - PS3 Battlefield 3 wiimote script (cod bravo settings)
 
   (c) 2014 OFC-Giorgio - All right reserved
 
   ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle)
 
   NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR
 
   Changelog:
 
   20141105-1
              * Updated copyright notice to prevent illegal copying and
                publishing on other places than consoletuner.com
                (makers of the Titan One usb dongle)
              * Empty battery indicator (led 3 on if battery level less or equal 20%)
 
   (c) 2014 OFC-Giorgio - All right reserved
 
   20141027-1
 
   Initial tagged version (derived from Battlefield 3 wiimote script).                   
 
   Difference layout between bf3 and bf4 (which is more like call of duty):
       r2 button in bf3 = melee               r2 button in bf4 = spot
       r3 button in bf3 = crouch              r3 button in bf4 = melee
        o button in bf3 = interact             o button in bf4 = crouch
   select button in bf3 = spot            select button in bf4 = leaderboard
 
   Led 3 indicates battery is less than 30% full.
   ///////////////////////////////////////////////////////////////////////////
 
   Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created
   a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod
   games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex
   and world at war) for PS3 Battlefield 3 but this script can easily be altered for the
   PS4, XBOX 360 and XBOX One.
 
   The first version of my script I posted in the c o n t r o l l e r m a x
   forums (their "publish script to library" function in gtuner suspiciously did
   not work) and the overfortyclan forums.
 
   I removed my scripts from c o n t r o l l e r m a x and only publish them in
   the c o n s o l e t u n e r Titan One library.
 
   In the Titan One forums I posted information about the wii sensorbar that is needed
   for operating the wiimote.
 
   I knew of both the consoletuner dongle and the titan one dongle (and the
   dispute between the two).
 
   Initially I choose (and purchased) the consoletuner dongle because of their
   claim of a bigger community and better support. However to me the
   consoletuner "staff" appeared evasive and suspicious about the api, library,
   a couple of software/website bugs I informed them about, future fixes and
   future updates, as well as arrogant and rude in their communication towards
   me (and others).
 
   After asking the same questions in the Titan One forums of
   c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed
   there were software updates and even my request to have deadzone settings in
   MaxAIM DI was added to the new version over night.
 
   For now I assume that the Titan One team is the original developer and has
   the source code of the firmware, gtuner and the plugins. Based on this
   information I purchased a Titan One dongle and my scripts also worked on it.
 
   Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my
   scripts in the c o n s o l e t u n e r Titan One library.
 
   (c) 2014 OFC-Giorgio - All right reserved
 
   Background:
 
   For years I (and many others) have been playing call of duty with the
   wiimote on the wii (world at war, modern warfare reflex, black ops, modern
   warfare 3) and wiiu (black ops2, ghosts). Many years ago I started the
   Over Forty Clan (OFC) with a group of older players that play cod with the
   wiimote on the wii and later on the wiiu.
 
   Since this year (2014) it seems there will be no more cod (advanced warfare)
   on the wiiu platform, a lot of wiimote cod users are very sad not to be able
   to play the new cod(s) with a wiimote.
 
   In order to be able to play the new cod I explored the possibilities to
   connect a wiimote to a PC, PS3 or XBOX. I first tried cod world at war with
   a wiimote on a PC by writing a small C# program with Brian Peek's wiimotelib at
   channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote).
   It turned out that the sensitivity and deadzones settings (made by TreyArc,
   the company that made/ported all the wii/wiiu versions of cod) that I was used
   to on the wii/wiiu were not so easy to be programmed from scratch and most
   importantly:the mouse+keyboard players were super fast compared to me with my
   wiimote setup (and my old reflexes).
 
   Later I found out about the titan one and the consoletuner
   and reported my findings to all the wiimote users via the
   OFC website (overfortyclan.freeforums.org),
   the nintendo miiverse (miiverse.nintendo.net/) social network and
   the activision cod wiiu black ops II and ghosts forums at
   community.callofduty.com/community/call_of_duty/english/black_ops_2/forums/wii-u
   and
   community.callofduty.com/community/call_of_duty/english/ghosts/forums/ghosts_wii-u .
 
   Happy wiimoting!
   OFC-Giorgio
 
 
   From the wiiu manual:
   * Z Button - ADS
   * C Button - Crouch/Prone
   * Control Stick - Move
   * Up on the +Control Pad - Jump
   * Right on the +Control Pad - Switch Weapon
   * Left on the +Control Pad - Inventory
   * Down on the +Control Pad - Melee Attack
   * A Button - Use/Sprint/Lock Camera
   * - Button - Throw Tacticals
   * + Button - Throw Lethals
   * 1 Button - Objectives/Menu
   * 2 Button - Scoreboard
   * B Button (underneath controller) - Fire Weapon
   * Shake Nunchuk - Reload
 
   Hold Wii-Left and select with Nunchuck stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).
 
   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
 
*/

 
define ADS_SENSITIVITY     = 45; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 50; // a lower value than the standard 50 value means more sensitive
 
//define RUMBLE_ENABLED = TRUE; // vibrating enabled
define RUMBLE_ENABLED = FALSE// vibrating disabled
 
define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)
 
unmap ALL_REMAPS;
 
/*
   The layout difference between bf3 and bf4 (which is more like call of duty):
       r2 button in bf3 = melee               r2 button in bf4 = spot
       r3 button in bf3 = crouch              r3 button in bf4 = melee
        o button in bf3 = interact             o button in bf4 = crouch
   select button in bf3 = spot            select button in bf4 = leaderboard
*/

 
remap  WII_MINUS    -> PS3_SQUARE;   // bf3 reload hold: interact  // Bravo settings: reload hold: use
remap  WII_HOME     -> PS3_PS;       // home menu
remap  WII_PLUS     -> PS3_SELECT;   // bf3 spot // Bravo settings: lethal grenade
remap  WII_ONE      -> PS3_START;    // bf3 menu hold: scoreboard // Bravo settings: menu/map
remap  WII_TWO      -> PS3_CIRCLE;   // bf3 interact  // Bravo settings: score
remap  WII_A        -> PS3_L3;       // bf3 sprint
 
remap  WII_B        -> PS3_R1;       // fire
remap  WII_UP       -> PS3_CROSS;    // jump/mantle
remap  WII_DOWN     -> PS3_R2;       // bf3 melee
remap  WII_RIGHT    -> PS3_TRIANGLE; // bf3 switch weapon hold: pickup // Bravo settings: switch weapon
remap  WII_C        -> PS3_R3;       // bf3 crouch hold:prone// Bravo settings: crouch/prone
remap  WII_Z        -> PS3_L1;       // zoom/aiming down the sights (ADS)
remap  WII_NX       -> PS3_LX;       // move
remap  WII_NY       -> PS3_LY;       // move
remap  WII_IRX      -> PS3_RX;       // look
remap  WII_IRY      -> PS3_RY;       // look
 
unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;
 
// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY
 
// Common identical (classic) controller (pro) and wiimote+nunchuk buttons:
// WII_HOME/WII_MINUS/WII_PLUS/WII_UP/WII_DOWN/WII_LEFT/WII_RIGHT/WII_A/WII_B
 
// Overlapping (classic) controller (pro) with wiimote+nunchuk:
// (classic) controller (pro) button WII_LT = nunchuk WII_C
// (classic) controller (pro) button WII_ZL = nunchuk WII_Z
// (classic) controller (pro) button WII_LX = nunchuk WII_NX
// (classic) controller (pro) button WII_LY = nunchuk WII_NY
 
// (classic) controller (pro) buttons that are not used in wiimote+nunchuk mode:
// WII_RT
// WII_ZR
// WII_RX
// WII_RY
// WII_X
// WII_Y
// used to bind them to PS3 button and force the wii buttons to trigger the PS3 button
// by the setval commands in the script (see (1) & (2)):
 
// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
 
// (2)
// dummy mapping for lethal grenades
remap  WII_RT -> PS3_L2;       
 
init
{
  if(!RUMBLE_ENABLED)
  {
    block_rumble();
  }
}
 
 
main
{
   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
   set_val(WII_IRX, inv(get_val(WII_IRX)));
   // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
 
   // use different sensitivity for ADS (aiming down the sights) and non ADS
   if (get_val(WII_Z))
   {
     //set_led(LED_3, 1); // indicate ADS
     sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
   }
   else
   {
     //set_led(LED_3, 0);
     sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
   }
 
   deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 30);
 
   // PS3 LXY = Nunchuck NXY by Wiimot3
   //sensitivity(WII_NX , NOT_USE, 150);
   //sensitivity(WII_NY , NOT_USE, 150);
   //deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
   // PS3 LXY = Nunchuck NXY by Wiimot3
 
 
 
   // make nunchuck stick 3 states only (per direction):
   // - stick is only left/neutral/right (horizontal)
   if (MOVE_LEFT_RIGHT_3STATES)
   {
     if (get_val(WII_NX) < -20)     
     {   
        set_val(PS3_LX, -100); // left
     }
     else
     if (get_val(WII_NX) > 20)     
     {   
        set_val(PS3_LX, 100); // right
     }
     else
     {
        set_val(PS3_LX, 0)// neutral
     }
   }
 
   // - stick is only up/neutral/down (vertical)
   if (MOVE_FORWARD_BACKWARD_3STATES)
   {
     if (get_val(WII_NY) < -20)     
     {   
        set_val(PS3_LY, -100); // up
     }
     else
     if (get_val(WII_NY) > 20)
     {   
        set_val(PS3_LY, 100); // down
     }
     else
     {
        set_val(PS3_LY, 0);   // neutral
     }
   }
   //stickize(WII_IRX, WII_IRY, 129);
 
 
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
   if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100)// left
   if(get_val(WII_LEFT) && get_val(WII_NX)90) set_val(WII_RX, 100)// right
   if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100)// up
   if(get_val(WII_LEFT) && get_val(WII_NY)90) set_val(WII_RY, 100)// down
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
 
 
   // Bravo settings  + while twisting the wiimote is used for throwing tacticals
   if(get_val(WII_PLUS) && get_val(WII_ACCX) > 20)
   {
     set_val(WII_PLUS, 0); // stop/prevent throwing tacticals
     //set_val(PS3_L2, 100); // throw lethal
     set_val(WII_RT, 100); // throw lethal
   }
 
 
   // test for wiimote out of reach of sensorbar
   if(wiir_offscreen())
   {
     set_val(WII_IRX, 0); // prevent camera from spinning
     set_val(WII_IRY, 0); // prevent camera from spinning
     set_led(LED_4, 1);   // light led 4 to indicate sensorbar is out of sight
   }
   else
   {
     set_led(LED_4, 0);
   }
 
 
   // Empty battery indicator (led 3 on if battery level less or equal 20%)
   if(get_battery() <= 2)
   {
     set_led(LED_3, 1);
   }
   else
   {
    set_led(LED_3, 0);
   }
 
 
} // end of main() function