Can someone convert GPC2 code to GPC1 for me?

GPC1 script programming for Titan One. Code examples, questions, requests.

Can someone convert GPC2 code to GPC1 for me?

Postby xibonk » Sun Sep 18, 2022 5:44 am

This GPC2 code from the Splatoon 2 thread (the conversion megathread is locked):

Code: Select all
 
#include <switch.gph>
#include <mouse.gph>
 
#define MAXGX 45.0
#define DEFAULT_MMY 0.0
#define MAXR 212.5
 
fix32 mmy;
bool y_toggle = FALSE;
// GIVMXYF:FF0014008000000002000200FC00050A0F14191E23282D32373C41464B50555A5F64
const uint8 mxyc[] = { 0xFF, 0x00, 0x14, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0xFC, 0x00, 0x05, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x23, 0x28, 0x2D, 0x32, 0x37, 0x3C, 0x41, 0x46, 0x4B, 0x50, 0x55, 0x5A, 0x5F, 0x64 };
 
init {
    mxyconverter(mxyc);
    mmy = DEFAULT_MMY;
}
 
 
main {
    set_val(SWITCH_ACCZ,0.0 );
    set_val(SWITCH_ACCY,0.0 );
    set_val(SWITCH_GYROZ, 0.0 );
    set_val(SWITCH_GYROY, 0.0 );
    set_val(SWITCH_GYROX, 0.0 );
    set_val(SWITCH_ACCX, 0.0);
    gyro_aim();
}
 
 
void gyro_aim(){
    if(event_active(SWITCH_Y)) {
        y_toggle = !y_toggle;
        mmy = DEFAULT_MMY;
    }
    if(y_toggle) {
        set_val(SWITCH_Y, 100.0);
    }
 
    fix32 my = rad2deg(get_val(SWITCH_RY) / 200.0 * PI) / MAXGX;
    mmy = clamp( mmy + my , -MAXGX , MAXGX );
    set_val(SWITCH_ACCY, mmy );
    if( abs(mmy) != MAXGX ){
        set_val(SWITCH_GYROX, my * MAXR );
    }
    else {
        set_val(GYRO_1_X,0.0);
    }   
 
    set_val(SWITCH_ACCZ, abs(get_val(SWITCH_ACCY)) - 25.0  );
    fix32 gyroz = rad2deg(get_val(SWITCH_RX) / 200.0 * PI) / 45.0 * MAXR;
    set_val(SWITCH_GYROZ, gyroz * -get_val(SWITCH_ACCZ) / 25.0 );
    set_val(SWITCH_GYROY, gyroz * -get_val(SWITCH_ACCY) / 25.0 );
    set_val(SWITCH_ACCX, 0.0 );
    set_val(SWITCH_RY, 0.0);
    set_val(SWITCH_RX, 0.0);
}
 
User avatar
xibonk
Private
Private
 
Posts: 1
Joined: Sun Sep 18, 2022 5:41 am

Re: Can someone convert GPC2 code to GPC1 for me?

Postby Mad » Sun Sep 18, 2022 7:23 am

This can't be converted to T1.
ConsoleTuner Support Team || Discord || YouTube || Twitter
Mad
Major General
Major General
 
Posts: 4383
Joined: Wed May 22, 2019 5:39 am


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 13 guests