Make traders (and particularly Anacondas) less hostile.
[newkind] / intro.c
CommitLineData
84bbd123 1/*
2 * Elite - The New Kind.
3 *
4 * Reverse engineered from the BBC disk version of Elite.
5 * Additional material by C.J.Pinder.
6 *
7 * The original Elite code is (C) I.Bell & D.Braben 1984.
8 * This version re-engineered in C by C.J.Pinder 1999-2001.
9 *
10 * email: <christian@newkind.co.uk>
11 *
12 *
13 */
14
15 /*
16 * intro.c
17 *
18 * Run the two intro screens.
19 * First is a rolling Cobra MkIII.
20 * Second is a parade of the various ships.
21 *
22 */
23
24
25#include <stdlib.h>
26
27#include "config.h"
28#include "elite.h"
29#include "gfx.h"
30#include "vector.h"
31#include "shipdata.h"
32#include "shipface.h"
33#include "threed.h"
34#include "space.h"
35#include "stars.h"
36
37static int ship_no;
38static int show_time;
39static int direction;
40
41
42static int min_dist[NO_OF_SHIPS+1] = {0, 200, 800, 200, 200, 200, 300, 384, 200,
43 200, 200, 420, 900, 500, 800, 384, 384,
44 384, 384, 384, 200, 384, 384, 384, 0,
45 384, 0, 384, 384, 700, 384, 0, 0,
46 900};
47
48
49static Matrix intro_ship_matrix;
50
51
52void initialise_intro1 (void)
53{
54 clear_universe();
55 set_init_matrix (intro_ship_matrix);
56 add_new_ship (SHIP_COBRA3, 0, 0, 4500, intro_ship_matrix, -127, -127);
57}
58
59
60void initialise_intro2 (void)
61{
62 ship_no = 0;
63 show_time = 0;
64 direction = 100;
65
66 clear_universe();
67 create_new_stars();
68 set_init_matrix (intro_ship_matrix);
69 add_new_ship (1, 0, 0, 5000, intro_ship_matrix, -127, -127);
70}
71
72
73
74void update_intro1 (void)
75{
76 universe[0].location.z -= 100;
77
78 if (universe[0].location.z < 384)
79 universe[0].location.z = 384;
80
81 gfx_clear_display();
82
83 flight_roll = 1;
84 update_universe();
85
86 gfx_draw_sprite(IMG_ELITE_TXT, -1, 10);
87
88 gfx_display_centre_text (310, "Original Game (C) I.Bell & D.Braben.", 120, GFX_COL_WHITE);
89 gfx_display_centre_text (330, "Re-engineered by C.J.Pinder.", 120, GFX_COL_WHITE);
90 gfx_display_centre_text (360, "Load New Commander (Y/N)?", 140, GFX_COL_GOLD);
91}
92
93
94void update_intro2 (void)
95{
96 show_time++;
97
98 if ((show_time >= 140) && (direction < 0))
99 direction = -direction;
100
101 universe[0].location.z += direction;
102
103 if (universe[0].location.z < min_dist[ship_no])
104 universe[0].location.z = min_dist[ship_no];
105
106 if (universe[0].location.z > 4500)
107 {
108 do
109 {
110 ship_no++;
111 if (ship_no > NO_OF_SHIPS)
112 ship_no = 1;
113 } while (min_dist[ship_no] == 0);
114
115 show_time = 0;
116 direction = -100;
117
118 ship_count[universe[0].type] = 0;
119 universe[0].type = 0;
120
121 add_new_ship (ship_no, 0, 0, 4500, intro_ship_matrix, -127, -127);
122 }
123
124
125 gfx_clear_display();
126 update_starfield();
127 update_universe();
128
129 gfx_draw_sprite (IMG_ELITE_TXT, -1, 10);
130
131 gfx_display_centre_text (360, "Press Fire or Space, Commander.", 140, GFX_COL_GOLD);
132 gfx_display_centre_text (330, ship_list[ship_no]->name, 120, GFX_COL_WHITE);
133}
134