// OpenGL display function Mesh::Mesh() { translationX=0; translationY=0; translationZ=0; elevation=0; azimuth=0; twist=0; scale=1; scaleStep=0.05; angleStep=2.0; translationStep=0.05; Camera = CAMERA(); prvX = -1; prvY = -1; }
void main (void) { volatile uint32_t i = 0; /* Dummy idle counter */ uint8_t option; initModesAndClock(); /* Initialize mode entries and system clock */ initPeriClkGen(); /* Initialize peripheral clock generation for DSPIs */ disableWatchdog(); /* Disable watchdog */ initPads(); /* Initialize pads used in example */ initADC(); /* Init. ADC for normal conversions but don't start yet*/ initCTU(); /* Configure desired CTU event(s) */ initEMIOS_0(); /* Initialize eMIOS channels as counter, SAIC, OPWM */ initEMIOS_0ch3(); /* Initialize eMIOS 0 channel 3 as OPWM and channel 2 as SAIC*/ initEMIOS_0ch0(); /* Initialize eMIOS 0 channel 0 as modulus counter*/ initEMIOS_0ch23(); /* Initialize eMIOS 0 channel 23 as modulus counter*/ initEMIOS_0ch4(); /* Initialize eMIOS 0 channel 0 as OPWM, ch 4 as time base */ initEMIOS_0ch6(); /* Initialize eMIOS 0 channel 0 as OPWM, ch 6 as time base */ initEMIOS_0ch7(); /* Initialize eMIOS 0 channel 1 as OPWM, ch 7 as time base */ init_LinFLEX_0_UART(); SIU.PCR[17].R = 0x0200; /* Program the drive enable pin of Right Motor as output*/ SIU.PCR[16].R = 0x0200; /* Program the drive enable pin of Left Motor as output*/ SIU.PGPDO[0].R = 0x00000000; /* Disable the motors */ /* Loop forever */ for (;;) { TransmitData("\n\r**The Freescale Cup**"); TransmitData("\n\r*********************"); TransmitData("\n\r1.Led\n\r"); TransmitData("2.Switch\n\r"); TransmitData("3.Servo\n\r"); TransmitData("4.Motor Left\n\r"); TransmitData("5.Motor Right\n\r"); TransmitData("6.Camera\n\r"); TransmitData("9.Camera 2"); TransmitData("7.Left Motor Current\n\r"); TransmitData("8.Right Motor Current"); TransmitData("\n\r**********************"); option = ReadData(); switch(option) { case '1': LED(); break; case '2': SWITCH(); break; case '3': SERVO(); break; case '4': MOTOR_LEFT(); break; case '5': MOTOR_RIGHT(); break; case '6': CAMERA(); break; case '7': LEFT_MOTOR_CURRENT(); break; case '8': RIGHT_MOTOR_CURRENT(); break; case '9': CAMERA2(); break; default: break; } } }
void HeriswapGame::init(const uint8_t* in, int size) { LOGI("HeriswapGame initialisation begins..."); CAMERA(camera)->clearColor = Color(0.49,0.59,0,1); TRANSFORM(camera)->z = 0; ScoreStorageProxy ssp; //init database LOGI("\t- Init database..."); gameThreadContext->storageAPI->init(gameThreadContext->assetAPI, "Heriswap"); gameThreadContext->storageAPI->setOption("sound", std::string(), "on"); gameThreadContext->storageAPI->setOption("gameCount", std::string(), "0"); gameThreadContext->storageAPI->createTable(&ssp); SuccessManager *sm = new SuccessManager(gameThreadContext->gameCenterAPI); datas = new PrivateData(this, gameThreadContext, sm); datas->Setup(); theSoundSystem.mute = !datas->storageAPI->isOption("sound", "on"); theMusicSystem.toggleMute(theSoundSystem.mute); datas->sky = theEntityManager.CreateEntityFromTemplate("general/sky"); SCROLLING(datas->sky)->images.push_back(HASH("ciel0", 0x89b9427)); SCROLLING(datas->sky)->images.push_back(HASH("ciel1", 0xd296102e)); SCROLLING(datas->sky)->images.push_back(HASH("ciel2", 0x22648ee8)); SCROLLING(datas->sky)->images.push_back(HASH("ciel3", 0x7f710b96)); SCROLLING(datas->sky)->displaySize = glm::vec2(TRANSFORM(datas->sky)->size.x * 1.01, TRANSFORM(datas->sky)->size.y); datas->faderHelper.init(camera); sceneStateMachine.setup(gameThreadContext->assetAPI); if (in && size) { loadGameState(in, size); SCROLLING(datas->sky)->show = true; theBackgroundSystem.showAll(); } else { sceneStateMachine.start(Scene::Logo); } if (gameThreadContext->gameCenterAPI) { datas->gamecenterAPIHelper.init(gameThreadContext->gameCenterAPI, true, true, true, [this] { if (sceneStateMachine.getCurrentState() == Scene::ModeMenu) { int id = datas->mode * difficulty; gameThreadContext->gameCenterAPI->openSpecificLeaderboard(id); } else { gameThreadContext->gameCenterAPI->openDashboard(); } }); } #if SAC_INGAME_EDITORS && SAC_DEBUG HeriswapDebugConsole::init(this); #endif modeMenuIsInNameInput = false; LOGI("HeriswapGame initialisation done."); }
int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) { int32_t j = VM_OnEventWithReturn(EVENT_SOUND, i, screenpeek, num); if (j == -1 && num != -1) // check that the user returned -1, but only if -1 wasn't playing already (in which case, warn) return -1; num = j; const DukePlayer_t *const myps = g_player[myconnectindex].ps; if ((unsigned)num > (unsigned)g_maxSoundPos || ((g_sounds[num].m & SF_ADULT) && ud.lockout) || !ud.config.SoundToggle || (unsigned)i >= MAXSPRITES || !FX_VoiceAvailable(g_sounds[num].pr) || (myps->timebeforeexit > 0 && myps->timebeforeexit <= GAMETICSPERSEC * 3) || (myps->gm & MODE_MENU)) return -1; int32_t voice; if (g_sounds[num].m & SF_DTAG) // Duke-Tag sound { if ((voice = S_PlaySound(num)) <= FX_Ok) return -1; j = 0; while (j < MAXSOUNDINSTANCES && g_sounds[num].SoundOwner[j].voice != voice) j++; if (EDUKE32_PREDICT_FALSE(j >= MAXSOUNDINSTANCES)) { OSD_Printf(OSD_ERROR "%s %d: WTF?\n", __FILE__, __LINE__); return -1; } g_sounds[num].SoundOwner[j].ow = i; return voice; } // Duke talk if (g_sounds[num].m & SF_TALK) { if ((g_netServer || ud.multimode > 1) && PN == APLAYER && P_Get(i) != screenpeek) // other player sound { if (!(ud.config.VoiceToggle&4)) return -1; } else if (!(ud.config.VoiceToggle&1)) return -1; // don't play if any Duke talk sounds are already playing for (j=0; j<g_maxSoundPos; ++j) if ((g_sounds[j].m & SF_TALK) && g_sounds[j].num > 0) return -1; } int32_t sndist, sndang; int32_t explosionp = S_CalcDistAndAng(i, num, CAMERA(sect), CAMERA(ang), &CAMERA(pos), pos, &sndist, &sndang); int32_t pitch = S_GetPitch(num); const DukePlayer_t *peekps = g_player[screenpeek].ps; #ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { // splitscreen HACK if (g_player[1].ps->i == i) peekps = g_player[1].ps; } #endif if (peekps->sound_pitch) pitch += peekps->sound_pitch; if (explosionp) { if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER) pitch -= 1024; } else { if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & (SF_LOOP|SF_MSFX)) == 0) return -1; if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER && (g_sounds[num].m & SF_TALK) == 0) pitch = -768; } if (g_sounds[num].num > 0 && PN != MUSICANDSFX) S_StopEnvSound(num, i); if (g_sounds[num].ptr == 0) { if (S_LoadSound(num) == 0) return -1; } else { if (g_soundlocks[num] < 200) g_soundlocks[num] = 200; else g_soundlocks[num]++; } j = S_GetSlot(num); if (j >= MAXSOUNDINSTANCES) { g_soundlocks[num]--; return -1; } { const int32_t repeatp = (g_sounds[num].m & SF_LOOP); const int32_t ambsfxp = S_IsAmbientSFX(i); if (repeatp && (g_sounds[num].m & SF_ONEINST_INTERNAL) && g_sounds[num].num > 0) { g_soundlocks[num]--; return -1; } if (repeatp && !ambsfxp) { voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, pitch, FX_VOLUME(sndist>>6), FX_VOLUME(sndist>>6), 0, // XXX: why is 'right' 0? g_sounds[num].pr, (num * MAXSOUNDINSTANCES) + j); } else {