Rev 2597 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | include "lang.inc" |
2094 | dunkaist | 2 | include "../../../macros.inc" |
9647 | IgorA | 3 | include "../../../KOSfuncs.inc" |
31 | halyavin | 4 | |
5 | WND_SIZE_X = 320 |
||
6 | WND_SIZE_Y = 200 |
||
7 | |||
8 | VC_DELTA = 1 |
||
9 | HC_DELTA = 2 |
||
10 | |||
11 | MEOS_APP_START |
||
12 | CODE |
||
13 | fninit |
||
14 | call init_sinus_table |
||
15 | call init_background |
||
16 | call init_palette |
||
9647 | IgorA | 17 | mcall SF_SET_EVENTS_MASK, 101b |
31 | halyavin | 18 | jmp .paint_window |
19 | |||
20 | .event_loop: |
||
9647 | IgorA | 21 | mcall SF_WAIT_EVENT_TIMEOUT, 1 |
31 | halyavin | 22 | |
23 | test eax,eax |
||
24 | je .draw_screen |
||
25 | dec eax |
||
26 | je .paint_window |
||
27 | |||
9647 | IgorA | 28 | mcall SF_TERMINATE_PROCESS |
31 | halyavin | 29 | |
30 | .draw_screen: |
||
2094 | dunkaist | 31 | test [proc_info.wnd_state], 0x04 |
32 | jnz .event_loop |
||
31 | halyavin | 33 | add word [ver_counter],VC_DELTA |
34 | add word [hor_counter],HC_DELTA |
||
35 | call handle_animation |
||
2597 | clevermous | 36 | xor ebp,ebp |
9647 | IgorA | 37 | mcall SF_PUT_IMAGE_EXT, virtual_screen_8, |
31 | halyavin | 38 | jmp .event_loop |
39 | |||
40 | .paint_window: |
||
9647 | IgorA | 41 | mcall SF_THREAD_INFO, proc_info,-1 |
42 | mcall SF_REDRAW, SSF_BEGIN_DRAW |
||
31 | halyavin | 43 | |
9647 | IgorA | 44 | mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT |
2597 | clevermous | 45 | lea ecx,[eax + (100 shl 16) + WND_SIZE_Y+4] |
485 | heavyiron | 46 | mov edi,title |
9647 | IgorA | 47 | mcall SF_CREATE_WINDOW, <100,WND_SIZE_X+9>,,0x74000000 |
31 | halyavin | 48 | |
2094 | dunkaist | 49 | test [proc_info.wnd_state], 0x04 |
50 | jnz @f |
||
51 | |||
2597 | clevermous | 52 | xor ebp,ebp |
9647 | IgorA | 53 | mcall SF_PUT_IMAGE_EXT, virtual_screen_8, |
2094 | dunkaist | 54 | @@: |
9647 | IgorA | 55 | mcall SF_REDRAW, SSF_END_DRAW |
31 | halyavin | 56 | |
57 | jmp .event_loop |
||
58 | |||
59 | init_palette: |
||
60 | mov ecx,256 |
||
61 | mov edi,_palette |
||
62 | xor eax,eax |
||
63 | .next_pal: |
||
64 | mov al,ah |
||
65 | shr al,2 |
||
66 | stosb |
||
67 | stosb |
||
68 | stosb |
||
2597 | clevermous | 69 | stosb |
31 | halyavin | 70 | inc ah |
71 | loop .next_pal |
||
72 | ret |
||
73 | |||
74 | init_sinus_table: |
||
75 | sub esp,4 |
||
76 | mov ecx,256 |
||
77 | mov edi,sinetable |
||
78 | .sin_loop: |
||
79 | fld dword [esp] |
||
80 | fld st0 |
||
81 | fsin |
||
82 | fmul [scale_sin] |
||
83 | fistp word [edi] |
||
84 | fadd [delta_angle] |
||
85 | fstp dword [esp] |
||
86 | add edi,2 |
||
87 | loop .sin_loop |
||
88 | add esp,4 |
||
89 | ret |
||
90 | |||
91 | init_background: |
||
92 | mov edi,background |
||
93 | xor edx,edx |
||
94 | .ib_vertical: |
||
95 | xor ecx,ecx |
||
96 | .ib_horizontal: |
||
97 | mov eax,ecx |
||
98 | xor eax,edx |
||
99 | stosb |
||
100 | inc ecx |
||
101 | cmp ecx,256 |
||
102 | jne .ib_horizontal |
||
103 | inc edx |
||
104 | cmp edx,256 |
||
105 | jne .ib_vertical |
||
106 | ret |
||
107 | |||
108 | s_OFFX = 0 |
||
109 | s_OFFY = 2 |
||
110 | |||
111 | handle_animation: |
||
112 | sub esp,4 |
||
113 | mov ebx,[ver_counter] |
||
114 | and ebx,255 |
||
115 | add ebx,ebx |
||
116 | mov ax,[sinetable+ebx] |
||
117 | mov [esp+s_OFFY],ax |
||
118 | mov ebx,[hor_counter] |
||
119 | and ebx,255 |
||
120 | add ebx,ebx |
||
121 | mov ax,[sinetable+ebx] |
||
122 | mov [esp+s_OFFX],ax |
||
2597 | clevermous | 123 | mov edi,virtual_screen_8 |
31 | halyavin | 124 | mov edx,WND_SIZE_Y-1 |
125 | .a_ver: |
||
126 | mov ecx,WND_SIZE_X-1 |
||
127 | mov bx,[esp+s_OFFY] |
||
128 | add bx,dx |
||
129 | and ebx,255 |
||
130 | shl ebx,8 |
||
131 | .a_hor: |
||
132 | mov ax,[esp+s_OFFX] |
||
133 | add ax,cx |
||
134 | and eax,255 |
||
2597 | clevermous | 135 | mov al,[background+ebx+eax] |
31 | halyavin | 136 | stosb |
137 | dec ecx |
||
138 | jge .a_hor |
||
139 | dec edx |
||
140 | jge .a_ver |
||
141 | add esp,4 |
||
142 | ret |
||
143 | |||
144 | DATA |
||
145 | delta_angle dd 0.0245436926066 ; pi/128 |
||
146 | scale_sin dd 128.0 |
||
147 | |||
485 | heavyiron | 148 | title db 'MoveBack',0 |
31 | halyavin | 149 | |
150 | UDATA |
||
151 | ver_counter dd ? |
||
152 | hor_counter dd ? |
||
153 | |||
154 | _palette: rd 256 |
||
155 | |||
2597 | clevermous | 156 | virtual_screen_8: |
157 | rb WND_SIZE_X*WND_SIZE_Y |
||
31 | halyavin | 158 | |
159 | background: |
||
160 | rb 256*256 |
||
161 | |||
162 | sinetable: |
||
163 | rw 256 |
||
164 | |||
2094 | dunkaist | 165 | proc_info process_information |
166 | |||
167 | MEOS_APP_END0,0>100,WND_SIZE_X+9>0,0> |