Subversion Repositories Kolibri OS

Rev

Rev 1566 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1566 Rev 1677
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
Level_begin:
3
Level_begin:
4
 
4
 
-
 
5
      call      Load_level
Line 5... Line 6...
5
      call      Load_level
6
      call      Get_eat
6
      call      Get_eat
7
        mcall     66,1,1                          ; set scan codes mode for keyboard
Line 7... Line 8...
7
 
8
 
Line 13... Line 14...
13
    mov  [time_before_waiting], eax
14
    mov  [time_before_waiting], eax
14
    mov  eax, [time_wait_limit]
15
    mov  eax, [time_wait_limit]
15
    mov  [time_to_wait],    eax
16
    mov  [time_to_wait],    eax
Line 16... Line 17...
16
 
17
 
-
 
18
  .redraw:
17
  .redraw:
19
      call      Set_geometry
18
      mcall     12,1
-
 
19
    mov  ebx, [wp_x]
-
 
20
    shl  ebx, 16
-
 
21
    add  ebx, dword[window_width]
-
 
22
    mov  ecx, [wp_y]
-
 
23
    shl  ecx, 16
-
 
24
    add  ecx, dword[window_height]
20
      mcall     12,1
Line 25... Line 21...
25
      mcall     0, , ,[window_style], ,window_title
21
      mcall     0, , ,[window_style], ,window_title
26
    
22
    
27
      call      Draw_decorations
23
      call      Draw_decorations
Line 68... Line 64...
68
  .button:                                      ; ¯à®æ¥¤ãà  ®¡à ¡®ª¨ ª­®¯®ª ¢ ¯à®£à ¬¬¥
64
  .button:                                      ; ¯à®æ¥¤ãà  ®¡à ¡®ª¨ ª­®¯®ª ¢ ¯à®£à ¬¬¥
69
      mcall     17                              ; äã­ªæ¨ï 17: ¯®«ãç¨âì ­®¬¥à ­ ¦ â®© ª­®¯ª¨
65
      mcall     17                              ; äã­ªæ¨ï 17: ¯®«ãç¨âì ­®¬¥à ­ ¦ â®© ª­®¯ª¨
Line 70... Line 66...
70
 
66
 
71
    shr  eax, 8                                 ; ᤢ¨£ ¥¬ ॣ¨áâà eax ­  8 ¡¨â ¢¯à ¢®, çâ®¡ë ¯®«ãç¨âì ­®¬¥à ­ ¦ â®© ª­®¯ª¨
67
    shr  eax, 8                                 ; ᤢ¨£ ¥¬ ॣ¨áâà eax ­  8 ¡¨â ¢¯à ¢®, çâ®¡ë ¯®«ãç¨âì ­®¬¥à ­ ¦ â®© ª­®¯ª¨
72
    cmp  eax, 1
68
    cmp  eax, 1
Line 73... Line 69...
73
     je  Save_do_smth_else_and_exit             ; ¥á«¨ íâ® ­¥ ª­®¯ª  1 (§ à¥§¥à¢¨à®¢ ­  á¨á⥬®© ª ª ª­®¯ª  § ªàëâ¨ï ¯à®£à ¬¬ë), ¯à®¯ã᪠¥¬ 2 á«¥¤ãî騥 áâà®çª¨ ª®¤ 
69
     je  Save_do_smth_else_and_exit
Line 74... Line 70...
74
 
70
 
75
     jmp .still
71
     jmp .still
Line -... Line 72...
-
 
72
 
-
 
73
 
-
 
74
  .key:
-
 
75
      mcall     2                               ; get keycode
-
 
76
 
-
 
77
;pushf
-
 
78
;pusha
-
 
79
;movzx eax, ah
76
 
80
;dph eax
77
 
81
;newline
78
  .key:
82
;popa
79
      mcall     2                               ; get keycode
83
;popf
80
    
84
 
-
 
85
    cmp  ah,  0x01                              ; Escape
-
 
86
     je  First_menu
81
    cmp  ah,  0x1B                              ; Escape
87
    cmp  ah,  0x39                              ; Space
82
     je  First_menu
88
     je  Pause_mode
83
    cmp  ah,  0x20                              ; Space
89
    cmp  ah,  0x4B                              ; Left
-
 
90
     je  .key.left
-
 
91
    cmp  ah,  [shortcut_move_left]              ; Left
84
     je  Pause_mode
92
     je  .key.left
-
 
93
    cmp  ah,  0x50                              ; Down
-
 
94
     je  .key.down
85
    cmp  ah,  0xB0                              ; Left
95
    cmp  ah,  [shortcut_move_down]              ; Down
86
     je  .key.left
96
     je  .key.down
87
    cmp  ah,  0xB1                              ; Down
97
    cmp  ah,  0x48                              ; Up
-
 
98
     je  .key.up
-
 
99
    cmp  ah,  [shortcut_move_up]                ; Up
-
 
100
     je  .key.up
-
 
101
    cmp  ah,  0x4D                              ; Right
-
 
102
     je  .key.right
-
 
103
    cmp  ah,  [shortcut_move_right]             ; Right
-
 
104
     je  .key.right
-
 
105
 
-
 
106
    cmp  ah,  0x4B+0x80                         ; Left released
-
 
107
     je  .key.released.left
-
 
108
    mov  al,  [shortcut_move_left]
-
 
109
    add  al,  0x80
-
 
110
    cmp  ah,  al                                ; Left released
-
 
111
     je  .key.released.left
-
 
112
    cmp  ah,  0x50+0x80                         ; Down released
-
 
113
     je  .key.released.down
-
 
114
    mov  al,  [shortcut_move_down]
-
 
115
    add  al,  0x80
-
 
116
    cmp  ah,  al                                ; Down released
-
 
117
     je  .key.released.down
-
 
118
    cmp  ah,  0x48+0x80                         ; Up released
-
 
119
     je  .key.released.up
-
 
120
    mov  al,  [shortcut_move_up]
-
 
121
    add  al,  0x80
-
 
122
    cmp  ah,  al                                ; Up released
-
 
123
     je  .key.released.up
-
 
124
    cmp  ah,  0x4D+0x80                         ; Right released
-
 
125
     je  .key.released.right
-
 
126
    mov  al,  [shortcut_move_right]
-
 
127
    add  al,  0x80
-
 
128
    cmp  ah,  al                                ; Right released
-
 
129
     je  .key.released.right
-
 
130
 
-
 
131
    cmp  ah, [shortcut_reverse]
-
 
132
     jne @f
-
 
133
      call      Reverse_snake
-
 
134
     jmp .still
-
 
135
  @@:
-
 
136
    cmp  ah, [shortcut_increase]
-
 
137
     jne @f
-
 
138
      call      Increase_geometry
-
 
139
     jmp .redraw
-
 
140
  @@:
Line 88... Line 141...
88
     je  .key.down
141
    cmp  ah, [shortcut_decrease]
Line 89... Line 142...
89
    cmp  ah,  0xB2                              ; Up
142
     jne @f
90
     je  .key.up
143
      call      Decrease_geometry
91
    cmp  ah,  0xB3                              ; Right
144
     jmp .redraw
92
     je  .key.right
145
  @@:
93
    
146
    
-
 
147
     jmp .still                                 ; jump to wait for another event
-
 
148
 
-
 
149
 
-
 
150
  .key.left:
-
 
151
    bts  [action],  0
94
     jmp .still                                 ; jump to wait for another event
152
     jc  @f
-
 
153
    mov  [time_to_wait],    0
-
 
154
  @@:
95
 
155
    cmp  [smart_reverse],   1
Line 96... Line 156...
96
 
156
     jne @f
97
  .key.left:
157
    cmp  [snake_direction], RIGHT
98
    bts  [action],  0
158
     je  .still
99
     jc  @f
159
  @@:
100
    mov  [time_to_wait],    0
160
    mov  [snake_direction_next],    LEFT
-
 
161
    bts  [acceleration_mask],   LEFT
-
 
162
     jc  Game_step
-
 
163
     jmp .still
-
 
164
            
-
 
165
  .key.down:
101
  @@:
166
    bts  [action],  0
-
 
167
     jc  @f
-
 
168
    mov  [time_to_wait],    0
102
    mov  [snake_direction_next],    LEFT
169
  @@:
Line 103... Line 170...
103
     jmp .still
170
    cmp  [smart_reverse],   1
104
            
171
     jne @f
105
  .key.down:
172
    cmp  [snake_direction], UP
106
    bts  [action],  0
173
     je  .still
107
     jc  @f
174
  @@:
-
 
175
    mov  [snake_direction_next],    DOWN
-
 
176
    bts  [acceleration_mask],   DOWN
-
 
177
     jc  Game_step
-
 
178
     jmp .still
-
 
179
            
108
    mov  [time_to_wait],    0
180
  .key.up:
-
 
181
    bts  [action],  0
-
 
182
     jc  @f
109
  @@:
183
    mov  [time_to_wait],    0
Line 110... Line 184...
110
    mov  [snake_direction_next],    DOWN
184
  @@:
111
     jmp .still
185
    cmp  [smart_reverse],   1
112
            
186
     jne @f
113
  .key.up:
187
    cmp  [snake_direction], DOWN
114
    bts  [action],  0
188
     je  .still
-
 
189
  @@:
-
 
190
    mov  [snake_direction_next],    UP
-
 
191
    bts  [acceleration_mask],   UP
-
 
192
     jc  Game_step
-
 
193
     jmp .still
115
     jc  @f
194
            
-
 
195
  .key.right:
-
 
196
    bts  [action],  0
-
 
197
     jc  @f
-
 
198
    mov  [time_to_wait],    0
-
 
199
  @@:
-
 
200
    cmp  [smart_reverse],   1
-
 
201
     jne @f
-
 
202
    cmp  [snake_direction], LEFT
-
 
203
     je  .still
-
 
204
  @@:
-
 
205
    mov  [snake_direction_next],    RIGHT
-
 
206
    bts  [acceleration_mask],   RIGHT
-
 
207
     jc  Game_step
-
 
208
     jmp .still
-
 
209
 
-
 
210
 
-
 
211
  .key.released.left:
-
 
212
    btr  [acceleration_mask],   LEFT
-
 
213
     jmp .still
116
    mov  [time_to_wait],    0
214
 
Line 117... Line 215...
117
  @@:
215
  .key.released.down:
Line 254... Line 352...
254
      call      Draw_square
352
      call      Draw_square
255
    sub  esi, 2
353
    sub  esi, 2
256
    mov  bx,  [esi]
354
    mov  bx,  [esi]
257
    mov  edx, [snake_color]
355
    mov  edx, [snake_color]
258
      call      Draw_square
356
      call      Draw_square
-
 
357
      call      Draw_lives_in_head
Line 259... Line 358...
259
 
358
 
Line 260... Line 359...
260
    ret
359
    ret
Line 500... Line 599...
500
     je  Game_over
599
     je  Game_over
501
    mov  ax,  word[eat]
600
    mov  ax,  word[eat]
502
    mov  cl,  1
601
    mov  cl,  1
503
      call      Draw_on_map
602
      call      Draw_on_map
504
      call      Draw_head_prehead
603
      call      Draw_head_prehead
-
 
604
 
-
 
605
    cmp  [play_mode],   CLASSIC_MODE
-
 
606
     jne .is_not_classic_mode
-
 
607
    dec  byte[speed_up_counter]
-
 
608
     jns @f
-
 
609
    mov  al,  byte[speed_up_counter+1]
-
 
610
    mov  byte[speed_up_counter],    al
-
 
611
    cmp  [time_wait_limit], 4
-
 
612
     jl  @f
-
 
613
    dec  [time_wait_limit]
-
 
614
  @@:
-
 
615
 
-
 
616
  .is_not_classic_mode:
-
 
617
    cmp  [play_mode],   LEVELS_MODE
-
 
618
     jne .is_not_levels_mode
-
 
619
    cmp  [snake_length_x2], (EAT_TO_END_LEVEL+3)*2
-
 
620
     je  .skip
-
 
621
 
-
 
622
  .is_not_levels_mode:
505
      call      Get_eat
623
      call      Get_eat
506
      call      Draw_eat
624
      call      Draw_eat
-
 
625
  .skip:
Line 507... Line 626...
507
 
626
 
Line 508... Line 627...
508
     jmp Keys_done
627
     jmp Keys_done
Line 517... Line 636...
517
      call      Draw_on_map
636
      call      Draw_on_map
Line 518... Line 637...
518
 
637
 
Line 519... Line 638...
519
    pop ax
638
    pop ax
-
 
639
 
520
 
640
      call      Get_from_map
521
      call      Get_from_map
641
 
Line 522... Line 642...
522
    test bl,  bl
642
    test bl,  bl
523
     jnz Game_over
643
     jnz Game_over
Line 604... Line 724...
604
    cmp  bh,  0
724
    cmp  bh,  0
605
     jnl @b
725
     jnl @b
Line 606... Line 726...
606
 
726
 
607
    dec  cl
727
    dec  cl
608
    cmp  cl,  0
728
    cmp  cl,  0
Line 609... Line 729...
609
     jl  @f
729
     jl  .picture
610
 
730
 
-
 
731
    push eax ebx
-
 
732
      mcall     5,PAUSE_WHILE_DRAWING_SPLASH
-
 
733
      mcall     2
611
    push eax ebx
734
    cmp  ah,  0x39                              ; Space
612
      mcall     5,PAUSE_WHILE_DRAWING_SPLASH
-
 
613
    pop  ebx eax
735
     jne @f
614
 
736
    pop  ebx eax
-
 
737
     jmp .quit
-
 
738
  @@:
-
 
739
    cmp  ah,  0x1C                              ; Enter
-
 
740
     jne @f
-
 
741
    pop  ebx eax
-
 
742
     jmp .quit
-
 
743
  @@:
Line 615... Line 744...
615
     jmp .draw
744
    pop  ebx eax
616
  @@:
745
     jmp .draw
617
 
746
 
618
    
747
 
619
 
748
  .picture:
620
    mov  ax,  2*0x100+24
749
    mov  ax,  2*0x100+24
Line 630... Line 759...
630
    
759
    
631
    mov  esi, digits_font
760
    mov  esi, digits_font
632
  @@:
761
  @@:
633
    test al,  al
762
    test al,  al
634
     jz  @f
763
     jz  @f
635
    add  esi, 20
764
    add  esi, 5
636
    dec  al
765
    dec  al
637
     jmp @b
766
     jmp @b
Line 638... Line 767...
638
  @@:
767
  @@:
Line 645... Line 774...
645
    pop  ax
774
    pop  ax
646
    mov  esi, digits_font
775
    mov  esi, digits_font
647
  @@:
776
  @@:
648
    test ah,  ah
777
    test ah,  ah
649
     jz  @f
778
     jz  @f
650
    add  esi, 20
779
    add  esi, 5
651
    dec  ah
780
    dec  ah
652
     jmp @b
781
     jmp @b
653
  @@:
782
  @@:
Line 654... Line 783...
654
 
783
 
655
    mov  ax,  15*0x100+4
784
    mov  ax,  15*0x100+4
656
    mov  cx,  8*0x100+5
785
    mov  cx,  8*0x100+5
657
    mov  edx, [splash_level_number_color]
786
    mov  edx, [splash_level_number_color]
Line -... Line 787...
-
 
787
      call      Draw_picture
-
 
788
 
658
      call      Draw_picture
789
      mcall     26,9
659
 
790
    mov  [time_before_waiting], eax
-
 
791
    mov  [time_to_wait],    PAUSE_BETWEEN_LEVELS
-
 
792
  @@:
-
 
793
      mcall     23,[time_to_wait]
-
 
794
      mcall     2
-
 
795
    cmp  ah,  0x39                              ; Space
-
 
796
     je  .quit
-
 
797
    cmp  ah,  0x1C                              ; Enter
-
 
798
     je  .quit
-
 
799
      mcall     26,9
-
 
800
    push eax
-
 
801
    sub  eax, [time_before_waiting]
-
 
802
    pop  [time_before_waiting]
-
 
803
    sub  [time_to_wait],  eax
660
      mcall     5,PAUSE_BETWEEN_LEVELS
804
     jns @b
Line 661... Line 805...
661
 
805
  .quit:
Line -... Line 806...
-
 
806
    ret
-
 
807
 
-
 
808
    ;;---Draw_splash-----------------------------------------------------------------------------------------------------------
-
 
809
 
-
 
810
 
-
 
811
Draw_lives_in_head:
-
 
812
    ;;===Draw_lives_in_head====================================================================================================
-
 
813
 
-
 
814
    cmp  [play_mode],   LEVELS_MODE
-
 
815
     jne .quit
-
 
816
    test [show_lives_style],    2
-
 
817
     jz  .quit
-
 
818
    mov  eax, snake_dots-2
-
 
819
    add  eax, [snake_length_x2]
-
 
820
    mov  ax,  word[eax]
-
 
821
 
-
 
822
    mov  bl,  ah
-
 
823
    mul  byte[g_s]
-
 
824
    mov  edx, [gbxm1]
-
 
825
    add  dx,  ax
-
 
826
    shl  edx, 16
-
 
827
    mov  al,  bl
-
 
828
    mul  byte[g_s]
-
 
829
    mov  dx,  word[gbym1]
-
 
830
    add  dx,  ax
-
 
831
 
-
 
832
    mov  eax, [g_s]
-
 
833
    shl  eax, 16
-
 
834
    add  eax, [g_s]
-
 
835
    and  eax, 0xfffefffe
-
 
836
    shr  eax, 1
-
 
837
    add  edx, eax
-
 
838
    sub  edx, 0x00020003
-
 
839
      mcall     47,0x80010001,lives,,[lives_in_head_number_color]
-
 
840
 
-
 
841
  .quit:
662
    ret
842
    ret
663
 
843