Subversion Repositories Kolibri OS

Rev

Rev 950 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
950 leency 1
;=============================================================================;
2
; Hidnplayr's invaders, Compilable for DexOs and Kolibrios                    ;
3
;-----------------------------------------------------------------------------;
4
;                                                                             ;
5
; Copyright (C) hidnplayr 2007. All rights reserved.                          ;
6
;                                                                             ;
7
; Invaders is distributed in the hope that it will be useful, but WITHOUT ANY ;
8
; WARRANTY. No author or distributor accepts responsibility to anyone for the ;
9
; consequences of using it or for whether it serves any particular purpose or ;
10
; works at all, unless he says so in writing. Refer to the GNU General Public ;
11
; License (the "GPL") for full details.                                       ;
12
; Everyone is granted permission to copy, modify and redistribute KolibriOS,  ;
13
; but only under the conditions described in the GPL. A copy of this license  ;
14
; is supposed to have been given to you along with KolibriOS so you can know  ;
15
; your rights and responsibilities. It should be in a file named COPYING.     ;
16
; Among other things, the copyright notice and this notice must be preserved  ;
17
; on all copies.                                                              ;
18
;                                                                             ;
19
; see copying.txt                                                             ;
20
;                                                                             ;
21
; contact me on hidnplayr@gmail.com                                           ;
22
;                                                                             ;
23
;-----------------------------------------------------------------------------;
24
 
25
 
26
SCREEN_X equ 640
27
SCREEN_Y equ 480
28
 
29
SHIP_X equ 32
30
SHIP_Y equ 32
31
 
32
SHIP_X_POS equ (SCREEN_X-SHIP_X)/2
33
SHIP_Y_POS equ SCREEN_Y-SHIP_Y-27
34
 
35
ENEMY_X equ 32
36
ENEMY_Y equ 32
37
 
38
ALIEN_X equ 48
39
ALIEN_Y equ 38
40
ALIEN_Y_POS equ 1
41
 
42
BOUNDARY equ 10
43
MOVEMENT equ 7
44
 
45
TRANSPARENCY equ 0x00000000
46
 
47
WINDOW_X equ 100
48
WINDOW_Y equ 100
49
 
50
BULLET_X equ 10
51
BULLET_Y equ 10
52
 
4386 hidnplayr 53
STARS_   equ 226
950 leency 54
STARLEVELS equ 3
55
 
56
ENEMY_STARTING_X equ 25
57
ENEMY_STARTING_Y equ 50
58
 
59
BULLETSPEED equ 12
60
 
61
SCREEN_X_POS equ 5
62
SCREEN_Y_POS equ 25
63
 
64
gif_hash_offset = gif_hash_area
65
 
66
include 'ascgl.inc'
67
include 'invaders_kolibri.inc'
68
 
69
decodegif:
4386 hidnplayr 70
        giftoimg gif_bullet,bullet
71
        giftoimg gif_bullet2,bullet2
72
        giftoimg gif_ship,ship
73
        giftoimg gif_enemy1,enemy1
74
        giftoimg gif_enemy2,enemy2
75
        giftoimg gif_enemy3,enemy3
76
        giftoimg gif_enemy4,enemy4
77
        giftoimg gif_enemy5,enemy5
78
        giftoimg gif_alien,alien
79
        giftoimg gif_menu1,menu1
80
        giftoimg gif_menu2,menu2
81
        giftoimg gif_menu3,menu3
82
        giftoimg gif_menu4,menu4
83
        giftoimg gif_logo,logo
84
        giftoimg gif_pause,pause_
85
        giftoimg gif_levelup,levelup
86
        giftoimg gif_gameover,gameover
87
        giftoimg gif_highscore,highscore
88
        giftoimg gif_smallfont,smallfont
89
        giftoimg gif_bigfont,bigfont
90
        giftoimg gif_numbers,numbers
950 leency 91
 
4386 hidnplayr 92
        call  createstars
93
        call  drawit
94
        call  [drawroutine]
950 leency 95
 
96
mainloop:
97
 
98
    cmp  byte[status],3 ; if game is paused,...
4386 hidnplayr 99
    je   waitfordraw
950 leency 100
 
101
    call drawit
102
    call [drawroutine]
103
    call checkbullet
104
 
105
   waitfordraw:
106
 
107
    call waitandgetkey ;;;
108
    test ah,ah
4386 hidnplayr 109
    jz   mainloop
950 leency 110
 
111
    cmp  byte[status],1      ;
112
    jne  nogame
113
 
4386 hidnplayr 114
         cmp  ah, KEY_RIGHT
115
         jnz  noright
116
         cmp  dword[ship_x],SCREEN_X-SHIP_X-BOUNDARY
117
         jge  mainloop
118
         add  dword[ship_x],MOVEMENT
950 leency 119
 
4386 hidnplayr 120
         jmp  mainloop
950 leency 121
 
122
       noright:
4386 hidnplayr 123
         cmp  ah, KEY_LEFT
124
         jnz  noleft
125
         cmp  dword[ship_x],BOUNDARY
126
         jle  mainloop
127
         sub  dword[ship_x],MOVEMENT
950 leency 128
 
4386 hidnplayr 129
         jmp  mainloop
950 leency 130
 
131
       noleft:
4386 hidnplayr 132
         cmp  ah, KEY_UP
133
         jnz  noup
950 leency 134
 
4386 hidnplayr 135
         cmp  dword[bullet_y],1
136
         jg   mainloop
950 leency 137
 
4386 hidnplayr 138
         mov  eax,dword[ship_x]
139
         add  eax,(SHIP_X-BULLET_X)/2
140
         mov  dword[bullet_x],eax
141
         mov  dword[bullet_y],SHIP_Y_POS;-BULLET_Y
950 leency 142
 
4386 hidnplayr 143
         jmp  mainloop
950 leency 144
 
145
       noup:
4386 hidnplayr 146
         cmp  ah,KEY_P
147
         jnz  no_pause1
950 leency 148
 
4386 hidnplayr 149
         mov  byte[status],3
150
         aimgtoimg pause_,150,180,vscreen,TRANSPARENCY,0
151
         call [drawroutine]
950 leency 152
 
4386 hidnplayr 153
         jmp  mainloop
950 leency 154
 
155
       no_pause1:
156
 
157
nogame:
158
    cmp  byte[status],0
159
    jne  nomenu
160
 
4386 hidnplayr 161
         cmp  ah, KEY_DOWN
162
         jnz  no_down
950 leency 163
 
4386 hidnplayr 164
         cmp  byte[menu],3
165
         jne  no_menu1
950 leency 166
 
4386 hidnplayr 167
         mov  byte[menu],0
168
         jmp  nomenu
950 leency 169
 
170
       no_menu1:
4386 hidnplayr 171
         inc  byte[menu]
950 leency 172
 
173
       no_down:
4386 hidnplayr 174
         cmp  ah, KEY_UP
175
         jnz  no_up
950 leency 176
 
4386 hidnplayr 177
         cmp  byte[menu],0
178
         jne  no_menu0
950 leency 179
 
4386 hidnplayr 180
         mov  byte[menu],3
181
         jmp  nomenu
950 leency 182
 
183
       no_menu0:
4386 hidnplayr 184
         dec  byte[menu]
950 leency 185
 
186
       no_up:
187
 
4386 hidnplayr 188
         cmp  ah, KEY_ESC
189
         je   exit
950 leency 190
 
191
       no_esc:
4386 hidnplayr 192
         cmp  ah, KEY_ENTER
193
         jnz  no_enter
950 leency 194
 
4386 hidnplayr 195
        exemenu:
196
                cmp  byte[menu],0  ;start
197
                jne  exemenu1
950 leency 198
 
4386 hidnplayr 199
              new_game:
200
                        mov  dword[score],0
201
                        mov  eax,[score]
202
                        call convertscore
950 leency 203
 
4386 hidnplayr 204
                        mov  esi, level1
205
                        mov  word[levelnumb],'01'
206
              load_level:
207
                        mov  byte[enemy_speed],1
208
                        mov  dword[enemy_x], ENEMY_STARTING_X
209
                        mov  dword[enemy_y], ENEMY_STARTING_Y
950 leency 210
 
4386 hidnplayr 211
                        mov  edi, enemy_table
212
                        mov  ecx, 5
213
                        rep  movsd
950 leency 214
 
4386 hidnplayr 215
                        mov  byte[status],1
950 leency 216
 
4386 hidnplayr 217
                        jmp  mainloop