2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
32 /*---------------------------------------------------------------------------*/
34 static int game_state = 0;
36 static struct s_file file;
37 static struct s_file back;
39 static float timer = 0.f; /* Clock time */
40 static int timer_down = 1; /* Timer go up or down? */
42 static float game_rx; /* Floor rotation about X axis */
43 static float game_rz; /* Floor rotation about Z axis */
45 static float view_a; /* Ideal view rotation about Y axis */
46 static float view_dc; /* Ideal view distance above ball */
47 static float view_dp; /* Ideal view distance above ball */
48 static float view_dz; /* Ideal view distance behind ball */
49 static float view_fov; /* Field of view */
51 static float view_c[3]; /* Current view center */
52 static float view_v[3]; /* Current view vector */
53 static float view_p[3]; /* Current view position */
54 static float view_e[3][3]; /* Current view reference frame */
57 static int coins = 0; /* Collected coins */
58 static int goal_c = 0; /* Goal coins remaining (0 = open) */
59 static float goal_k = 0; /* Goal animation */
60 static int jump_e = 1; /* Jumping enabled flag */
61 static int jump_b = 0; /* Jump-in-progress flag */
62 static float jump_dt; /* Jump duration */
63 static float jump_p[3]; /* Jump destination */
64 static float fade_k = 0.0; /* Fade in/out level */
65 static float fade_d = 0.0; /* Fade in/out direction */
67 /*---------------------------------------------------------------------------*/
70 * This is an abstraction of the game's input state. All input is
71 * encapsulated here, and all references to the input by the game are made
72 * here. This has the effect of homogenizing input for use in replay
73 * recording and playback.
76 * -32767 = -ANGLE_BOUND
77 * +32767 = +ANGLE_BOUND
80 * -32767 = -VIEWR_BOUND
81 * +32767 = +VIEWR_BOUND
93 static struct input input_current;
95 static void input_init(void)
103 static void input_set_x(float x)
105 if (x < -ANGLE_BOUND) x = -ANGLE_BOUND;
106 if (x > ANGLE_BOUND) x = ANGLE_BOUND;
108 input_current.x = (short) (32767.0f * x / ANGLE_BOUND);
111 static void input_set_z(float z)
113 if (z < -ANGLE_BOUND) z = -ANGLE_BOUND;
114 if (z > ANGLE_BOUND) z = ANGLE_BOUND;
116 input_current.z = (short) (32767.0f * z / ANGLE_BOUND);
119 static void input_set_r(float r)
121 if (r < -VIEWR_BOUND) r = -VIEWR_BOUND;
122 if (r > VIEWR_BOUND) r = VIEWR_BOUND;
124 input_current.r = (short) (32767.0f * r / VIEWR_BOUND);
127 static void input_set_c(int c)
129 input_current.c = (short) c;
132 static float input_get_x(void)
134 return ANGLE_BOUND * (float) input_current.x / 32767.0f;
137 static float input_get_z(void)
139 return ANGLE_BOUND * (float) input_current.z / 32767.0f;
142 static float input_get_r(void)
144 return VIEWR_BOUND * (float) input_current.r / 32767.0f;
147 static int input_get_c(void)
149 return (int) input_current.c;
152 int input_put(FILE *fout)
156 put_short(fout, &input_current.x);
157 put_short(fout, &input_current.z);
158 put_short(fout, &input_current.r);
159 put_short(fout, &input_current.c);
166 int input_get(FILE *fin)
170 get_short(fin, &input_current.x);
171 get_short(fin, &input_current.z);
172 get_short(fin, &input_current.r);
173 get_short(fin, &input_current.c);
175 return (feof(fin) ? 0 : 1);
180 /*---------------------------------------------------------------------------*/
182 static int grow = 0; /* Should the ball be changing size? */
183 static float grow_orig = 0; /* the original ball size */
184 static float grow_goal = 0; /* how big or small to get! */
185 static float grow_t = 0.0; /* timer for the ball to grow... */
186 static float grow_strt = 0; /* starting value for growth */
187 static int got_orig = 0; /* Do we know original ball size? */
189 #define GROW_TIME 0.5f /* sec for the ball to get to size. */
190 #define GROW_BIG 1.5f /* large factor */
191 #define GROW_SMALL 0.5f /* small factor */
193 static int grow_state = 0; /* Current state (values -1, 0, +1) */
195 static void grow_init(const struct s_file *fp, int type)
199 grow_orig = fp->uv->r;
200 grow_goal = grow_orig;
201 grow_strt = grow_orig;
208 if (type == ITEM_SHRINK)
210 audio_play(AUD_SHRINK, 1.f);
218 grow_goal = grow_orig * GROW_SMALL;
224 grow_goal = grow_orig;
230 else if (type == ITEM_GROW)
232 audio_play(AUD_GROW, 1.f);
237 grow_goal = grow_orig;
243 grow_goal = grow_orig * GROW_BIG;
256 grow_strt = fp->uv->r;
260 static void grow_step(const struct s_file *fp, float dt)
267 /* Calculate new size based on how long since you touched the coin... */
271 if (grow_t >= GROW_TIME)
277 dr = grow_strt + ((grow_goal-grow_strt) * (1.0f / (GROW_TIME / grow_t)));
279 /* No sinking through the floor! Keeps ball's bottom constant. */
281 fp->uv->p[1] += (dr - fp->uv->r);
285 /*---------------------------------------------------------------------------*/
287 static void view_init(void)
289 view_fov = (float) config_get_d(CONFIG_VIEW_FOV);
290 view_dp = (float) config_get_d(CONFIG_VIEW_DP) / 100.0f;
291 view_dc = (float) config_get_d(CONFIG_VIEW_DC) / 100.0f;
292 view_dz = (float) config_get_d(CONFIG_VIEW_DZ) / 100.0f;
315 int game_init(const struct level *level, int t, int g)
317 timer = (float) t / 100.f;
318 timer_down = (t > 0);
324 if (!sol_load_gl(&file, config_data(level->file),
325 config_get_d(CONFIG_TEXTURES),
326 config_get_d(CONFIG_SHADOW)))
327 return (game_state = 0);
336 /* Initialize jump and goal states. */
342 goal_k = (g == 0) ? 1.0f : 0.0f;
344 /* Initialise the level, background, particles, fade, and view. */
349 part_reset(GOAL_HEIGHT);
351 back_init(level->grad, config_get_d(CONFIG_GEOMETRY));
353 sol_load_gl(&back, config_data(level->back),
354 config_get_d(CONFIG_TEXTURES), 0);
356 /* Initialize ball size tracking... */
375 /*---------------------------------------------------------------------------*/
379 return (int) (timer * 100.f);
392 /*---------------------------------------------------------------------------*/
394 static void game_draw_balls(const struct s_file *fp,
395 const float *bill_M, float t)
397 float c[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
402 m_basis(ball_M, fp->uv[0].e[0], fp->uv[0].e[1], fp->uv[0].e[2]);
403 m_basis(pend_M, fp->uv[0].E[0], fp->uv[0].E[1], fp->uv[0].E[2]);
405 glPushAttrib(GL_LIGHTING_BIT);
408 glTranslatef(fp->uv[0].p[0],
409 fp->uv[0].p[1] + BALL_FUDGE,
411 glScalef(fp->uv[0].r,
416 ball_draw(ball_M, pend_M, bill_M, t);
422 static void game_draw_items(const struct s_file *fp, float t)
427 glPushAttrib(GL_LIGHTING_BIT);
429 item_push(ITEM_COIN);
431 for (hi = 0; hi < fp->hc; hi++)
433 if (fp->hv[hi].t == ITEM_COIN && fp->hv[hi].n > 0)
437 glTranslatef(fp->hv[hi].p[0],
440 glRotatef(r, 0.0f, 1.0f, 0.0f);
441 item_draw(&fp->hv[hi], r);
448 item_push(ITEM_SHRINK);
450 for (hi = 0; hi < fp->hc; hi++)
452 if (fp->hv[hi].t == ITEM_SHRINK)
456 glTranslatef(fp->hv[hi].p[0],
459 glRotatef(r, 0.0f, 1.0f, 0.0f);
460 item_draw(&fp->hv[hi], r);
467 item_push(ITEM_GROW);
469 for (hi = 0; hi < fp->hc; hi++)
471 if (fp->hv[hi].t == ITEM_GROW)
475 glTranslatef(fp->hv[hi].p[0],
478 glRotatef(r, 0.0f, 1.0f, 0.0f);
479 item_draw(&fp->hv[hi], r);
489 static void game_draw_goals(const struct s_file *fp, const float *M, float t)
495 /* Draw the goal particles. */
497 glEnable(GL_TEXTURE_2D);
499 for (zi = 0; zi < fp->zc; zi++)
503 glTranslatef(fp->zv[zi].p[0],
507 part_draw_goal(M, fp->zv[zi].r, goal_k, t);
512 glDisable(GL_TEXTURE_2D);
514 /* Draw the goal column. */
516 for (zi = 0; zi < fp->zc; zi++)
520 glTranslatef(fp->zv[zi].p[0],
524 glScalef(fp->zv[zi].r,
535 static void game_draw_jumps(const struct s_file *fp)
539 for (ji = 0; ji < fp->jc; ji++)
543 glTranslatef(fp->jv[ji].p[0],
546 glScalef(fp->jv[ji].r,
556 static void game_draw_swchs(const struct s_file *fp)
560 for (xi = 0; xi < fp->xc; xi++)
567 glTranslatef(fp->xv[xi].p[0],
570 glScalef(fp->xv[xi].r,
574 swch_draw(fp->xv[xi].f, fp->xv[xi].e);
580 /*---------------------------------------------------------------------------*/
582 static void game_draw_tilt(int d)
584 const float *ball_p = file.uv->p;
586 /* Rotate the environment about the position of the ball. */
588 glTranslatef(+ball_p[0], +ball_p[1] * d, +ball_p[2]);
589 glRotatef(-game_rz * d, view_e[2][0], view_e[2][1], view_e[2][2]);
590 glRotatef(-game_rx * d, view_e[0][0], view_e[0][1], view_e[0][2]);
591 glTranslatef(-ball_p[0], -ball_p[1] * d, -ball_p[2]);
594 static void game_refl_all(void)
600 /* Draw the floor. */
607 /*---------------------------------------------------------------------------*/
609 static void game_draw_light(void)
611 const float light_p[2][4] = {
612 { -8.0f, +32.0f, -8.0f, 0.0f },
613 { +8.0f, +32.0f, +8.0f, 0.0f },
615 const float light_c[2][4] = {
616 { 1.0f, 0.8f, 0.8f, 1.0f },
617 { 0.8f, 1.0f, 0.8f, 1.0f },
620 /* Configure the lighting. */
623 glLightfv(GL_LIGHT0, GL_POSITION, light_p[0]);
624 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_c[0]);
625 glLightfv(GL_LIGHT0, GL_SPECULAR, light_c[0]);
628 glLightfv(GL_LIGHT1, GL_POSITION, light_p[1]);
629 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_c[1]);
630 glLightfv(GL_LIGHT1, GL_SPECULAR, light_c[1]);
633 static void game_draw_back(int pose, int d, float t)
639 glRotatef(game_rz * 2, view_e[2][0], view_e[2][1], view_e[2][2]);
640 glRotatef(game_rx * 2, view_e[0][0], view_e[0][1], view_e[0][2]);
643 glTranslatef(view_p[0], view_p[1] * d, view_p[2]);
645 if (config_get_d(CONFIG_BACKGROUND))
647 /* Draw all background layers back to front. */
649 sol_back(&back, BACK_DIST, FAR_DIST, t);
651 sol_back(&back, 0, BACK_DIST, t);
658 static void game_clip_refl(int d)
660 /* Fudge to eliminate the floor from reflection. */
662 GLdouble e[4], k = -0.00001;
669 glClipPlane(GL_CLIP_PLANE0, e);
672 static void game_clip_ball(int d, const float *p)
674 GLdouble r, c[3], pz[4], nz[4];
676 /* Compute the plane giving the front of the ball, as seen from view_p. */
682 pz[0] = view_p[0] - c[0];
683 pz[1] = view_p[1] - c[1];
684 pz[2] = view_p[2] - c[2];
686 r = sqrt(pz[0] * pz[0] + pz[1] * pz[1] + pz[2] * pz[2]);
691 pz[3] = -(pz[0] * c[0] +
695 /* Find the plane giving the back of the ball, as seen from view_p. */
702 /* Reflect these planes as necessary, and store them in the GL state. */
707 glClipPlane(GL_CLIP_PLANE1, nz);
708 glClipPlane(GL_CLIP_PLANE2, pz);
711 static void game_draw_fore(int pose, const float *M, int d, float t)
713 const float *ball_p = file.uv->p;
714 const float ball_r = file.uv->r;
718 /* Rotate the environment about the position of the ball. */
722 /* Compute clipping planes for reflection and ball facing. */
725 game_clip_ball(d, ball_p);
728 glEnable(GL_CLIP_PLANE0);
731 sol_draw(&file, 0, 1);
734 /* Draw the coins. */
736 game_draw_items(&file, t);
738 /* Draw the floor. */
740 sol_draw(&file, 0, 1);
742 /* Draw the ball shadow. */
744 if (d > 0 && config_get_d(CONFIG_SHADOW))
746 shad_draw_set(ball_p, ball_r);
753 game_draw_balls(&file, M, t);
756 /* Draw the particles and light columns. */
758 glEnable(GL_COLOR_MATERIAL);
759 glDisable(GL_LIGHTING);
760 glDepthMask(GL_FALSE);
762 glColor3f(1.0f, 1.0f, 1.0f);
764 sol_bill(&file, M, t);
765 part_draw_coin(M, t);
767 glDisable(GL_TEXTURE_2D);
769 game_draw_goals(&file, M, t);
770 game_draw_jumps(&file);
771 game_draw_swchs(&file);
773 glEnable(GL_TEXTURE_2D);
775 glColor3f(1.0f, 1.0f, 1.0f);
777 glDepthMask(GL_TRUE);
778 glEnable(GL_LIGHTING);
779 glDisable(GL_COLOR_MATERIAL);
782 glDisable(GL_CLIP_PLANE0);
787 void game_draw(int pose, float t)
789 float fov = view_fov;
791 if (jump_b) fov *= 2.f * fabsf(jump_dt - 0.5);
795 config_push_persp(fov, 0.1f, FAR_DIST);
798 float T[16], U[16], M[16], v[3];
800 /* Compute direct and reflected view bases. */
806 m_view(T, view_c, view_p, view_e[1]);
807 m_view(U, view_c, v, view_e[1]);
811 /* Apply current the view. */
813 v_sub(v, view_c, view_p);
815 glTranslatef(0.f, 0.f, -v_len(v));
817 glTranslatef(-view_c[0], -view_c[1], -view_c[2]);
819 if (config_get_d(CONFIG_REFLECTION))
821 glEnable(GL_STENCIL_TEST);
823 /* Draw the mirrors only into the stencil buffer. */
825 glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF);
826 glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
827 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
828 glDepthMask(GL_FALSE);
832 glDepthMask(GL_TRUE);
833 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
834 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
835 glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF);
837 /* Draw the scene reflected into color and depth buffers. */
842 glScalef(+1.0f, -1.0f, +1.0f);
845 game_draw_back(pose, -1, t);
846 game_draw_fore(pose, U, -1, t);
851 glDisable(GL_STENCIL_TEST);
854 /* Draw the scene normally. */
858 game_draw_back(pose, +1, t);
859 game_draw_fore(pose, T, +1, t);
864 /* Draw the fade overlay. */
870 /*---------------------------------------------------------------------------*/
872 static void game_update_grav(float h[3], const float g[3])
875 float y[3] = { 0.0f, 1.0f, 0.0f };
881 /* Compute the gravity vector from the given world rotations. */
883 z[0] = fsinf(V_RAD(view_a));
885 z[2] = fcosf(V_RAD(view_a));
892 m_rot (Z, z, V_RAD(game_rz));
893 m_rot (X, x, V_RAD(game_rx));
898 static void game_update_view(float dt)
900 float dc = view_dc * (jump_b ? 2.0f * fabsf(jump_dt - 0.5f) : 1.0f);
901 float da = input_get_r() * dt * 90.0f;
904 float M[16], v[3], Y[3] = { 0.0f, 1.0f, 0.0f };
908 /* Center the view about the ball. */
910 v_cpy(view_c, file.uv->p);
911 v_inv(view_v, file.uv->v);
913 view_e[2][0] = fsinf(V_RAD(view_a));
915 view_e[2][2] = fcosf(V_RAD(view_a));
917 switch (input_get_c())
919 case 1: /* Camera 1: Viewpoint chases the ball position. */
921 /* TODO: This camera no longer exists. */
925 case 2: /* Camera 2: View vector is given by view angle. */
929 default: /* Default: View vector approaches the ball velocity vector. */
931 v_mad(view_e[2], view_e[2], view_v, v_dot(view_v, view_v) * dt / 4);
936 /* Orthonormalize the new view reference frame. */
938 v_crs(view_e[0], view_e[1], view_e[2]);
939 v_crs(view_e[2], view_e[0], view_e[1]);
940 v_nrm(view_e[0], view_e[0]);
941 v_nrm(view_e[2], view_e[2]);
943 /* Compute the new view position. */
945 k = 1.0f + v_dot(view_e[2], view_v) / 10.0f;
947 view_k = view_k + (k - view_k) * dt;
949 if (view_k < 0.5) view_k = 0.5;
951 v_scl(v, view_e[1], view_dp * view_k);
952 v_mad(v, v, view_e[2], view_dz * view_k);
953 m_rot(M, Y, V_RAD(da));
954 m_vxfm(view_p, M, v);
955 v_add(view_p, view_p, file.uv->p);
957 /* Compute the new view center. */
959 v_cpy(view_c, file.uv->p);
960 v_mad(view_c, view_c, view_e[1], dc);
962 /* Note the current view angle. */
964 view_a = V_DEG(fatan2f(view_e[2][0], view_e[2][2]));
967 static void game_update_time(float dt, int b)
969 if (goal_c == 0 && goal_k < 1.0f)
972 /* The ticking clock. */
987 static int game_update_state(int bt)
989 struct s_file *fp = &file;
996 /* Test for an item. */
998 if (bt && (hp = sol_item_test(fp, p, COIN_RADIUS)))
1000 const char *sound = AUD_COIN;
1005 grow_init(fp, hp->t);
1007 if (hp->t == ITEM_COIN)
1011 /* Check for goal open. */
1023 audio_play(sound, 1.f);
1025 /* Reset item type. */
1030 /* Test for a switch. */
1032 if (sol_swch_test(fp, 0))
1033 audio_play(AUD_SWITCH, 1.f);
1035 /* Test for a jump. */
1037 if (jump_e == 1 && jump_b == 0 && sol_jump_test(fp, jump_p, 0) == 1)
1043 audio_play(AUD_JUMP, 1.f);
1045 if (jump_e == 0 && jump_b == 0 && sol_jump_test(fp, jump_p, 0) == 0)
1048 /* Test for a goal. */
1050 if (bt && goal_c == 0 && (zp = sol_goal_test(fp, p, 0)))
1052 audio_play(AUD_GOAL, 1.0f);
1056 /* Test for time-out. */
1058 if (bt && timer_down && timer <= 0.f)
1060 audio_play(AUD_TIME, 1.0f);
1064 /* Test for fall-out. */
1066 if (bt && fp->uv[0].p[1] < fp->vv[0].p[1])
1068 audio_play(AUD_FALL, 1.0f);
1075 int game_step(const float g[3], float dt, int bt)
1079 struct s_file *fp = &file;
1083 /* Smooth jittery or discontinuous input. */
1085 game_rx += (input_get_x() - game_rx) * dt / RESPONSE;
1086 game_rz += (input_get_z() - game_rz) * dt / RESPONSE;
1090 game_update_grav(h, g);
1097 /* Handle a jump. */
1101 fp->uv[0].p[0] = jump_p[0];
1102 fp->uv[0].p[1] = jump_p[1];
1103 fp->uv[0].p[2] = jump_p[2];
1112 float b = sol_step(fp, h, dt, 0, NULL);
1114 /* Mix the sound of a ball bounce. */
1118 float k = (b - 0.5f) * 2.0f;
1122 if (fp->uv->r > grow_orig) audio_play(AUD_BUMPL, k);
1123 else if (fp->uv->r < grow_orig) audio_play(AUD_BUMPS, k);
1124 else audio_play(AUD_BUMPM, k);
1126 else audio_play(AUD_BUMPM, k);
1131 game_update_view(dt);
1132 game_update_time(dt, bt);
1134 return game_update_state(bt);
1139 /*---------------------------------------------------------------------------*/
1141 void game_set_x(int k)
1143 input_set_x(-ANGLE_BOUND * k / JOY_MAX);
1146 void game_set_z(int k)
1148 input_set_z(+ANGLE_BOUND * k / JOY_MAX);
1151 void game_set_ang(int x, int z)
1157 void game_set_pos(int x, int y)
1159 input_set_x(input_get_x() + 40.0f * y / config_get_d(CONFIG_MOUSE_SENSE));
1160 input_set_z(input_get_z() + 40.0f * x / config_get_d(CONFIG_MOUSE_SENSE));
1163 void game_set_cam(int c)
1168 void game_set_rot(float r)
1173 /*---------------------------------------------------------------------------*/
1175 void game_set_fly(float k)
1177 struct s_file *fp = &file;
1179 float x[3] = { 1.f, 0.f, 0.f };
1180 float y[3] = { 0.f, 1.f, 0.f };
1181 float z[3] = { 0.f, 0.f, 1.f };
1182 float c0[3] = { 0.f, 0.f, 0.f };
1183 float p0[3] = { 0.f, 0.f, 0.f };
1184 float c1[3] = { 0.f, 0.f, 0.f };
1185 float p1[3] = { 0.f, 0.f, 0.f };
1188 z[0] = fsinf(V_RAD(view_a));
1189 z[2] = fcosf(V_RAD(view_a));
1191 v_cpy(view_e[0], x);
1192 v_cpy(view_e[1], y);
1193 v_cpy(view_e[2], z);
1195 /* k = 0.0 view is at the ball. */
1199 v_cpy(c0, fp->uv[0].p);
1200 v_cpy(p0, fp->uv[0].p);
1203 v_mad(p0, p0, y, view_dp);
1204 v_mad(p0, p0, z, view_dz);
1205 v_mad(c0, c0, y, view_dc);
1207 /* k = +1.0 view is s_view 0 */
1209 if (k >= 0 && fp->wc > 0)
1211 v_cpy(p1, fp->wv[0].p);
1212 v_cpy(c1, fp->wv[0].q);
1215 /* k = -1.0 view is s_view 1 */
1217 if (k <= 0 && fp->wc > 1)
1219 v_cpy(p1, fp->wv[1].p);
1220 v_cpy(c1, fp->wv[1].q);
1223 /* Interpolate the views. */
1226 v_mad(view_p, p0, v, k * k);
1229 v_mad(view_c, c0, v, k * k);
1231 /* Orthonormalize the view basis. */
1233 v_sub(view_e[2], view_p, view_c);
1234 v_crs(view_e[0], view_e[1], view_e[2]);
1235 v_crs(view_e[2], view_e[0], view_e[1]);
1236 v_nrm(view_e[0], view_e[0]);
1237 v_nrm(view_e[2], view_e[2]);
1240 void game_look(float phi, float theta)
1242 view_c[0] = view_p[0] + fsinf(V_RAD(theta)) * fcosf(V_RAD(phi));
1243 view_c[1] = view_p[1] + fsinf(V_RAD(phi));
1244 view_c[2] = view_p[2] - fcosf(V_RAD(theta)) * fcosf(V_RAD(phi));
1247 /*---------------------------------------------------------------------------*/
1249 void game_kill_fade(void)
1255 void game_step_fade(float dt)
1257 if ((fade_k < 1.0f && fade_d > 0.0f) ||
1258 (fade_k > 0.0f && fade_d < 0.0f))
1259 fade_k += fade_d * dt;
1273 void game_fade(float d)
1278 /*---------------------------------------------------------------------------*/