File: ending.lua

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (220 lines) | stat: -rw-r--r-- 5,338 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
local lua_file = nil

--load common functions
lua_file = nuvie_load("common/intro_common.lua"); lua_file();

function play()
   local gender = player_get_gender()
   local g_img_tbl = image_load_all("endgame.lzc")
   local text_tbl = text_load("scenetxt.lzc", 3)
   local text = sprite_new(nil, 0, 160, true)
   text.text_color = 4
   text.text = text_tbl[0]
   text.text_align = 2

   local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
   local jack = sprite_new(g_img_tbl[0][gender+1], 155, 151, true)

   canvas_set_palette("md_title.pal", 0)
   canvas_set_opacity(0xff);
   mouse_cursor_visible(false)
   canvas_set_update_interval(25)

   music_play("mdd_mus.lzc", 11)
   fade_in()

   poll_for_key_or_button(150)
   if should_exit() then return end

   text.text = text_tbl[1]

   poll_for_key_or_button(150)
   if should_exit() then return end

   --space capsule rockets away from mars

   jack.visible = false
   text.text = text_tbl[2]

   bg.image = g_img_tbl[1][0]

   local capsule = create_sprite(g_img_tbl[1][1], 105, 112)
   capsule.visible = false
   local smoke = sprite_new(g_img_tbl[1][2], 105, 112, false)

   local i
   for i=-1,39 do
      bg.y = 23 + ((i + 3) % 4)
      bg.x = ((i + 2) % 5) - 2

      if i > -1 and i < 13 then
         capsule.visible = true
         capsule.x = 105 + (i * i * 2) / 3
         capsule.y = 112 - i * i
         capsule.image.scale = (i * i) + 16

         smoke.image = g_img_tbl[1][2 + math.floor(i/2)]
         smoke.visible = true
      else
         capsule.visible = false
         smoke.visible = false
      end

      poll_for_key_or_button(3)
      if should_exit() then return end
   end

   --capsule lands in the ocean.
   bg.image = g_img_tbl[2][0]
   bg.x = 0
   bg.y = 24

   capsule.visible = true
   capsule.x = 170
   capsule.y = 150

   text.text = text_tbl[3]

   for i=0,9 do
      local j
      for j=0,3 do
         capsule.image = g_img_tbl[2][math.abs(2 - j) + 1]
         if i == 5 then
            text.text = text_tbl[4]
         end
         poll_for_key_or_button(8)
         if should_exit() then return end
      end
   end

   --ticket tape parade
   canvas_set_opacity(0);
   capsule.visible = false

   bg.image = g_img_tbl[3][0]
   local spector = sprite_new(g_img_tbl[3][gender+1], 190, 151, true)
   text.text = text_tbl[5]

   fade_in(6)

   poll_for_key_or_button(150)
   if should_exit() then return end


   --group photo.
   canvas_set_opacity(0);
   spector.visible = false

   bg.image = g_img_tbl[4][0]

   local moongate_tbl = image_load_all("moongate.lzc")
   local moongate = sprite_new(moongate_tbl[1][0], 35, 135, true)
   local group = sprite_new(g_img_tbl[4][gender+1], 195, 151, true)

   local photographer = sprite_new(g_img_tbl[4][3], 75, 151, true)

   text.text = text_tbl[6]

   fade_in(6)

   for i=0,79 do
      if i == 40 then
         moongate.visible = false
         group.visible = false
         photographer.visible = false
         bg.image = g_img_tbl[4][5]
         poll_for_key_or_button(2)
         fade_out(6)
         bg.image = g_img_tbl[4][0]
         moongate.visible = true
         group.visible = true
         photographer.visible = true
         canvas_set_opacity(0xff);
      else
         moongate.image = moongate_tbl[1][i % 8]
         if i >= 38 and i <= 42 then
            photographer.image = g_img_tbl[4][4]
         else
            photographer.image = g_img_tbl[4][3]
         end
         if i == 41 then
            text.text = text_tbl[7]
         end

         poll_for_key_or_button(3)
         if should_exit() then return end
      end
   end

   --mars dust storm

   moongate.visible = false
   group.visible = false
   photographer.visible = false

   bg.image = g_img_tbl[5]

   local sand = sprite_new(nil, 240, 140, true)
   local tree = sprite_new(nil, 0, 140, true)

   local dust = create_sprite(g_img_tbl[6], 0, 24)
   local dust1 = create_sprite(g_img_tbl[6], 0, 24)
   local dust2 = create_sprite(g_img_tbl[6], 0, 24)
   local dust3 = create_sprite(g_img_tbl[6], 0, 24)
   local dust4 = create_sprite(g_img_tbl[6], 0, 24)

   dust.visible = true
   dust1.visible = true
   dust2.visible = true
   dust3.visible = true
   dust4.visible = true

   text.text = text_tbl[8]

   for i=0,63 do
      if math.floor(i / 8) > 4 then
         sand.image = g_img_tbl[7][4]
      else
         sand.image = g_img_tbl[7][math.floor(i / 8)]
      end
      if i < 56 then
         if i - 50 < 0 then
            tree.image = g_img_tbl[8][0]
         else
            tree.image = g_img_tbl[8][i - 50]
         end
      else
         tree.visible = false
      end

      dust.x = 340 - (i * 10) - math.random(0, 19)
      dust.y = 24 - math.random(0, 9)

      dust1.x = 420 - (i * 20) - math.random(0, 19)
      dust1.y = 24 - math.random(0, 9)

      dust2.x = 500 - (i * 30) - math.random(0, 19)
      dust2.y = 24 - math.random(0, 9)

      dust3.x = 580 - (i * 30) - math.random(0, 19)
      dust3.y = 24 - math.random(0, 9)

      dust4.x = 660 - (i * 20) - math.random(0, 19)
      dust4.y = 24 - math.random(0, 9)

      if i == 62 then
         text.text = text_tbl[9]
      end

      poll_for_key_or_button(2)
      if should_exit() then return end
   end

   poll_for_key_or_button(150)
   if should_exit() then return end

   about_martian_dreams()
end


play()