// // DU_MenuRun // void DU_MenuRun(Menu *menu) { int msgid = BASE_MSGID; // Read buttons. int buttons = ACS_GetPlayerInput(-1, INPUT_BUTTONS); int buttonsOld = ACS_GetPlayerInput(-1, INPUT_OLDBUTTONS); int buttonsNew = buttons & ~buttonsOld; // Poll and cap cursor movement. accum inputX = ACS_GetPlayerInputFixed(-1, INPUT_YAW); accum inputY = ACS_GetPlayerInputFixed(-1, INPUT_PITCH); if(ACS_GetCVar(s"invertmouse")) inputY = -inputY; menu->x -= inputX * menu->w * 2; menu->y -= inputY * menu->h * 2; if(menu->x < 0) menu->x = 0; if(menu->x > menu->w) menu->x = menu->w; if(menu->y < 0) menu->y = 0; if(menu->y > menu->h) menu->y = menu->h; if(menu->run) menu->run(menu); // Draw cursor. DU_MenuHudImage(menu, msgid++, s"CURSOR", (int)menu->x+0.1k, (int)menu->y+0.1k); // Draw buttons. for(MenuButton *button = menu->buttons; button; button = button->next) { if(button->run) button->run(button); int x = button->x + button->w/2; int y = button->y + button->h/2; DU_MenuHudText(menu, msgid++, button->txt, button->color, x, y); if(button->img[0]) DU_MenuHudImage(menu, msgid++, button->img, x, y); else DU_MenuHudClear(menu, msgid++); } // Draw labels. for(MenuLabel *label = menu->labels; label; label = label->next) { if(label->run) label->run(label); int x = label->x + label->w/2; int y = label->y + label->h/2; DU_MenuHudText(menu, msgid++, label->txt, label->color, x, y); if(label->img[0]) DU_MenuHudImage(menu, msgid++, label->img, x, y); else DU_MenuHudClear(menu, msgid++); } // Draw texts. for(MenuText *text = menu->texts; text; text = text->next) { if(text->run) text->run(text); accum x = (int)text->x + 0.1; accum y = (int)text->y + 0.1; DU_MenuHudText(menu, msgid++, text->txt, text->color, x, y); } // Mouse-over events. for(MenuButton *button = menu->buttons; button; button = button->next) { if(button->hover && menu->x >= button->x && menu->x < button->x + button->w && menu->y >= button->y && menu->y < button->y + button->h) { button->hover(button); } } // Click events. if(buttonsNew & BT_ATTACK) { for(MenuButton *button = menu->buttons; button; button = button->next) { if(button->click && menu->x >= button->x && menu->x < button->x + button->w && menu->y >= button->y && menu->y < button->y + button->h) { button->click(button); } } } }
// Scripts ACS_S_SCRIPT ENTER void CameraMain (void) { int plrHealth, camType, plrNum = ACS_PlayerNumber(); accum plrAngle = ACS_GetActorAngle(0); player[plrNum].angle = plrAngle; if (!ACS_ActivatorTID()) ACS_Thing_ChangeTID(0, ACS_UniqueTID(-32678, 0)); player[plrNum].tid = ACS_ActivatorTID(); player[plrNum].camTid = ACS_UniqueTID(-32768, 0); ACS_SpawnForced(s"ChaseCam", ACS_GetActorX(0), ACS_GetActorY(0), ACS_GetActorZ(0), player[plrNum].camTid, player[plrNum].angle); while (true) { plrHealth = ACS_GetActorProperty(0, APROP_Health); player[plrNum].angle += ACS_GetPlayerInputFixed(-1, INPUT_YAW); player[plrNum].pitch -= ACS_GetPlayerInputFixed(-1, INPUT_PITCH); if (player[plrNum].pitch > PITCH_LIMIT) player[plrNum].pitch = PITCH_LIMIT; if (player[plrNum].pitch < -PITCH_LIMIT) player[plrNum].pitch = -PITCH_LIMIT; ACS_LineAttack(0, player[plrNum].angle + 0.5k, -player[plrNum].pitch, 0, s"ChaseCamWaypoint", s"", ACS_GetCVarFixed(s"chase_dist"), FHF_NORANDOMPUFFZ); ACS_SetActorAngle(player[plrNum].camTid, player[plrNum].angle); ACS_SetActorPitch(player[plrNum].camTid, player[plrNum].pitch); camType = ACS_GetUserCVar(plrNum, s"chase_camtype"); if (plrHealth) { switch (camType) { default: case 1: plrAngle = player[plrNum].angle; break; case 2: if (KeyDown(BT_FORWARD) || KeyDown(BT_BACK) || KeyDown(BT_MOVELEFT) || KeyDown(BT_MOVERIGHT) || KeyDown(BT_ATTACK) || KeyDown(BT_ALTATTACK)) plrAngle = player[plrNum].angle; break; case 3: if (KeyDown(BT_FORWARD) || KeyDown(BT_BACK) || KeyDown(BT_MOVELEFT) || KeyDown(BT_MOVERIGHT)) plrAngle = player[plrNum].angle; break; } } if (ACS_GetUserCVar(plrNum, s"chase_active")) ACS_ChangeCamera(player[plrNum].camTid, 0, 0); else { if (plrHealth) plrAngle = player[plrNum].angle; ACS_ChangeCamera(0, 0, 0); } ACS_SetActorAngle(0, plrAngle); ACS_SetActorPitch(0, player[plrNum].pitch); ACS_Delay(1); } return; }