2#include "message_ids.h"
5#include "sprite/npc/ChuckQuizmo.h"
6#include "sprite/player.h"
8#ifndef CHUCK_QUIZMO_NPC_ID
9 #error CHUCK_QUIZMO_NPC_ID must be defined for Quizmo.inc.c
14 .idle = ANIM_ChuckQuizmo_Idle, \
15 .walk = ANIM_ChuckQuizmo_Walk, \
16 .run = ANIM_ChuckQuizmo_Run, \
17 .chase = ANIM_ChuckQuizmo_Run, \
18 .anim_4 = ANIM_ChuckQuizmo_Idle, \
19 .anim_5 = ANIM_ChuckQuizmo_Idle, \
20 .death = ANIM_ChuckQuizmo_Still, \
21 .hit = ANIM_ChuckQuizmo_Still, \
22 .anim_8 = ANIM_ChuckQuizmo_Run, \
23 .anim_9 = ANIM_ChuckQuizmo_Run, \
24 .anim_A = ANIM_ChuckQuizmo_Run, \
25 .anim_B = ANIM_ChuckQuizmo_Run, \
26 .anim_C = ANIM_ChuckQuizmo_Run, \
27 .anim_D = ANIM_ChuckQuizmo_Run, \
28 .anim_E = ANIM_ChuckQuizmo_Run, \
29 .anim_F = ANIM_ChuckQuizmo_Run, \
36extern u8 MessagePlural_de[];
39BSS s32 N(Quizmo_Worker);
40BSS s32 N(Quizmo_ScriptArray)[5];
108u8 N(Quizmo_Answers)[64] = {
109 2, 1, 1, 2, 2, 0, 2, 0,
110 2, 1, 0, 2, 1, 1, 0, 2,
111 0, 2, 1, 0, 0, 2, 1, 0,
112 2, 1, 1, 2, 2, 1, 1, 1,
113 0, 2, 2, 2, 2, 0, 1, 1,
114 2, 1, 2, 1, 2, 0, 0, 1,
115 1, 0, 1, 2, 1, 0, 2, 2,
116 1, 2, 0, 2, 2, 1, 1, 1,
132API_CALLABLE(N(Quizmo_HideEntities)) {
137API_CALLABLE(N(Quizmo_ShowEntities)) {
142API_CALLABLE(N(Quizmo_ShouldAppear)) {
143 Enemy* enemy = script->owner1.enemy;
152 u16 curTown1 = (enemy->varTable[0] & 0xFF0000) >> 16;
153 u16 curTown2 = (enemy->varTable[0] & 0xFF0000) >> 16;
154 u16 numMaps = (enemy->varTable[0] & 0xFF00) >> 8;
155 u16 curMap = (enemy->varTable[0] & 0xFF) >> 0;
159 if (curTown1 != locTown) {
160 changedLocation = FALSE;
180 for (i = 0; i < 8; i++) {
181 if (progress < N(Quizmo_Requirements)[i].requiredStoryProgress) {
187 progress = numAnswered < N(Quizmo_Requirements)[i].numQuestionsUnlocked;
188 test2 = var = progress;
190 if ((((curTown2 == locTown) && (curMap == locMap) && (changedLocation == 0) && test2)) ||
192 script->varTable[0] = TRUE;
195 script->varTable[0] = FALSE;
203API_CALLABLE(N(Quizmo_RenderInit)) {
213API_CALLABLE(N(Quizmo_NPC_Aux_Impl)) {
227API_CALLABLE(N(Quizmo_HideWorld)) {
237 if (npc != NULL && npc->
flags != 0) {
251 script->functionTemp[0] = 0;
254 script->functionTemp[0] += 8;
255 if (script->functionTemp[0] > 255) {
256 script->functionTemp[0] = 255;
261 if (script->functionTemp[0] == 255) {
268API_CALLABLE(N(Quizmo_FadeInWorld)) {
273 script->functionTemp[0] = 255;
274 script->functionTemp[1] = 0;
277 script->functionTemp[0] -= 8;
278 if (script->functionTemp[0] < 0) {
279 script->functionTemp[0] = 0;
283 if (script->functionTemp[0] == 0 && script->functionTemp[1] == 0) {
284 script->functionTemp[1] = 1;
285 }
else if (script->functionTemp[1] == 1) {
291 if (npc != NULL && npc->
flags != 0) {
293 npc->
flags &= ~NPC_FLAG_HIDING;
301 entity->
flags &= ~ITEM_ENTITY_FLAG_HIDING;
311API_CALLABLE(N(Quizmo_UpdateRecords)) {
314 if (quizzesAnswered < 999) {
319 script->varTable[0] = 1;
322 script->varTable[0] = 0;
328API_CALLABLE(N(Quizmo_CreateStage)) {
332 N(Quizmo_StageEffect) = fx_quizmo_stage(0,
336 N(Quizmo_AudienceEffect) = fx_quizmo_audience(0,
340 N(Quizmo_VannaTEffect) = fx_quizmo_assistant(0,
346 stageData = N(Quizmo_StageEffect)->data.quizmoStage;
354 stageData = N(Quizmo_StageEffect)->data.quizmoStage;
369API_CALLABLE(N(Quizmo_DestroyEffects)) {
377 stageData = N(Quizmo_StageEffect)->data.quizmoStage;
394API_CALLABLE(N(Quizmo_SetStageLightsDelay)) {
395 N(Quizmo_StageEffect)->data.quizmoStage->lightScrollDelay =
evt_get_variable(script, *script->ptrReadPos);
399API_CALLABLE(N(Quizmo_UnkStageEffectMode)) {
421API_CALLABLE(N(Quizmo_SetVannaAnim_Idle)) {
422 N(Quizmo_VannaTEffect)->data.quizmoAssistant->anim = 0;
426API_CALLABLE(N(Quizmo_SetVannaAnim_Clap)) {
427 N(Quizmo_VannaTEffect)->data.quizmoAssistant->anim = 1;
431API_CALLABLE(N(Quizmo_SetVannaAnim_Wave)) {
432 N(Quizmo_VannaTEffect)->data.quizmoAssistant->anim = 2;
436API_CALLABLE(N(Quizmo_ShouldQuizmoLeave)) {
441API_CALLABLE(N(Quizmo_SetCamVfov)) {
442 Bytecode* args = script->ptrReadPos;
449API_CALLABLE(N(Quizmo_GetCamVfov)) {
450 Bytecode* args = script->ptrReadPos;
457API_CALLABLE(N(Quizmo_AddViewRelativeOffset)) {
458 Bytecode* args = script->ptrReadPos;
478API_CALLABLE(N(Quizmo_SpinPlayer)) {
482 script->functionTemp[0] = 60;
490 script->functionTemp[0]--;
492 if (script->functionTemp[0] < 0) {
499API_CALLABLE(N(Quizmo_SpinPartner)) {
503 script->functionTemp[0] = 60;
506 partner->
yaw += 30.0f;
507 if (partner->
yaw >= 360.0f) {
508 partner->
yaw -= 360.0f;
511 script->functionTemp[0]--;
513 if (script->functionTemp[0] < 0) {
520API_CALLABLE(N(Quizmo_UpdatePartnerPosition)) {
522 f32* x = (f32*) &script->functionTemp[1];
523 f32* y = (f32*) &script->functionTemp[2];
524 f32* z = (f32*) &script->functionTemp[3];
530 script->functionTemp[0] = 60;
536 script->functionTemp[0]--;
538 if (script->functionTemp[0] == 0) {
549 fx_quizmo_answer(0, 0, 0, 0);
550 }
else if (result == 2) {
551 fx_quizmo_answer(1, 0, 0, 0);
555API_CALLABLE(N(Quizmo_CreateWorker)) {
561 Call(N(Quizmo_ShouldQuizmoLeave))
576 Call(N(Quizmo_SetCamVfov), 0, 25)
599EvtScript N(EVS_Quizmo_OtherCamScript) = {
624EvtScript N(EVS_Quizmo_MovePlayerToPodium) = {
648 Call(N(Quizmo_SpinPlayer))
655EvtScript N(EVS_Quizmo_MovePartnerToPodium) = {
661 Call(N(Quizmo_UpdatePartnerPosition))
670 Call(N(Quizmo_SpinPartner))
677EvtScript N(EVS_Quizmo_MoveQuizmoToMicrophone) = {
703EvtScript N(EVS_Quizmo_SetCharacterPositons) = {
704 Exec(N(EVS_Quizmo_MovePlayerToPodium))
705 Exec(N(EVS_Quizmo_MovePartnerToPodium))
706 ExecWait(N(EVS_Quizmo_MoveQuizmoToMicrophone))
711EvtScript N(EVS_Quizmo_PlayerThinking) = {
720EvtScript N(EVS_Quizmo_PlayerHitBuzzer) = {
728EvtScript N(EVS_Quizmo_PlayerReaction_RightAnswer) = {
901EvtScript N(EVS_Quizmo_PlayerReaction_WrongAnswer) = {
910EvtScript N(EVS_Quizmo_ReturnPlayerToOriginalPos) = {
937 ExecWait(N(EVS_Quizmo_ReturnPlayerToOriginalPos))
953 ExecWait(N(EVS_Quizmo_ReturnPlayerToOriginalPos))
977 Call(
ContinueSpeech, -1, ANIM_ChuckQuizmo_Talk, ANIM_ChuckQuizmo_Idle, 0, MSG_MGM_000C)
983 Call(N(Quizmo_HideEntities))
984 Call(N(Quizmo_HideWorld))
985 Exec(N(EVS_Quizmo_SetQuizCamera))
993 Call(
ContinueSpeech, -1, ANIM_ChuckQuizmo_Talk, ANIM_ChuckQuizmo_Idle, 0, MSG_MGM_000B)
1002 Call(N(Quizmo_CreateStage))
1019 Exec(N(EVS_Quizmo_PlayerHitBuzzer))
1022 Call(N(Quizmo_UnkStageEffectMode),
LVar0)
1024 Call(N(Quizmo_CreateWorker))
1026 Call(N(Quizmo_UpdateRecords))
1036 Call(N(Quizmo_SetStageLightsDelay), 1)
1040 Call(N(Quizmo_SetStageLightsDelay), 2)
1052 Call(N(Quizmo_SetVannaAnim_Clap))
1090 Call(N(Quizmo_SetStageLightsDelay), 15)
1091 Call(N(Quizmo_SetVannaAnim_Idle))
1109 Call(N(Quizmo_SetStageLightsDelay), 15)
1110 Call(N(Quizmo_SetVannaAnim_Idle))
1112#if VERSION_US || VERSION_IQUE
1152 Call(N(Quizmo_UnkStageEffectMode), -1)
1162 Call(N(Quizmo_SetVannaAnim_Wave))
1163 Call(N(Quizmo_DestroyEffects))
1165 Exec(N(EVS_Quizmo_ResetCamera))
1166 Call(N(Quizmo_FadeInWorld))
1167 Call(N(Quizmo_ShowEntities))
1174 Call(N(Quizmo_ShouldAppear))
1180 Call(N(Quizmo_RenderInit))
1198 Call(N(Quizmo_NPC_Aux_Impl))
1207 .playerSearchInterval = -1,
1212 Call(BasicAI_Main,
Ref(N(Quizmo_MobileAISettings)))
1219 .defaultAnim = ANIM_ChuckQuizmo_Idle,
1222 .otherAI = &N(EVS_Quizmo_NPC_OtherAI),
1223 .onInteract = &N(EVS_Quizmo_NPC_Interact),
1224 .aux = &N(EVS_Quizmo_NPC_Aux),
1226 .level = ACTOR_LEVEL_NONE,
1231 .defaultAnim = ANIM_ChuckQuizmo_Idle,
1234 .otherAI = &N(EVS_Quizmo_NPC_OtherAI),
1235 .onInteract = &N(EVS_Quizmo_NPC_Interact),
1236 .ai = &N(EVS_Quizmo_Npc_AI),
1237 .aux = &N(EVS_Quizmo_NPC_Aux),
1239 .level = ACTOR_LEVEL_NONE,
@ QUIZ_ARRAY_INDEX_ORIGIN_Z
@ QUIZ_ARRAY_INDEX_ORIGIN_Y
@ QUIZ_ARRAY_INDEX_ORIGIN_X
@ QUIZ_ARRAY_INDEX_ANSWER_RESULT
@ QUIZ_ARRAY_INDEX_SAVED_FOV
void N Quizmo_CreateReactionEffect(void)
void N Quizmo_NPC_OnRender(Npc *npc)
@ QUIZ_ARRAY_ANSWER_RESULT
@ FX_INSTANCE_FLAG_DISMISS
@ STORY_CH0_KAMMY_RETURNED_TO_BOWSER
@ STORY_CH2_BEGAN_PEACH_MISSION
@ STORY_CH1_BEGAN_PEACH_MISSION
@ STORY_CH7_BEGAN_PEACH_MISSION
@ STORY_CH3_BEGAN_PEACH_MISSION
@ STORY_CH6_BEGAN_PEACH_MISSION
@ STORY_CH4_BEGAN_PEACH_MISSION
@ STORY_CH5_STAR_SPRIT_DEPARTED
@ ITEM_ENTITY_FLAG_HIDING
@ PS_FLAG_MOVEMENT_LOCKED
@ ENEMY_FLAG_IGNORE_ENTITY_COLLISION
@ SOUND_LRAW_QUIZ_TICKING
@ SOUND_LRAW_AUDIENCE_MURMUR
#define BASE_PASSIVE_FLAGS
@ NPC_FLAG_IGNORE_WORLD_COLLISION
@ NPC_FLAG_IGNORE_PLAYER_COLLISION
s32 evt_get_variable(Evt *script, Bytecode var)
ItemEntity * get_item_entity(s32 itemEntityIndex)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
void mdl_set_all_tint_type(s32)
f32 evt_get_float_variable(Evt *script, Bytecode var)
s32 create_worker_frontUI(void(*updateFunc)(void), void(*drawFunc)(void))
void * heap_malloc(s32 size)
void mdl_set_shroud_tint_params(u8 r, u8 g, u8 b, u8 a)
#define ContinueSpeech(ARGS...)
#define SpeakToPlayer(ARGS...)
void kill_enemy(Enemy *enemy)
Npc * get_npc_unsafe(s32 npcID)
Npc * get_npc_by_index(s32 listIndex)
@ GB_ChuckQuizmo_Map
doesnt correspond to mapID
@ GB_ChuckQuizmo_Town
0-6, doesnt correspond to areaID
@ GF_Quizmo_ChangedLocation
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerPos(Evt *script, b32 isInitialCall)
Sets the player position.
ApiStatus DisablePartnerAI(Evt *script, b32 isInitialCall)
ApiStatus SetCamPitch(Evt *script, b32 isInitialCall)
ApiStatus AddStarPieces(Evt *script, b32 isInitialCall)
ApiStatus GetCamPitch(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerAnimation(Evt *script, b32 isInitialCall)
ApiStatus PanToTarget(Evt *script, b32 isInitialCall)
ApiStatus SetCamType(Evt *script, b32 isInitialCall)
ApiStatus GetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus SetMessageText(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
ApiStatus StopSound(Evt *script, b32 isInitialCall)
ApiStatus FacePlayerTowardPoint(Evt *script, b32 isInitialCall)
ApiStatus EnablePartnerAI(Evt *script, b32 isInitialCall)
ApiStatus ShowChoice(Evt *script, b32 isInitialCall)
ApiStatus GetCamType(Evt *script, b32 isInitialCall)
ApiStatus SetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus NpcFacePlayer(Evt *script, b32 isInitialCall)
ApiStatus SetNpcJumpscale(Evt *script, b32 isInitialCall)
ApiStatus SetCamDistance(Evt *script, b32 isInitialCall)
ApiStatus PlayerMoveTo(Evt *script, b32 isInitialCall)
ApiStatus WaitForCam(Evt *script, b32 isInitialCall)
ApiStatus SetNpcSprite(Evt *script, b32 isInitialCall)
ApiStatus GetCamDistance(Evt *script, b32 isInitialCall)
ApiStatus SetCamLeadPlayer(Evt *script, b32 isInitialCall)
ApiStatus DisablePlayerPhysics(Evt *script, b32 isInitialCall)
Disables player physics if disable is TRUE, enables it if FALSE.
ApiStatus NpcMoveTo(Evt *script, b32 isInitialCall)
ApiStatus SetNpcFlagBits(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerFlagBits(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerPos(Evt *script, b32 isInitialCall)
ApiStatus UseSettingsFrom(Evt *script, b32 isInitialCall)
ApiStatus SetPanTarget(Evt *script, b32 isInitialCall)
ApiStatus SetCamSpeed(Evt *script, b32 isInitialCall)
ApiStatus SetMessageValue(Evt *script, b32 isInitialCall)
ApiStatus CloseChoice(Evt *script, b32 isInitialCall)
#define ArrayVar(INDEX)
User Word.
#define FLOAT_TO_FIXED(x)
Progammatically converts f32 --> Float.
#define Else
Marks the end of an if statement and the start of the else block.
#define Ref(sym)
Address/pointer constant.
#define DivF(VAR, FLOAT_VALUE)
#define MAX_ITEM_ENTITIES
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
#define AddF(VAR, FLOAT_VALUE)
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
#define Add(VAR, INT_VALUE)
#define EndLoop
Marks the end of a loop.
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
#define IsThreadRunning(TID, OUTVAR)
Sets OUTVAR to TRUE/FALSE depending on whether a thread with the given ID exists (i....
#define EndIf
Marks the end of an if statement or an else block.
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
#define IfLe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR > RVAR.
#define BreakLoop
Breaks out of the innermost loop.
#define Thread
Marks the start of a thread block.
#define EndThread
Marks the end of a thread block.
#define KillThread(TID)
Kills a thread by its thread ID.
#define UseArray(INT_PTR)
Loads an s32 array pointer into the current thread for use with ArrayVar(INDEX).
#define SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
#define MulF(VAR, FLOAT_VALUE)
#define ExecGetTID(EVT_SOURCE, OUTVAR)
Identical to Exec, but the newly-launched thread ID is stored in OUTVAR.
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
#define NPC_DISPOSE_LOCATION
#define SubF(VAR, FLOAT_VALUE)
#define PlayEffect(args...)
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
#define Loop(TIMES)
Marks the beginning of a loop.
#define Exec(EVT_SOURCE)
Launches a new thread.
#define Return
Kills the current EVT thread.
void(* onRender)(struct Npc *)
Run after the display list for this NPC is built.
GameStatus * gGameStatusPtr
u8 * gBackgroundTintModePtr
PlayerStatus gPlayerStatus