Rev 1935 | Rev 7134 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1935 | Rev 6184 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | ; Game uses its own format of levelset files *.LEV |
25 | ; Game uses its own format of levelset files *.LEV |
26 | ; with simple run-length compression |
26 | ; with simple run-length compression |
Line 27... | Line 27... | ||
27 | 27 | ||
Line -... | Line 28... | ||
- | 28 | ; COMPILE WITH FASM |
|
- | 29 | ||
28 | ; COMPILE WITH FASM |
30 | format binary as "" |
29 | 31 | ||
30 | include '../../../macros.inc' ; decrease code size (optional) |
32 | include '../../../macros.inc' ; decrease code size (optional) |
31 | include 'CELLTYPE.INC' ; object identifiers |
33 | include 'CELLTYPE.INC' ; object identifiers |
32 | ;include 'debug.inc' |
34 | ;include 'debug.inc' |
Line 33... | Line 35... | ||
33 | ;lang equ ru ; russian interface; english if undefined |
35 | ;lang equ ru ; russian interface; english if undefined |
Line 34... | Line 36... | ||
34 | include 'lang.inc' |
36 | include 'lang.inc' |
Line 35... | Line 37... | ||
35 | 37 | ||
36 | CUR_DIR equ '/sys/games/' ; change it to appropriate path |
38 | CUR_DIR equ '/sys/games/' ; change it to appropriate path |
37 | 39 | ||
38 | SKIN_SIZE equ 11520 ; size of skin file (16x240) |
40 | SKIN_SIZE = 11520 ; size of skin file (16x240) |
39 | 41 | ||
40 | ; field dimensions |
42 | ; field dimensions |
41 | FLD_LEFT equ 43 |
43 | FLD_LEFT = 43 |
42 | FLD_LEFT2 equ FLD_LEFT shl 16 |
44 | FLD_LEFT2 = FLD_LEFT shl 16 |
Line 43... | Line 45... | ||
43 | FLD_TOP equ 40 |
45 | FLD_TOP = 40 |
44 | FLD_TOP2 equ FLD_TOP shl 16 |
46 | FLD_TOP2 = FLD_TOP shl 16 |
45 | IMG_SIZE equ 16 shl 16+16 |
47 | IMG_SIZE = 16 shl 16+16 |
46 | SHIFT equ (16 shl 16) |
48 | SHIFT = (16 shl 16) |
47 | WND_COLOR equ 0x03aabbcc |
49 | WND_COLOR = 0x00aabbcc |
Line 48... | Line 50... | ||
48 | 50 | ||
49 | ; level list dimensions |
51 | ; level list dimensions |
50 | LEVLIST_XY equ FLD_TOP shl 16+45 |
52 | LEVLIST_XY = FLD_TOP shl 16+45 |
51 | LEVLIST_SPACING equ 10 |
53 | LEVLIST_SPACING = 10 |
Line 52... | Line 54... | ||
52 | LEVWND_X equ 320 |
54 | LEVWND_X = 320 |
53 | LEVWND_Y equ 200 |
55 | LEVWND_Y = 200 |
54 | 56 | ||
55 | ; input line dimensions |
57 | ; input line dimensions |
56 | INP_X equ 10 shl 16+300 |
58 | INP_X = 10 shl 16+300 |
Line 57... | Line 59... | ||
57 | INP_Y equ 160 shl 16+16 |
59 | INP_Y = 160 shl 16+16 |
Line 58... | Line 60... | ||
58 | INP_XY equ 15 shl 16+164 |
60 | INP_XY = 15 shl 16+164 |
59 | 61 | ||
60 | ; load button dimensions |
62 | ; load button dimensions |
61 | LOAD_X equ 130 shl 16+65 |
63 | LOAD_X = 130 shl 16+65 |
Line 62... | Line 64... | ||
62 | LOAD_Y equ 180 shl 16+14 |
64 | LOAD_Y = 180 shl 16+14 |
63 | LOAD_XY equ 135 shl 16+184 |
65 | LOAD_XY = 135 shl 16+184 |
64 | CHOOSE_XY equ 40 shl 16+148 |
66 | CHOOSE_XY = 40 shl 16+148 |
65 | 67 | ||
Line 81... | Line 83... | ||
81 | dd 0x7fff0 |
83 | dd 0x7fff0 |
82 | dd 0x0 |
84 | dd 0x0 |
83 | dd 0x0 |
85 | dd 0x0 |
Line 84... | Line 86... | ||
84 | 86 | ||
85 | START: |
87 | START: |
86 | mov eax,58 ; load skin image-it is in RAW 16x240 BGR |
88 | mov eax,70 ; load skin image-it is in RAW 16x240 BGR |
87 | mov ebx,file_info ; IrfanView recommended |
89 | mov ebx,file_info ; IrfanView recommended |
88 | int 0x40 |
90 | int 0x40 |
89 | test ebx,ebx |
91 | test ebx,ebx |
90 | ; jmp load_level |
92 | ; jmp load_level |
Line 101... | Line 103... | ||
101 | mov dword[cnf_level],level_start |
103 | mov dword[cnf_level],level_start |
102 | xor eax,eax |
104 | xor eax,eax |
103 | mov [levpage],eax |
105 | mov [levpage],eax |
104 | mov word[ll_num],'00' ; reset some counters |
106 | mov word[ll_num],'00' ; reset some counters |
105 | read_cnf: |
107 | read_cnf: |
106 | mov eax,58 |
108 | mov eax,70 |
107 | mov ebx,file_info |
109 | mov ebx,file_info |
108 | int 0x40 |
110 | int 0x40 |
109 | test ebx,ebx ; load standard levels SOKO-?.LEV instead of custom |
111 | test ebx,ebx ; load standard levels SOKO-?.LEV instead of custom |
110 | jz nxt_cnf |
112 | jz nxt_cnf |
111 | add dword[cnf_level],ebx |
113 | add dword[cnf_level],ebx |
Line 214... | Line 216... | ||
214 | movzx edx,[player] |
216 | movzx edx,[player] |
215 | inc ch |
217 | inc ch |
216 | call valid_move |
218 | call valid_move |
217 | cmp byte[winmode],WM_WINNER |
219 | cmp byte[winmode],WM_WINNER |
218 | jne no_winner |
220 | jne no_winner |
219 | mov ecx,0x20ac0000 |
221 | mov ecx,0x00ac0000 |
220 | mov edx,win_msg |
222 | mov edx,win_msg |
221 | mov esi,win_msg_end-win_msg ; print victory congratulations |
223 | mov esi,win_msg_end-win_msg ; print victory congratulations |
222 | print_msg: |
224 | print_msg: |
223 | mov ebx,WIN_XY |
225 | mov ebx,WIN_XY |
224 | mov eax,4 |
226 | mov eax,4 |
Line 342... | Line 344... | ||
342 | mov eax,0 |
344 | mov eax,0 |
343 | mov ebx,150*65536 |
345 | mov ebx,150*65536 |
344 | add ebx,[wnd_width] |
346 | add ebx,[wnd_width] |
345 | mov ecx,50*65536 |
347 | mov ecx,50*65536 |
346 | add ecx,[wnd_height] |
348 | add ecx,[wnd_height] |
347 | mov edx,WND_COLOR |
349 | mov edx,0x13000000 + WND_COLOR |
348 | mov esi,0x805080d0 |
- | |
349 | mov edi,0x005080d0 |
350 | mov esi,0x005080d0 |
350 | int 0x40 |
- | |
351 | - | ||
352 | mov eax,4 |
- | |
353 | mov ebx,8*65536+8 |
- | |
354 | mov ecx,0x10ddeeff |
- | |
355 | mov edx,zagolovok |
351 | mov edi,zagolovok |
356 | mov esi,zag_konets-zagolovok |
- | |
357 | int 0x40 |
352 | int 0x40 |
Line 358... | Line 353... | ||
358 | 353 | ||
359 | cmp byte[workmode],WM_READSET |
354 | cmp byte[workmode],WM_READSET |
Line 383... | Line 378... | ||
383 | mov edx,3 |
378 | mov edx,3 |
384 | mov esi,WND_COLOR |
379 | mov esi,WND_COLOR |
385 | int 0x40 |
380 | int 0x40 |
Line 386... | Line 381... | ||
386 | 381 | ||
387 | mov eax,4 |
382 | mov eax,4 |
388 | mov ecx,0x20107a30 |
383 | mov ecx,0x00107a30 |
389 | mov ebx,LOAD_XY |
384 | mov ebx,LOAD_XY |
390 | mov edx,load_char |
385 | mov edx,load_char |
391 | mov esi,loadlen-load_char |
386 | mov esi,loadlen-load_char |
Line 392... | Line 387... | ||
392 | int 0x40 |
387 | int 0x40 |
393 | 388 | ||
394 | mov ebx,LEVLIST_XY |
389 | mov ebx,LEVLIST_XY |
395 | mov edi,0x204e00e7 |
390 | mov edi,0x004e00e7 |
396 | xor esi,esi |
391 | xor esi,esi |
397 | mov ecx,10 |
392 | mov ecx,10 |
398 | ll_cycle: |
393 | ll_cycle: |
Line 841... | Line 836... | ||
841 | je no_cl_destroy |
836 | je no_cl_destroy |
842 | cmp al,tHole |
837 | cmp al,tHole |
843 | je no_cl_destroy |
838 | je no_cl_destroy |
844 | cmp al,tPlayer |
839 | cmp al,tPlayer |
845 | jne cl_exit |
840 | jne cl_exit |
846 | mov ecx,0x20ac0000 |
841 | mov ecx,0x00ac0000 |
847 | mov edx,lose_msg |
842 | mov edx,lose_msg |
848 | mov esi,lose_msg_end-lose_msg ; print loose message |
843 | mov esi,lose_msg_end-lose_msg ; print loose message |
849 | mov byte[winmode],WM_LOSE |
844 | mov byte[winmode],WM_LOSE |
850 | mov ebx,WIN_XY |
845 | mov ebx,WIN_XY |
851 | mov eax,4 |
846 | mov eax,4 |
Line 1090... | Line 1085... | ||
1090 | else |
1085 | else |
1091 | db "You're paralized! Game over..." |
1086 | db "You're paralized! Game over..." |
1092 | end if |
1087 | end if |
1093 | lose_msg_end: |
1088 | lose_msg_end: |
Line 1094... | Line -... | ||
1094 | - | ||
1095 | zagolovok: ; áâப § £®«®¢ª |
1089 | |
1096 | if lang eq ru |
- | |
1097 | db ' ' |
- | |
1098 | else |
1090 | zagolovok: |
1099 | db 'SOKOBAN FOR' |
1091 | db 'Sokoban', 0 |
1100 | end if |
- | |
1101 | db ' MENUET' |
- | |
Line 1102... | Line 1092... | ||
1102 | zag_konets: ; ¨ ¥ñ ª®¥æ |
1092 | |
1103 | 1093 | ||
1104 | pic_map: |
1094 | pic_map: |
1105 | db 0xf,9,0,0,1,1,5,6 |
1095 | db 0xf,9,0,0,1,1,5,6 |
Line 1121... | Line 1111... | ||
1121 | 1111 | ||
1122 | inp_pos dd inp_end-fn_input |
1112 | inp_pos dd inp_end-fn_input |
Line 1123... | Line 1113... | ||
1123 | entered dd 0 |
1113 | entered dd 0 |
1124 | 1114 | ||
1125 | file_info: |
1115 | file_info: |
1126 | dd 0 |
1116 | dd 0 ; subfunction - read |
1127 | dd 0 |
1117 | dd 0, 0 ; file offset |
1128 | dd 0x100 |
- | |
1129 | cnf_level dd strip |
1118 | dd 0x20000 ; number of bytes to read |
1130 | dd workarea |
1119 | cnf_level dd strip ; data buffer |
1131 | file_name db CUR_DIR |
1120 | file_name db CUR_DIR ; Filename |
Line 1132... | Line 1121... | ||
1132 | path_end db 'SKIN.' |
1121 | path_end db 'SKIN.' |
Line 1147... | Line 1136... | ||
1147 | wnd_width dd ? |
1136 | wnd_width dd ? |
1148 | color db ? |
1137 | color db ? |
1149 | colcount db ? |
1138 | colcount db ? |
1150 | levelcount dd ? |
1139 | levelcount dd ? |
1151 | checkcount db ? |
1140 | checkcount db ? |
1152 | checkpoint: |
1141 | checkpoint rw 256 |
1153 | times 256 dw ? |
- | |
1154 | levelmap: |
- | |
1155 | times 1024 dd ? |
1142 | levelmap rd 1024 |
1156 | strip rb SKIN_SIZE |
1143 | strip rb SKIN_SIZE |
Line 1157... | Line 1144... | ||
1157 | 1144 | ||
1158 | workarea: |
1145 | workarea: |