JD2022-TU1/main/extern/Camcam/LIBS/Mixer/Command_WII.h

208 lines
6.2 KiB
C

#ifdef WIIMOTE_SUPPORT
DEFINE_SCRIPT(WII_IsConnected,
CATEGORY(Wiimote) PARAM_INT(Index),
"TRUE if W[Index] is connected, FALSE else",
{
RETURN_BOOL(remote[Index&3].IsConnected());
})
DEFINE_SCRIPT(WII_Connect,
CATEGORY(Wiimote) PARAM_INT(Index),
"Connect a wimote in channel Index between 0-4. Return != 0 when OK",
{
int returnv;
extern void on_state_change (wiimote &remote, state_change_flags changed);
remote[Index&3].pSceneClass = this;
remote[Index&3].CallbackTriggerFlags = CHANGED_ALL;
remote[Index&3].ChangedCallback = on_state_change;
memset(remote[Index&3].GunFiled,0,sizeof(remote[Index&3].GunFiled));
returnv = remote[Index&3].Connect(wiimote::FIRST_AVAILABLE);
if (returnv != 0)
{
if(remote[Index&3].bExtension)
remote[Index&3].SetReportType(wiimote::IN_BUTTONS_ACCEL_IR_EXT); // no IR dots
else
remote[Index&3].SetReportType(wiimote::IN_BUTTONS_ACCEL_IR); // IR dots
}
RETURN_INT(returnv);
})
DEFINE_SCRIPT(WII_Disconnect,
CATEGORY(Wiimote) PARAM_INT(Index),
"Disconnect a wimote in channel Index between 0-4",
{
remote[Index&3].Disconnect();
})
DEFINE_SCRIPT(WII_Reset,
CATEGORY(Wiimote) PARAM_INT(Index),
"Software reset the wiimote, if connected",
{
remote[Index&3].Reset();
})
DEFINE_SCRIPT(WII_SetLEDs,
CATEGORY(Wiimote) PARAM_INT(Index) PARAM_INT(BitLed) ,
"Set led on the wiimote bit with 0 - 3 from BitLed",
{
remote[Index&3].SetLEDs(BitLed);
})
DEFINE_SCRIPT(WII_SetRumble,
CATEGORY(Wiimote) PARAM_INT(Index) PARAM_BOOL(On) ,
"Set Rumble on/off",
{
remote[Index&3].SetRumble(On);
})
DEFINE_SCRIPT(WII_Support,
CATEGORY(Wiimote) ,
"Return 1 if engine support wiimote",
{
RETURN_INT(1)
})
DEFINE_SCRIPT(WII_GetState,
CATEGORY(Wiimote) PARAM_INT(Index) ,
"Return full wiimote state",
{
extern int PushWiiMote(u32 WiimoteIndex,lua_State *L, WORLD *pScene);
returnDone++;
if (PushWiiMote(Index,L, this))
ComputeReturn(L, returnDone);
else
returnDone--;
})
DEFINE_SCRIPT(WII_LoadSound,
CATEGORY(Wiimote) PARAM_STRING(SoundWavName) ,
"Load a sound and prepare it for wiimonte. Return the soundindex, -1 mean not found, -2 mean other problem",
{
extern int WIIMOTE_LoadSound(char *pSoundName,lua_State *L, WORLD *pScene);
RETURN_INT(WIIMOTE_LoadSound(SoundWavName,L, this));
})
DEFINE_SCRIPT(WII_PlaySound,
CATEGORY(Wiimote) PARAM_INT(WiimoteIndex) PARAM_INT(SoundIndex),
"Play a Sound in the wiimote WiimoteIndex",
{
extern int WIIMOTE_PlaySound(int WiimoteIndex,int SoundIndex,lua_State *L, WORLD *pScene);
WIIMOTE_PlaySound(WiimoteIndex,SoundIndex,L, this);
})
#else
DEFINE_SCRIPT(WII_Support,
CATEGORY(Wiimote) ,
"Return 1 if engine support wiimote",
{
RETURN_INT(0)
})
#endif
DEFINE_SCRIPT(WND_AddFontResource,
CATEGORY(Window) PARAM_STRING(FontFileTTF),
"Add the ttf file to the font engine resource. Return > 0 if OK",
{
extern int AddfonRes(char *Str);
RETURN_INT(AddfonRes(FontFileTTF));
})
DEFINE_SCRIPT(DRW_SetTextOriginUpperLeft,CATEGORY(Drawing) PARAM_INT(YesNo),
"Rectify text origin bug",
{
DI->RectifyTextOrigin = YesNo;
})
DEFINE_SCRIPT(CONSOLE_OutPut,CATEGORY(CONSOLE) PARAM_STRING(Text),
"Send a text to the console",
{
OutputConsole(Text);
})
DEFINE_SCRIPT(CONSOLE_Clear,CATEGORY(CONSOLE),
"Clear the console",
{
ClearConsole();
})
DEFINE_SCRIPT(CONSOLE_Display,CATEGORY(CONSOLE) PARAM_BOOL(YesNo),
"Clear the console",
{
if (YesNo)
bDrawConsole = 1;
else
bDrawConsole = 0;
})
#ifdef TEST_PHILIPPE
#ifdef NATAL_SUPPORT
DEFINE_SCRIPT(NATAL_LoadChannel,CATEGORY(NATAL) PARAM_INT(Channel) PARAM_STRING(Filename),
"return 0 if OK",
{
u32 NATALSKEL_LoadChannel(u32 Channel , char *Filename);
RETURN_INT(NATALSKEL_LoadChannel(Channel,Filename));
})
DEFINE_SCRIPT(NATAL_SaveChannel,CATEGORY(NATAL) PARAM_INT(Channel) PARAM_STRING(Filename),
"return 0 if OK",
{
u32 NATALSKEL_SaveChannel(u32 Channel , char *Filename);
RETURN_INT(NATALSKEL_SaveChannel(Channel,Filename));
})
DEFINE_SCRIPT(NATAL_ComparePlayers,CATEGORY(NATAL),
"dont touch that!",
{
float NATAL_Compare2Players();
RETURN_FLOAT(NATAL_Compare2Players());
})
DEFINE_SCRIPT(NATAL_SavePosture,CATEGORY(NATAL) PARAM_INT(PlayerIndex) PARAM_INT(Channel) PARAM_INT_OPT(TimeInMilisecond,0),
"dont touch that!",
{
void NATALSKEL_SavePosture(u32 PlayerIndex, u32 Channel , u32 TimeInMilisecond);
NATALSKEL_SavePosture(PlayerIndex,Channel,TimeInMilisecond);
})
DEFINE_SCRIPT(NATAL_LoadPosture,CATEGORY(NATAL) PARAM_INT(PlayerIndex) PARAM_INT(Channel) PARAM_INT_OPT(TimeInMilisecond,0),
"dont touch that!",
{
void NATALSKEL_LoadPosture(u32 PlayerIndex, u32 Channel , u32 TimeInMilisecond);
NATALSKEL_LoadPosture(PlayerIndex,Channel,TimeInMilisecond);
})
DEFINE_SCRIPT(NATAL_ComparePosture,CATEGORY(NATAL) PARAM_INT(Channel1) PARAM_INT(TimeInMiliseconds1) PARAM_INT(Channel2) PARAM_INT(TimeInMiliseconds2) PARAM_INT_OPT(TimeInMiliseconds,0),
"dont touch that!",
{
float NATALSKEL_ComparePosture(u32 Channel1 , u32 TimeInMiliseconds1,u32 Channel2 , u32 TimeInMiliseconds2);
RETURN_FLOAT(NATALSKEL_ComparePosture(Channel1 , TimeInMiliseconds1,Channel2 , TimeInMiliseconds2));
})
DEFINE_SCRIPT(NATAL_GetBone2D,CATEGORY(NATAL) PARAM_MEDIA(Mi) PARAM_INT(NATALBoneNum) PARAM_INT_OPT(Oldness,0),
"dont touch that!",
{
void NATAL_GetBone(INPUT_IO *pMedia,u32 Index , Vector *pDst , u32 Oldness);
Vector Res;
NATAL_GetBone(ID_MEDIA[Mi],NATALBoneNum, &Res , Oldness);
RETURN_VECTOR(&Res);
})
DEFINE_SCRIPT(NATAL_GetBone2DPertinence,CATEGORY(NATAL) PARAM_MEDIA(Mi) PARAM_INT(NATALBoneNum),
"dont touch that!",
{
float NATAL_GetBone2DPertinence(INPUT_IO *pMedia,u32 Index);
RETURN_FLOAT(NATAL_GetBone2DPertinence(ID_MEDIA[Mi],NATALBoneNum));
})
DEFINE_SCRIPT(NATAL_Record,CATEGORY(NATAL) PARAM_MEDIA(Mi) PARAM_INT(Record),
"Record natal stream. Record = 1 = go, Record = 0 = pause",
{
void NATAL_Record(INPUT_IO *pMedia,u32 Record);
NATAL_Record(ID_MEDIA[Mi],Record);
})
DEFINE_SCRIPT(MICHELANCEL_Run,CATEGORY(MEDIA) PARAM_MEDIA(Mi),
"Record natal stream. Record = 1 = go, Record = 0 = pause",
{
void TEST2D(MAP *pSource);
TEST2D(&ID_MEDIA[Mi]->Image);
if (ID_MEDIA[Mi]->ulAssociatedTextureIndex != -1)
DI->UpdateTexture_BM_2_HW(ID_MEDIA[Mi]->ulAssociatedTextureIndex);
})
#endif
/* Philippe TEST */
DEFINE_SCRIPT(TEST_Philippe,CATEGORY(TEST) PARAM_LIST_INT(pra),
"dont touch that!",
{
void TEST_SETWORKINGPARRAMS(int *P,int num);
TEST_SETWORKINGPARRAMS(pra,Nbpra);
})
#endif