diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 28f010ef2..8d65f602d 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -604,9 +604,8 @@ .endm @ Blocks script execution until the movements being applied to the specified (localId) object finish. - @ If the specified object is 0, then the command will block script execution until all objects - @ affected by applymovement finish their movements. If the specified object is not currently being - @ manipulated with applymovement, then this command does nothing. + @ If localId is 0, then the id of the last-moved object will be used instead. If the specified object + @ is not currently being manipulated with applymovement, then this command does nothing. @ If no map is specified, then the current map is used. .macro waitmovement localId:req, map .ifb \map diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 48ec7918a..51b7f966e 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -80,16 +80,16 @@ gScriptCmdTable:: .4byte ScrCmd_checkdecor @ 0x4d .4byte ScrCmd_checkdecorspace @ 0x4e .4byte ScrCmd_applymovement @ 0x4f - .4byte ScrCmd_applymovement_at @ 0x50 + .4byte ScrCmd_applymovementat @ 0x50 .4byte ScrCmd_waitmovement @ 0x51 - .4byte ScrCmd_waitmovement_at @ 0x52 + .4byte ScrCmd_waitmovementat @ 0x52 .4byte ScrCmd_removeobject @ 0x53 - .4byte ScrCmd_removeobject_at @ 0x54 + .4byte ScrCmd_removeobjectat @ 0x54 .4byte ScrCmd_addobject @ 0x55 - .4byte ScrCmd_addobject_at @ 0x56 + .4byte ScrCmd_addobjectat @ 0x56 .4byte ScrCmd_setobjectxy @ 0x57 - .4byte ScrCmd_showobject_at @ 0x58 - .4byte ScrCmd_hideobject_at @ 0x59 + .4byte ScrCmd_showobjectat @ 0x58 + .4byte ScrCmd_hideobjectat @ 0x59 .4byte ScrCmd_faceplayer @ 0x5a .4byte ScrCmd_turnobject @ 0x5b .4byte ScrCmd_trainerbattle @ 0x5c diff --git a/include/bike.h b/include/bike.h index afe773d42..00f11aefe 100644 --- a/include/bike.h +++ b/include/bike.h @@ -17,11 +17,11 @@ struct BikeHistoryInputInfo // Player speeds enum { - BIKE_SPEED_STANDING, - BIKE_SPEED_NORMAL, - BIKE_SPEED_FAST, - BIKE_SPEED_FASTER, - BIKE_SPEED_FASTEST, + PLAYER_SPEED_STANDING, + PLAYER_SPEED_NORMAL, + PLAYER_SPEED_FAST, + PLAYER_SPEED_FASTER, + PLAYER_SPEED_FASTEST, }; // mach bike transitions enum diff --git a/src/bike.c b/src/bike.c index 20166392e..c99d514cb 100644 --- a/src/bike.c +++ b/src/bike.c @@ -108,7 +108,7 @@ static u8 (*const sAcroBikeInputHandlers[])(u8 *, u16, u16) = }; // used with bikeFrameCounter from mach bike -static const u16 sMachBikeSpeeds[] = {BIKE_SPEED_NORMAL, BIKE_SPEED_FAST, BIKE_SPEED_FASTEST}; +static const u16 sMachBikeSpeeds[] = {PLAYER_SPEED_NORMAL, PLAYER_SPEED_FAST, PLAYER_SPEED_FASTEST}; // this is a list of timers to compare against later, terminated with 0. the only timer being compared against is 4 frames in this list. static const u8 sAcroBikeJumpTimerList[] = {4, 0}; @@ -147,7 +147,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling) if (*dirTraveling == 0) { *dirTraveling = direction; // update the direction, since below we either faced a direction or we started moving. - if (gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed == PLAYER_SPEED_STANDING) { gPlayerAvatar.runningState = NOT_MOVING; return MACH_TRANS_FACE_DIRECTION; @@ -159,7 +159,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling) // we need to check if the last traveled direction changed from the new direction as well as ensuring that we dont update the state while the player is moving: see the else check. if (*dirTraveling != direction && gPlayerAvatar.runningState != MOVING) { - if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed != PLAYER_SPEED_STANDING) { *dirTraveling = direction; // implement the new direction gPlayerAvatar.runningState = MOVING; @@ -246,7 +246,7 @@ static void MachBikeTransition_TrySlowDown(u8 direction) { u8 collision; - if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed != PLAYER_SPEED_STANDING) gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed; collision = GetBikeCollision(direction); @@ -306,7 +306,7 @@ static u8 AcroBikeHandleInputNormal(u8 *newDirection, u16 newKeys, u16 heldKeys) return ACRO_TRANS_FACE_DIRECTION; } } - if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING) + if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == PLAYER_SPEED_STANDING) { gPlayerAvatar.bikeSpeed++; gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_MOVING; @@ -342,7 +342,7 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys if (*newDirection == AcroBike_GetJumpDirection()) { Bike_SetBikeStill(); // Bike_SetBikeStill sets speed to standing, but the next line immediately overrides it. could have just reset acroBikeState to 0 here instead of wasting a jump. - gPlayerAvatar.bikeSpeed = BIKE_SPEED_NORMAL; + gPlayerAvatar.bikeSpeed = PLAYER_SPEED_NORMAL; if (*newDirection == GetOppositeDirection(direction)) { // do a turn jump. @@ -775,7 +775,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u else { Bike_UpdateDirTimerHistory(direction); - gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; + gPlayerAvatar.bikeSpeed = PLAYER_SPEED_STANDING; } direction = heldKeys & (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON); // directions is reused for some reason. @@ -787,7 +787,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u else { Bike_UpdateABStartSelectHistory(direction); - gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; + gPlayerAvatar.bikeSpeed = PLAYER_SPEED_STANDING; } } @@ -994,7 +994,7 @@ void BikeClearState(int newDirHistory, int newAbStartHistory) gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL; gPlayerAvatar.newDirBackup = DIR_NONE; gPlayerAvatar.bikeFrameCounter = 0; - gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; + gPlayerAvatar.bikeSpeed = PLAYER_SPEED_STANDING; gPlayerAvatar.directionHistory = newDirHistory; gPlayerAvatar.abStartSelectHistory = newAbStartHistory; @@ -1014,7 +1014,7 @@ void Bike_UpdateBikeCounterSpeed(u8 counter) static void Bike_SetBikeStill(void) { gPlayerAvatar.bikeFrameCounter = 0; - gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; + gPlayerAvatar.bikeSpeed = PLAYER_SPEED_STANDING; } s16 GetPlayerSpeed(void) @@ -1027,11 +1027,11 @@ s16 GetPlayerSpeed(void) if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) return machSpeeds[gPlayerAvatar.bikeFrameCounter]; else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE) - return BIKE_SPEED_FASTER; + return PLAYER_SPEED_FASTER; else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH)) - return BIKE_SPEED_FAST; + return PLAYER_SPEED_FAST; else - return BIKE_SPEED_NORMAL; + return PLAYER_SPEED_NORMAL; } void Bike_HandleBumpySlopeJump(void) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 8d6b564d2..b5fcfdadf 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -94,7 +94,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) if ((tileTransitionState == T_TILE_CENTER && forcedMove == FALSE) || tileTransitionState == T_NOT_MOVING) { - if (GetPlayerSpeed() != 4) + if (GetPlayerSpeed() != PLAYER_SPEED_FASTEST) { if (newKeys & START_BUTTON) input->pressedStartButton = TRUE; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 6cf468b3e..a5703b8bd 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -557,7 +557,7 @@ static bool8 ForcedMovement_MuddySlope(void) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - if (playerObjEvent->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3) + if (playerObjEvent->movementDirection != DIR_NORTH || GetPlayerSpeed() < PLAYER_SPEED_FASTEST) { Bike_UpdateBikeCounterSpeed(0); playerObjEvent->facingDirectionLocked = TRUE; diff --git a/src/field_tasks.c b/src/field_tasks.c index 760d85369..244036471 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -820,7 +820,7 @@ static void CrackedFloorPerStepCallback(u8 taskId) tPrevY = y; if (MetatileBehavior_IsCrackedFloor(behavior)) { - if (GetPlayerSpeed() != BIKE_SPEED_FASTEST) + if (GetPlayerSpeed() != PLAYER_SPEED_FASTEST) VarSet(VAR_ICE_STEP_COUNT, 0); // this var does double duty if (tFloor1Delay == 0) diff --git a/src/region_map.c b/src/region_map.c index 0dc902674..09e2d69bf 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1516,28 +1516,26 @@ static void UnhideRegionMapPlayerIcon(void) } } +#define sY data[0] +#define sX data[1] +#define sVisible data[2] +#define sTimer data[7] + static void SpriteCB_PlayerIconMapZoomed(struct Sprite *sprite) { sprite->x2 = -2 * gRegionMap->scrollX; sprite->y2 = -2 * gRegionMap->scrollY; - sprite->data[0] = sprite->y + sprite->y2 + sprite->centerToCornerVecY; - sprite->data[1] = sprite->x + sprite->x2 + sprite->centerToCornerVecX; - if (sprite->data[0] < -8 || sprite->data[0] > 0xa8 || sprite->data[1] < -8 || sprite->data[1] > 0xf8) - { - sprite->data[2] = FALSE; - } + sprite->sY = sprite->y + sprite->y2 + sprite->centerToCornerVecY; + sprite->sX = sprite->x + sprite->x2 + sprite->centerToCornerVecX; + if (sprite->sY < -8 || sprite->sY > DISPLAY_HEIGHT + 8 || sprite->sX < -8 || sprite->sX > DISPLAY_WIDTH + 8) + sprite->sVisible = FALSE; else - { - sprite->data[2] = TRUE; - } - if (sprite->data[2] == TRUE) - { + sprite->sVisible = TRUE; + + if (sprite->sVisible == TRUE) SpriteCB_PlayerIcon(sprite); - } else - { sprite->invisible = TRUE; - } } static void SpriteCB_PlayerIconMapFull(struct Sprite *sprite) @@ -1549,9 +1547,9 @@ static void SpriteCB_PlayerIcon(struct Sprite *sprite) { if (gRegionMap->blinkPlayerIcon) { - if (++sprite->data[7] > 16) + if (++sprite->sTimer > 16) { - sprite->data[7] = 0; + sprite->sTimer = 0; sprite->invisible = sprite->invisible ? FALSE : TRUE; } } @@ -1567,6 +1565,11 @@ void TrySetPlayerIconBlink(void) gRegionMap->blinkPlayerIcon = TRUE; } +#undef sY +#undef sX +#undef sVisible +#undef sTimer + u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength) { u8 *str; @@ -1709,7 +1712,7 @@ void CB2_OpenFlyMap(void) gMain.state++; break; case 7: - LoadPalette(sRegionMapFramePal, 0x10, 0x20); + LoadPalette(sRegionMapFramePal, 0x10, sizeof(sRegionMapFramePal)); PutWindowTilemap(2); FillWindowPixelBuffer(2, PIXEL_FILL(0)); AddTextPrinterParameterized(2, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL); diff --git a/src/rotating_gate.c b/src/rotating_gate.c index 23fbb3e1d..3f73698a8 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -684,13 +684,11 @@ static void RotatingGate_LoadPuzzleConfig(void) { case PUZZLE_FORTREE_CITY_GYM: gRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig; - gRotatingGate_PuzzleCount = - sizeof(sRotatingGate_FortreePuzzleConfig) / sizeof(struct RotatingGatePuzzle); + gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig); break; case PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6: gRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig; - gRotatingGate_PuzzleCount = - sizeof(sRotatingGate_TrickHousePuzzleConfig) / sizeof(struct RotatingGatePuzzle); + gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig); break; case PUZZLE_NONE: default: @@ -698,9 +696,7 @@ static void RotatingGate_LoadPuzzleConfig(void) } for (i = 0; i < ROTATING_GATE_PUZZLE_MAX - 1; i++) - { gRotatingGate_GateSpriteIds[i] = MAX_SPRITES; - } } static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY) @@ -773,7 +769,7 @@ static void SpriteCallback_RotatingGate(struct Sprite *sprite) { affineAnimation = orientation + 4; - if (GetPlayerSpeed() != 1) + if (GetPlayerSpeed() != PLAYER_SPEED_NORMAL) affineAnimation += 8; PlaySE(SE_ROTATING_GATE); @@ -783,7 +779,7 @@ static void SpriteCallback_RotatingGate(struct Sprite *sprite) { affineAnimation = orientation + 8; - if (GetPlayerSpeed() != 1) + if (GetPlayerSpeed() != PLAYER_SPEED_NORMAL) affineAnimation += 8; PlaySE(SE_ROTATING_GATE); diff --git a/src/scrcmd.c b/src/scrcmd.c index 2c18cb565..4b7477fe1 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -999,7 +999,7 @@ bool8 ScrCmd_applymovement(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_applymovement_at(struct ScriptContext *ctx) +bool8 ScrCmd_applymovementat(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); const void *movementScript = (const void *)ScriptReadWord(ctx); @@ -1028,7 +1028,7 @@ bool8 ScrCmd_waitmovement(struct ScriptContext *ctx) return TRUE; } -bool8 ScrCmd_waitmovement_at(struct ScriptContext *ctx) +bool8 ScrCmd_waitmovementat(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup; @@ -1052,7 +1052,7 @@ bool8 ScrCmd_removeobject(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_removeobject_at(struct ScriptContext *ctx) +bool8 ScrCmd_removeobjectat(struct ScriptContext *ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1070,7 +1070,7 @@ bool8 ScrCmd_addobject(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_addobject_at(struct ScriptContext *ctx) +bool8 ScrCmd_addobjectat(struct ScriptContext *ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1108,7 +1108,7 @@ bool8 ScrCmd_copyobjectxytoperm(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_showobject_at(struct ScriptContext *ctx) +bool8 ScrCmd_showobjectat(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1118,7 +1118,7 @@ bool8 ScrCmd_showobject_at(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_hideobject_at(struct ScriptContext *ctx) +bool8 ScrCmd_hideobjectat(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); diff --git a/src/wallclock.c b/src/wallclock.c index 759b1d11f..5e0fae3a1 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -41,6 +41,8 @@ static void SpriteCB_HourHand(struct Sprite *sprite); static void SpriteCB_PMIndicator(struct Sprite *sprite); static void SpriteCB_AMIndicator(struct Sprite *sprite); +#define sTaskId data[0] + #define tMinuteHandAngle data[0] #define tHourHandAngle data[1] #define tHours data[2] @@ -696,21 +698,21 @@ void CB2_StartWallClock(void) gTasks[taskId].tHourHandAngle = 300; spriteId = CreateSprite(&sSpriteTemplate_MinuteHand, 120, 80, 1); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 0; spriteId = CreateSprite(&sSpriteTemplate_HourHand, 120, 80, 0); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 1; spriteId = CreateSprite(&sSpriteTemplate_PM, 120, 80, 2); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].data[1] = 45; spriteId = CreateSprite(&sSpriteTemplate_AM, 120, 80, 2); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].data[1] = 90; WallClockInit(); @@ -744,21 +746,21 @@ void CB2_ViewWallClock(void) } spriteId = CreateSprite(&sSpriteTemplate_MinuteHand, 120, 80, 1); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 0; spriteId = CreateSprite(&sSpriteTemplate_HourHand, 120, 80, 0); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 1; spriteId = CreateSprite(&sSpriteTemplate_PM, 120, 80, 2); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].data[1] = angle1; spriteId = CreateSprite(&sSpriteTemplate_AM, 120, 80, 2); - gSprites[spriteId].data[0] = taskId; + gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].data[1] = angle2; WallClockInit(); @@ -1015,7 +1017,7 @@ static void InitClockWithRtc(u8 taskId) static void SpriteCB_MinuteHand(struct Sprite *sprite) { - u16 angle = gTasks[sprite->data[0]].tMinuteHandAngle; + u16 angle = gTasks[sprite->sTaskId].tMinuteHandAngle; s16 sin = Sin2(angle) / 16; s16 cos = Cos2(angle) / 16; u16 x, y; @@ -1035,7 +1037,7 @@ static void SpriteCB_MinuteHand(struct Sprite *sprite) static void SpriteCB_HourHand(struct Sprite *sprite) { - u16 angle = gTasks[sprite->data[0]].tHourHandAngle; + u16 angle = gTasks[sprite->sTaskId].tHourHandAngle; s16 sin = Sin2(angle) / 16; s16 cos = Cos2(angle) / 16; u16 x, y; @@ -1053,58 +1055,44 @@ static void SpriteCB_HourHand(struct Sprite *sprite) sprite->y2 = y; } +#define sAngle data[1] + static void SpriteCB_PMIndicator(struct Sprite *sprite) { - if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM) + if (gTasks[sprite->sTaskId].tPeriod != PERIOD_AM) { - if (sprite->data[1] >= 60 && sprite->data[1] < 90) - { - sprite->data[1] += 5; - } - if (sprite->data[1] < 60) - { - sprite->data[1]++; - } + if (sprite->sAngle >= 60 && sprite->sAngle < 90) + sprite->sAngle += 5; + if (sprite->sAngle < 60) + sprite->sAngle++; } else { - if (sprite->data[1] >= 46 && sprite->data[1] < 76) - { - sprite->data[1] -= 5; - } - if (sprite->data[1] > 75) - { - sprite->data[1]--; - } + if (sprite->sAngle >= 46 && sprite->sAngle < 76) + sprite->sAngle -= 5; + if (sprite->sAngle > 75) + sprite->sAngle--; } - sprite->x2 = Cos2(sprite->data[1]) * 30 / 0x1000; - sprite->y2 = Sin2(sprite->data[1]) * 30 / 0x1000; + sprite->x2 = Cos2(sprite->sAngle) * 30 / 0x1000; + sprite->y2 = Sin2(sprite->sAngle) * 30 / 0x1000; } static void SpriteCB_AMIndicator(struct Sprite *sprite) { - if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM) + if (gTasks[sprite->sTaskId].tPeriod != PERIOD_AM) { - if (sprite->data[1] >= 105 && sprite->data[1] < 135) - { - sprite->data[1] += 5; - } - if (sprite->data[1] < 105) - { - sprite->data[1]++; - } + if (sprite->sAngle >= 105 && sprite->sAngle < 135) + sprite->sAngle += 5; + if (sprite->sAngle < 105) + sprite->sAngle++; } else { - if (sprite->data[1] >= 91 && sprite->data[1] < 121) - { - sprite->data[1] -= 5; - } - if (sprite->data[1] > 120) - { - sprite->data[1]--; - } + if (sprite->sAngle >= 91 && sprite->sAngle < 121) + sprite->sAngle -= 5; + if (sprite->sAngle > 120) + sprite->sAngle--; } - sprite->x2 = Cos2(sprite->data[1]) * 30 / 0x1000; - sprite->y2 = Sin2(sprite->data[1]) * 30 / 0x1000; + sprite->x2 = Cos2(sprite->sAngle) * 30 / 0x1000; + sprite->y2 = Sin2(sprite->sAngle) * 30 / 0x1000; }