Skip to content

Commit 889bc27

Browse files
authored
Merge pull request #3 from orchardstreet/orchardstreet-patch-1
Fully stabilize players when not turning
2 parents ccc4431 + 0f2208b commit 889bc27

File tree

1 file changed

+24
-38
lines changed

1 file changed

+24
-38
lines changed

player.c

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -161,27 +161,20 @@ void Player_update1 ( OBJECT *obj )
161161
player1->rot = -MAX_ROT;
162162
}
163163

164-
if ( (gv->key_LEFT1 == FALSE) && (gv->key_RIGHT1 == FALSE) )
164+
if ( (gv->key_LEFT1 == FALSE) && (gv->key_RIGHT1 == FALSE) && \
165+
player1->rot )
165166
{
166-
/* please re-do this major hackyness */
167-
if ( ( player1->rot < -0.03 ) ||
168-
( player1->rot > 0.03 ) )
167+
if(player1->rot > 0)
169168
{
170-
if ( player1->rot < -0.03 )
171-
{
172-
player1->rot += ROT_Z * gv->fadjust;
173-
if ( player1->rot > 0.0 )
174-
player1->rot = 0.0;
175-
}
176-
else
177-
{
178-
if ( player1->rot > 0.03 )
179-
{
180-
player1->rot -= ROT_Z * gv->fadjust;
181-
if ( player1->rot < 0.0 )
182-
player1->rot = 0.0;
183-
}
184-
}
169+
player1->rot -= ROT_Z * gv->fadjust;
170+
if(player1->rot < 0)
171+
player1->rot = 0;
172+
}
173+
else
174+
{
175+
player1->rot += ROT_Z * gv->fadjust;
176+
if(player1->rot > 0)
177+
player1->rot = 0;
185178
}
186179
}
187180

@@ -239,27 +232,20 @@ void Player_update2 ( OBJECT *obj )
239232
player2->rot = -MAX_ROT;
240233
}
241234

242-
if ( (gv->key_LEFT2 == FALSE) && (gv->key_RIGHT2 == FALSE) )
235+
if ( (gv->key_LEFT2 == FALSE) && (gv->key_RIGHT2 == FALSE) && \
236+
player2->rot )
243237
{
244-
/* please re-do this major hackyness */
245-
if ( ( player2->rot < -0.03 ) || \
246-
( player2->rot > 0.03 ) )
238+
if(player2->rot > 0)
247239
{
248-
if ( player2->rot < -0.03 )
249-
{
250-
player2->rot += ROT_Z * gv->fadjust;
251-
if ( player2->rot > 0.0 )
252-
player2->rot = 0.0;
253-
}
254-
else
255-
{
256-
if ( player2->rot > 0.03 )
257-
{
258-
player2->rot -= ROT_Z * gv->fadjust;
259-
if ( player2->rot < 0.0 )
260-
player2->rot = 0.0;
261-
}
262-
}
240+
player2->rot -= ROT_Z * gv->fadjust;
241+
if(player2->rot < 0)
242+
player2->rot = 0;
243+
}
244+
else
245+
{
246+
player2->rot += ROT_Z * gv->fadjust;
247+
if(player2->rot > 0)
248+
player2->rot = 0;
263249
}
264250
}
265251

0 commit comments

Comments
 (0)