Subversion Repositories Kolibri OS

Rev

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

Rev 1880 Rev 1881
Line 1... Line 1...
1
;---------------------------------------------------------------------
1
;---------------------------------------------------------------------
-
 
2
; Free3D version 0.6
-
 
3
;
-
 
4
; last update:  21/02/2011
-
 
5
; written by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
6
; changes:      advanced control for mouse
-
 
7
;               advanced control for keyboard:
-
 
8
;               W,A,S,D adn Arrow UP,Down,Left,Right
-
 
9
;---------------------------------------------------------------------
2
; Free3D version 0.5
10
; Free3D version 0.5
3
;
11
;
4
; last update:  20/02/2011
12
; last update:  20/02/2011
5
; written by:   Marat Zakiyanov aka Mario79, aka Mario
13
; written by:   Marat Zakiyanov aka Mario79, aka Mario
6
; changes:      PNG textures 128x128
14
; changes:      PNG textures 128x128
Line 26... Line 34...
26
 
34
 
27
ICON_SIZE_X	equ	128	;64
35
ICON_SIZE_X	equ	128	;64
Line 28... Line 36...
28
ICON_SIZE_Y	equ	128	;64
36
ICON_SIZE_Y	equ	128	;64
29
 
-
 
30
Floors_Height	equ	32000
-
 
31
;ceil	=	sinus+TEX_SIZE	;16*1024
-
 
32
;wall	=	ceil+TEX_SIZE*1
-
 
33
;wall2	=	ceil+TEX_SIZE*2
-
 
34
;wall3	=	ceil+TEX_SIZE*3
-
 
35
;wall4	=	ceil+TEX_SIZE*4
-
 
36
;wall5	=	ceil+TEX_SIZE*5
-
 
37
;wall6	=	ceil+TEX_SIZE*6
-
 
38
;wall7	=	ceil+TEX_SIZE*7
37
 
39
;APP_MEM	equ	0x400000
38
Floors_Height	equ	32000
40
;---------------------------------------------------------------------
39
;---------------------------------------------------------------------
41
use32
40
use32
42
org	0x0
41
org	0x0
Line 47... Line 46...
47
	dd I_END	; 0x100000 ; memory for app
46
	dd I_END	; 0x100000 ; memory for app
48
	dd stacktop	; 0x100000 ; esp
47
	dd stacktop	; 0x100000 ; esp
49
	dd 0x0
48
	dd 0x0
50
	dd path
49
	dd path
51
;---------------------------------------------------------------------
50
;---------------------------------------------------------------------
52
include '..\..\..\macros.inc'
51
include '../../../macros.inc'
53
;include	'macros.inc'
52
;include	'macros.inc'
54
include '../../../develop/libraries/box_lib/load_lib.mac'
53
include '../../../develop/libraries/box_lib/load_lib.mac'
55
;include 'load_lib.mac'
54
;include 'load_lib.mac'
56
@use_library
55
@use_library
57
;COLOR_ORDER	equ OTHER
-
 
58
;include		'gif_lite.inc'
-
 
59
;---------------------------------------------------------------------
56
;---------------------------------------------------------------------
60
START:	; start of execution
57
START:	; start of execution
61
	mcall	68,11
58
	mcall	68,11
-
 
59
	mcall	66,1,1
-
 
60
	mcall	40,0x27
-
 
61
 
-
 
62
	mcall	9,procinfo,-1
-
 
63
	mov	ecx,[ebx+30]	; PID
-
 
64
	mcall	18,21
-
 
65
	mov	[active_process],eax	; WINDOW SLOT
Line 62... Line 66...
62
 
66
 
63
load_libraries	l_libs_start,end_l_libs
67
load_libraries	l_libs_start,end_l_libs
64
	test	eax,eax
68
	test	eax,eax
Line 82... Line 86...
82
	fmul	[sindiv]
86
	fmul	[sindiv]
83
	fistp	dword[esi]
87
	fistp	dword[esi]
84
	add	esi,4
88
	add	esi,4
85
	fadd	[sininc]
89
	fadd	[sininc]
86
	loop	.sinlp
90
	loop	.sinlp
-
 
91
;---------------------------------------------------------------------
-
 
92
	call	cursor_to_screen_center
87
	call	draw_window	; at first, draw the window
93
	call	set_new_cursor_skin
-
 
94
;---------------------------------------------------------------------	
-
 
95
align	4
-
 
96
red:	; redraw
-
 
97
	call	draw_window
88
	call	draw_stuff
98
	call	draw_stuff
89
;--------------------------------------
99
;---------------------------------------------------------------------
90
align	4
100
align	4
91
gamestart:
101
still:
92
; ******* MOUSE CHECK *******
-
 
93
;	mov	eax,37	; check mouse (use mouse over window to navigate)
-
 
94
;	mov	ebx,2	; check mousebuttons
-
 
95
;	mcall
-
 
96
;	cmp	eax,0	; only use mouse when button down
102
	mcall	10	; ask no wait for full speed
97
;	je	noneed	; deactivated cause of disappear-bug etc.
-
 
Line 98... Line 103...
98
 
103
 
99
	mcall	37,1	; check	mouseposition
104
	cmp	eax,1	; window redraw request ?
100
	mov	ebx,eax
-
 
101
	shr	eax,16
-
 
102
	and	eax,0x0000FFFF	; mousex
-
 
Line 103... Line 105...
103
	and	ebx,0x0000FFFF	; mousey
105
	je	red
104
 
106
 
Line 105... Line 107...
105
	cmp	eax,5	; mouse out of window ?
107
	cmp	eax,2	; key in buffer ?
106
	jb	check_refresh	; it will prevent an app-crash
108
	je	key
Line 107... Line 109...
107
 
109
 
-
 
110
	cmp	eax,3	; button in buffer ?
-
 
111
	je	button
-
 
112
 
-
 
113
	cmp	eax,6
108
	cmp	ebx,22
114
	jne	still
-
 
115
;---------------------------------------------------------------------
Line 109... Line 116...
109
	jb	check_refresh
116
mouse:
110
 
-
 
Line -... Line 117...
-
 
117
	mcall	18,7
111
	cmp	eax,640
118
	cmp	[active_process],eax
112
	jg	check_refresh
119
	jne	still
Line 113... Line 120...
113
 
120
 
114
	cmp	ebx,501
121
	mcall	37,1
115
	jg	check_refresh
122
 
116
 
-
 
117
	cmp	eax,315	; navigating?
123
	xor	ebx,ebx
118
	jb	m_left
-
 
Line 119... Line 124...
119
 
124
	mov	bx,ax  ; EBX mouse y
-
 
125
	shr	eax,16 ; EAX mouse x
120
	cmp	eax,325	;
126
 
-
 
127
	mov	ecx,[mouse_position_old]
-
 
128
	xor	edx,edx
-
 
129
	mov	dx,cx  ; EDX mouse y old
-
 
130
	shr	ecx,16 ; ECX mouse x old
-
 
131
	
-
 
132
	cmp	eax,ecx
-
 
133
	je	.y	;still
-
 
134
	ja	.turn_left
-
 
135
;---------------------------------------------------------------------
-
 
136
.turn_right:
-
 
137
	xchg	eax,ecx
-
 
138
	sub	eax,ecx
121
	jg	m_right
139
	mov	edi,[vheading]
-
 
140
	add	edi,eax
-
 
141
	jmp	@f
-
 
142
;---------------------------------------------------------------------
-
 
143
.turn_left:
-
 
144
	sub	eax,ecx
-
 
145
	mov	edi,[vheading]
-
 
146
	sub	edi,eax
122
;--------------------------------------	
147
;--------------------------------------
123
continue:
148
@@:
-
 
149
	call	check_range
-
 
150
;---------------------------------------------------------------------
124
	cmp	ebx,220	;
151
.y:
125
	jb	s_up
152
	cmp	ebx,edx
126
 
153
	je	.red
127
	cmp	ebx,260	;
154
	ja	.walk_down
128
	jg	s_down
155
;--------------------------------------
129
;--------------------------------------
156
.walk_up:	
-
 
157
	sub	edx,ebx
-
 
158
	mov	ecx,edx
-
 
159
	call	prepare_2
-
 
160
	jz	.1
130
;   ******* END OF MOUSE CHECK *******
161
;--------------------------------------	
131
align	4
162
	add	eax,edi	; newPx
Line -... Line 163...
-
 
163
	add	ebx,esi	; newPy
-
 
164
	jmp	.1
-
 
165
;---------------------------------------------------------------------
-
 
166
.walk_down:
-
 
167
	sub	ebx,edx
132
check_refresh:
168
	mov	ecx,ebx
-
 
169
	call	prepare_2
-
 
170
	jz	.1
-
 
171
	
-
 
172
	sub	eax,edi	; newPx
-
 
173
	sub	ebx,esi	; newPy
-
 
174
;--------------------------------------
133
 
175
.1:
Line -... Line 176...
-
 
176
	mov	edi,eax	; newPx / ffff
134
;	mov	eax,23	; wait for system event with 10 ms timeout
177
	mov	esi,ebx	; newPy / ffff
-
 
178
	sar	edi,16
-
 
179
	sar	esi,16
-
 
180
	mov	ecx,esi
-
 
181
	sal	ecx,5
-
 
182
	lea	ecx,[grid+ecx+edi]
-
 
183
	cmp	[ecx],byte 0
-
 
184
	je	@f
-
 
185
	
-
 
186
	call	cursor_to_screen_center	
-
 
187
	jmp	still	;cannotwalk
-
 
188
;---------------------------------------------------------------------
-
 
189
@@:
-
 
190
	mov	[vpx],eax
-
 
191
	mov	[vpy],ebx
-
 
192
;--------------------------------------
-
 
193
.red:
-
 
194
	call	cursor_to_screen_center
-
 
195
	jmp	red
-
 
196
;---------------------------------------------------------------------
-
 
197
align	4
-
 
198
prepare_2:
135
;	mov	ebx,1	; thats max 100 FPS
199
	shr	ecx,4
-
 
200
	push	ecx
-
 
201
	call	prepare_1
-
 
202
	pop	ecx
-
 
203
	cmp	ecx,3
-
 
204
	jb	@f
-
 
205
	mov	ecx,3
Line -... Line 206...
-
 
206
@@:
-
 
207
	shl	edi,cl
136
	mcall	11	; ask no wait for full speed
208
	shl	esi,cl
-
 
209
	test	ecx,ecx
137
 
210
	ret
138
	cmp	eax,1	; window redraw request ?
211
;---------------------------------------------------------------------
Line 139... Line 212...
139
	je	red2
212
align	4
-
 
213
check_range:
-
 
214
	cmp	edi,0
-
 
215
	jge	@f
140
 
216
 
141
	cmp	eax,2	; key in buffer ?
217
	mov	edi,3600
142
	je	key2
218
	jmp	.store
143
 
219
;--------------------------------------
-
 
220
@@:
-
 
221
	cmp	edi,3600
-
 
222
	jle	@f
-
 
223
 
-
 
224
	xor	edi,edi
-
 
225
;--------------------------------------	
144
	cmp	eax,3	; button in buffer ?
226
@@:
145
	je	button2
227
.store:
-
 
228
	mov	[vheading],edi
146
 
229
	ret
147
	mov	edi,[mouseya]	; check flag if a refresh has to be done
230
;---------------------------------------------------------------------
-
 
231
align	4
-
 
232
cursor_to_screen_center:
148
	cmp	edi,1
233
	mcall	18,15
149
	jne	gamestart
234
	mcall	37,1
150
 
235
	mov	[mouse_position_old],eax
151
	mov	[mouseya],dword 0
236
	ret
-
 
237
;---------------------------------------------------------------------
-
 
238
set_new_cursor_skin:
-
 
239
	mcall	68,12,32*32*4
-
 
240
	mov	ecx,eax
-
 
241
	mcall	37,4,,2
152
	call	draw_stuff
242
	mov	ecx,eax
-
 
243
	mcall	37,5
-
 
244
	ret
-
 
245
;---------------------------------------------------------------------
-
 
246
align	4
-
 
247
key:	; key
-
 
248
	mcall	2
-
 
249
	cmp	[extended_key],1
-
 
250
	je	.extended_key
-
 
251
	test	al, al
-
 
252
	jnz	still
-
 
253
 
-
 
254
	cmp	ah, 0xE0
-
 
255
	jne	@f
-
 
256
 
-
 
257
	mov	[extended_key],1
-
 
258
	jmp	still
153
	jmp	gamestart
259
;---------------------------------------------------------------------
-
 
260
@@:
-
 
261
	cmp	ah,1	; Esc
-
 
262
	je	finish
-
 
263
 
-
 
264
	cmp	ah,17 ; W up
-
 
265
	je	s_up
-
 
266
 
-
 
267
	cmp	ah,31 ; S down
-
 
268
	je	s_down
Line 154... Line 269...
154
;---------------------------------------------------------------------
269
 
155
align	4
270
	cmp	ah,30 ; A left
Line 156... Line 271...
156
red2:	; redraw
271
	je	w_left	;s_left
157
	call	draw_window
272
 
Line 158... Line 273...
158
	call	draw_stuff
273
	cmp	ah,32 ; D right
159
	jmp	gamestart
274
	je	w_right	;s_right
Line 160... Line 275...
160
;---------------------------------------------------------------------
275
 
161
align	4
276
	jmp	still
Line 162... Line 277...
162
key2:	; key
277
;---------------------------------------------------------------------
163
	mcall	2
278
.extended_key:
Line 164... Line 279...
164
	cmp	al,1
279
	mov	[extended_key],0
165
	je	gamestart	; keybuffer empty
280
	mov	[current_key_code],ah
166
 
281
 
-
 
282
	cmp	ah,27	; esc=End App
167
	cmp	ah,27	; esc=End App
283
	je	finish
-
 
284
 
-
 
285
	cmp	ah,72 ; up arrow
168
	je	finish
286
	je	s_up
-
 
287
 
-
 
288
	cmp	ah,80 ; down arrow
-
 
289
	je	s_down
-
 
290
 
169
 
291
	cmp	ah,75 ; left arrow
-
 
292
	je	s_left
Line 170... Line 293...
170
	cmp	ah,178	; up
293
 
171
	je	s_up
294
	cmp	ah,77 ; right arrow
Line 172... Line 295...
172
 
295
	je	s_right
173
	cmp	ah,177	; down
-
 
174
	je	s_down
-
 
175
 
296
 
Line -... Line 297...
-
 
297
	jmp	still
-
 
298
;---------------------------------------------------------------------
-
 
299
align	4
-
 
300
smart_clr_key_buf:
-
 
301
	mov	al,[old_key_code]
-
 
302
	mov	ah,[current_key_code]
-
 
303
	mov	[old_key_code],ah
-
 
304
	cmp	al,ah
-
 
305
	jne	.end
-
 
306
;--------------------------------------
-
 
307
.still:
-
 
308
	mcall	2
-
 
309
	cmp	[extended_key],1
-
 
310
	je	.extended_key
-
 
311
 
176
	cmp	ah,176	; left
312
	test	al, al
-
 
313
	jnz	.end
177
	je	s_left
314
 
178
 
315
	cmp	ah, 0xE0
-
 
316
	jne	.end
-
 
317
 
-
 
318
	mov	[extended_key],1
-
 
319
	jmp	.still
179
	cmp	ah,179	; right
320
.end:
-
 
321
	call	draw_stuff
-
 
322
	jmp	still
-
 
323
;---------------------------------------------------------------------
-
 
324
.extended_key:
180
	je	s_right
325
	mov  [extended_key],0
181
 
326
	mov  [current_key_code],ah
182
	jmp	gamestart	; was any other key
327
	jmp  smart_clr_key_buf
183
;---------------------------------------------------------------------
328
;---------------------------------------------------------------------
-
 
329
align	4
-
 
330
w_left:		; walk left
-
 
331
	call	prepare_1
-
 
332
	add	eax,esi	; newPx
-
 
333
	sub	ebx,edi	; newPy
-
 
334
	jmp	s_down.1
-
 
335
;---------------------------------------------------------------------
-
 
336
align	4
-
 
337
w_right:	; walk right
-
 
338
	call	prepare_1
184
align	4
339
	sub	eax,esi	; newPx
185
s_up:	; walk forward (key or mouse)
340
	add	ebx,edi	; newPy
186
	mov	eax,[vpx]
341
	jmp	s_down.1
187
	mov	ebx,[vpy]
342
;---------------------------------------------------------------------
188
 
343
align	4
189
	mov	ecx,[vheading]
344
s_up:	; walk forward (key or mouse)
190
	mov	edi,[sinus+ecx*4]
345
	call	prepare_1
191
 
346
;	sal	esi,1	; edit walking speed here
192
	mov	edx,[vheading]
347
;	sal	edi,1
-
 
348
	add	eax,edi	; newPx
193
	lea	edx,[sinus+3600+edx*4]
349
	add	ebx,esi	; newPy
194
	cmp	edx,eosinus	;cosinus taken from (sinus plus 900) mod 3600
350
	jmp	s_down.1
195
	jb	ok200
-
 
196
 
-
 
197
	sub	edx,14400
-
 
198
;--------------------------------------
351
;---------------------------------------------------------------------
199
ok200:
352
align	4
200
	mov	esi,[edx]
353
s_down:	; walk	backward
201
;	sal	esi,1	; edit walking speed here
354
	call	prepare_1
202
;	sal	edi,1
355
;	sal	esi,1	; edit walking speed here
203
	add	eax,edi	; newPx
356
;	sal	edi,1
204
	add	ebx,esi	; newPy
357
	sub	eax,edi	; newPx
-
 
358
	sub	ebx,esi	; newPy
205
	mov	edi,eax	; newPx / ffff
359
.1:
206
	mov	esi,ebx	; newPy / ffff
-
 
207
	sar	edi,16
360
	mov	edi,eax	; newPx / ffff
208
	sar	esi,16
361
	mov	esi,ebx	; newPy / ffff
209
	mov	ecx,esi
362
	sar	edi,16
-
 
363
	sar	esi,16
210
	sal	ecx,5	; equal *32
364
	mov	ecx,esi
211
	lea	ecx,[grid+ecx+edi]
365
	sal	ecx,5
212
	cmp	[ecx],byte 0	; collision check
366
	lea	ecx,[grid+ecx+edi]
213
	jne	cannotwalk0
367
	cmp	[ecx],byte 0
214
	mov	[vpx],eax
-
 
215
	mov	[vpy],ebx
-
 
216
	mov	[mouseya],dword 1	; set refresh	flag
-
 
217
;--------------------------------------	
-
 
218
cannotwalk0:
-
 
219
	jmp	check_refresh
-
 
220
;---------------------------------------------------------------------
-
 
221
align	4
368
	jne	smart_clr_key_buf	;cannotwalk
222
s_down:	; walk	backward
-
 
223
	mov	eax,[vpx]
-
 
224
	mov	ebx,[vpy]
-
 
225
	mov	ecx,[vheading]
-
 
226
	mov	edi,[sinus+ecx*4]
-
 
227
	mov	edx,[vheading]
-
 
228
	lea	edx,[sinus+3600+edx*4]
-
 
229
	cmp	edx,eosinus	; cosinus taken from (sinus plus 900) mod 3600
-
 
230
	jb	ok201
-
 
231
	sub	edx,14400
-
 
232
;--------------------------------------
-
 
233
ok201:
369
 
234
	mov	esi,[edx]
370
	mov	[vpx],eax
235
;	sal	esi,1	; edit walking speed here
371
	mov	[vpy],ebx
236
;	sal	edi,1
372
	jmp	smart_clr_key_buf
237
	sub	eax,edi	; newPx
373
;---------------------------------------------------------------------
238
	sub	ebx,esi	; newPy
374
align	4
239
	mov	edi,eax	; newPx / ffff
-
 
240
	mov	esi,ebx	; newPy / ffff
-
 
241
	sar	edi,16
-
 
242
	sar	esi,16
-
 
243
	mov	ecx,esi
-
 
244
	sal	ecx,5
-
 
245
	lea	ecx,[grid+ecx+edi]
-
 
246
	cmp	[ecx],byte 0
-
 
247
	jne	cannotwalk1
375
prepare_1:
248
	mov	[vpx],eax
376
	mov	eax,[vpx]
249
	mov	[vpy],ebx
377
	mov	ebx,[vpy]
250
	mov	[mouseya],dword 1
378
	mov	ecx,[vheading]
251
;--------------------------------------
379
	mov	edx,ecx
252
cannotwalk1:
-
 
253
	jmp	check_refresh
-
 
254
;---------------------------------------------------------------------
380
	mov	edi,[sinus+ecx*4]
255
align	4
-
 
256
s_left:	; turn	left	(key)
-
 
257
	mov	edi,[vheading]	; heading
-
 
258
	add	edi,50
381
	lea	edx,[sinus+3600+edx*4]
259
	cmp	edi,3600
-
 
260
	jb	ok_heading0
382
	cmp	edx,eosinus	; cosinus taken from (sinus plus 900) mod 3600
261
 
383
	jb	@f
262
	sub	edi,3600
384
 
263
;--------------------------------------
-
 
264
ok_heading0:
-
 
265
	mov	[vheading],edi
-
 
266
	mov	[mouseya],dword 1
-
 
267
	jmp	check_refresh
-
 
268
;---------------------------------------------------------------------
-
 
269
align	4
-
 
270
s_right:	; turn	right
-
 
271
	mov	edi,[vheading]
-
 
272
	sub	edi,50
-
 
273
	cmp	edi,-1
-
 
274
	jg	ok_heading1
-
 
275
 
-
 
276
	add	edi,3600
-
 
277
;--------------------------------------	
-
 
278
ok_heading1:
-
 
279
	mov	[vheading],edi
-
 
280
	mov	[mouseya],dword 1
-
 
281
	jmp	check_refresh
-
 
282
;---------------------------------------------------------------------
-
 
283
align	4
-
 
284
m_left:	; turn	left	(mouse)
-
 
285
	mov	edi,[vheading]	; heading
-
 
286
	mov	ecx,315
-
 
287
	sub	ecx,eax
-
 
288
	sar	ecx,2
-
 
289
	add	edi,ecx
-
 
290
	cmp	edi,3600
-
 
291
	jb	ok_heading2
-
 
292
 
-
 
293
	sub	edi,3600
-
 
294
;--------------------------------------	
-
 
295
ok_heading2:
-
 
296
	mov	[vheading],edi
385
	sub	edx,14400
297
	mov	[mouseya],dword 1
386
;--------------------------------------
298
	jmp	continue	; allow both: walk and rotate
387
@@:
299
;---------------------------------------------------------------------
388
	mov	esi,[edx]
300
align	4
389
	ret
301
m_right:	; turn right
390
;---------------------------------------------------------------------
302
	mov	edi,[vheading]
391
align	4
303
	sub	eax,325
392
s_left:		; turn	left	(key)
304
	sar	eax,2
393
	mov	edi,[vheading]
Line 499... Line 588...
499
;	jmp	nodark0	; use this to deactivate darkening floor (a bit faster)
588
;	jmp	nodark0	; use this to deactivate darkening floor (a bit faster)
Line 500... Line 589...
500
 
589
 
501
	cmp	eax,80
590
	cmp	eax,80
502
	jg	nodark0
591
	jg	nodark0
503
; split	rgb
592
; split	rgb
504
	mov	[blue],edx
593
	mov	[blue_color],edx
Line 505... Line 594...
505
	and	[blue],dword 255
594
	and	[blue_color],dword 255
506
 
595
 
507
	shr	edx,8
596
	shr	edx,8
Line 508... Line 597...
508
	mov	[green],edx
597
	mov	[green_color],edx
509
	and	[green],dword 255
598
	and	[green_color],dword 255
510
 
599
 
Line 511... Line 600...
511
	shr	edx,8
600
	shr	edx,8
512
	mov	[red],edx
601
	mov	[red_color],edx
513
	and	[red],dword 255
602
	and	[red_color],dword 255
514
 
603
 
515
	mov	eax,81	; darkness parameter
604
	mov	eax,81	; darkness parameter
516
	sub	eax,[vdd]
605
	sub	eax,[vdd]
517
	sal	eax,1
606
	sal	eax,1
Line 518... Line 607...
518
; reduce rgb
607
; reduce rgb
519
	sub	[red],eax
608
	sub	[red_color],eax
520
	cmp	[red],dword 0
609
	cmp	[red_color],dword 0
521
	jg	notblack10
610
	jg	notblack10
522
 
611
 
523
	mov	[red],dword 0
612
	mov	[red_color],dword 0
Line 524... Line 613...
524
;--------------------------------------
613
;--------------------------------------
525
notblack10:
614
notblack10:
526
	sub	[green],eax
615
	sub	[green_color],eax
527
	cmp	[green],dword 0
616
	cmp	[green_color],dword 0
528
	jg	notblack20
617
	jg	notblack20
529
 
618
 
530
	mov	[green],dword 0
619
	mov	[green_color],dword 0
Line 531... Line 620...
531
;--------------------------------------
620
;--------------------------------------
532
notblack20:
621
notblack20:
533
	mov	edx,[blue]
622
	mov	edx,[blue_color]
534
	sub	[blue],eax
623
	sub	[blue_color],eax
535
	cmp	[blue],dword 0
624
	cmp	[blue_color],dword 0
536
	jg	notblack30
625
	jg	notblack30
537
 
626
 
538
	mov	[blue],dword 0
627
	mov	[blue_color],dword 0
539
;--------------------------------------
628
;--------------------------------------
540
notblack30:
629
notblack30:
541
	shl	dword [red],16	; reassemble rgb
630
	shl	dword [red_color],16	; reassemble rgb
542
	shl	dword [green],8
631
	shl	dword [green_color],8
Line 885... Line 974...
885
; color must be in edx, wall height in [vdd]
974
; color must be in edx, wall height in [vdd]
886
	mov	eax,[vdd]
975
	mov	eax,[vdd]
887
	cmp	eax,50
976
	cmp	eax,50
888
	jg	nodark
977
	jg	nodark
889
; split rgb
978
; split rgb
890
	mov	[blue],edx
979
	mov	[blue_color],edx
891
	and	[blue],dword 255
980
	and	[blue_color],dword 255
Line 892... Line 981...
892
 
981
 
893
	shr	edx,8
982
	shr	edx,8
894
	mov	[green],edx
983
	mov	[green_color],edx
Line 895... Line 984...
895
	and	[green],dword 255
984
	and	[green_color],dword 255
896
 
985
 
897
	shr	edx,8
986
	shr	edx,8
Line 898... Line 987...
898
	mov	[red],edx
987
	mov	[red_color],edx
899
	and	[red],dword 255
988
	and	[red_color],dword 255
900
 
989
 
901
	mov	eax,51	; darkness parameter
990
	mov	eax,51	; darkness parameter
Line 906... Line 995...
906
	sal	eax,2
995
	sal	eax,2
907
;--------------------------------------
996
;--------------------------------------
908
align	4
997
align	4
909
isdarkside:
998
isdarkside:
910
; reduce rgb
999
; reduce rgb
911
	sub	[red],eax
1000
	sub	[red_color],eax
912
	cmp	[red],	dword 0
1001
	cmp	[red_color],dword 0
913
	jg	notblack10b
1002
	jg	notblack10b
Line 914... Line 1003...
914
 
1003
 
915
	mov	[red],dword 0
1004
	mov	[red_color],dword 0
916
;--------------------------------------
1005
;--------------------------------------
917
align	4
1006
align	4
918
notblack10b:
1007
notblack10b:
919
	sub	[green],eax
1008
	sub	[green_color],eax
920
	cmp	[green],dword 0
1009
	cmp	[green_color],dword 0
Line 921... Line 1010...
921
	jg	notblack20b
1010
	jg	notblack20b
922
 
1011
 
923
	mov	[green],dword 0
1012
	mov	[green_color],dword 0
924
;--------------------------------------
1013
;--------------------------------------
925
align	4
1014
align	4
926
notblack20b:
1015
notblack20b:
927
	mov	edx,[blue]
1016
	mov	edx,[blue_color]
928
	sub	[blue],eax
1017
	sub	[blue_color],eax
Line 929... Line 1018...
929
	cmp	[blue],dword 0
1018
	cmp	[blue_color],dword 0
930
	jg	notblack30b
1019
	jg	notblack30b
931
 
1020
 
932
	mov	[blue],dword 0
1021
	mov	[blue_color],dword 0
933
;--------------------------------------	
1022
;--------------------------------------	
934
align	4
1023
align	4
935
notblack30b:
1024
notblack30b:
936
	shl	dword [red],16	; reassemble rgb
1025
	shl	dword [red_color],16	; reassemble rgb
937
	shl	dword [green],8
1026
	shl	dword [green_color],8
938
	mov	edx,[red]
1027
	mov	edx,[red_color]
939
	or	edx,[green]
1028
	or	edx,[green_color]
940
	or	edx,[blue]
1029
	or	edx,[blue_color]
941
	mov	eax,edx
1030
	mov	eax,edx
942
;--------------------------------------
1031
;--------------------------------------
Line 1117... Line 1206...
1117
vpx:
1206
vpx:
1118
	dd 0x0001FFFF	; initial player position * 0xFFFF
1207
	dd 0x0001FFFF	; initial player position * 0xFFFF
1119
vpy:
1208
vpy:
1120
	dd 0x0001FFFF
1209
	dd 0x0001FFFF
Line 1121... Line 1210...
1121
 
1210
 
Line 1122... Line 1211...
1122
title	db 'Free3D v0.5 - fisheye raycasting engine etc.',0
1211
title	db 'Free3D v0.6 - fisheye raycasting engine etc.',0
1123
 
1212
 
1124
sindegree	dd 0.0
1213
sindegree	dd 0.0
1125
sininc		dd 0.0017453292519943295769236907684886
1214
sininc		dd 0.0017453292519943295769236907684886
1126
sindiv		dd 6553.5
1215
sindiv		dd 6553.5
-
 
1216
;textures:
-
 
1217
;file 'texture.gif'
-
 
1218
current_key_code	db 0
1127
;textures:
1219
old_key_code		db 0
1128
;file 'texture.gif'
1220
extended_key		db 0
1129
;---------------------------------------------------------------------
1221
;---------------------------------------------------------------------
1130
align	4
1222
align	4
1131
fileinfo:
1223
fileinfo:
Line 1240... Line 1332...
1240
wall4	rd 1
1332
wall4	rd 1
1241
wall5	rd 1
1333
wall5	rd 1
1242
wall6	rd 1
1334
wall6	rd 1
1243
wall7	rd 1
1335
wall7	rd 1
1244
;screen_buffer	rd 1
1336
;screen_buffer	rd 1
-
 
1337
active_process	rd 1
-
 
1338
 
-
 
1339
;mouse_position		rd 1
-
 
1340
mouse_position_old	rd 1
1245
;---------------------------------------------------------------------
1341
;---------------------------------------------------------------------
1246
align	4
1342
align	4
1247
col1:
1343
col1:
1248
	dd ?	;-
1344
	dd ?	;-
1249
; misc raycaster vars:
1345
; misc raycaster vars:
Line 1298... Line 1394...
1298
	dd ?	;-
1394
	dd ?	;-
1299
h_old:
1395
h_old:
1300
	dd ?	;-
1396
	dd ?	;-
1301
vbottom:
1397
vbottom:
1302
	dd ?	;-
1398
	dd ?	;-
1303
mouseya:
1399
;mouseya:
1304
	dd ?	;-
1400
;	dd ?	;-
1305
remeax:
1401
remeax:
1306
	dd ?	;-
1402
	dd ?	;-
1307
remebx:
1403
remebx:
1308
	dd ?	;-
1404
	dd ?	;-
1309
remecx:
1405
remecx:
Line 1312... Line 1408...
1312
	dd ?	;-
1408
	dd ?	;-
1313
remedi:
1409
remedi:
1314
	dd ?	;-
1410
	dd ?	;-
1315
remesi:
1411
remesi:
1316
	dd ?	;-
1412
	dd ?	;-
1317
red:
1413
red_color:
1318
	dd ?	;-
1414
	dd ?	;-
1319
green:
1415
green_color:
1320
	dd ?	;-
1416
	dd ?	;-
1321
blue:
1417
blue_color:
1322
	dd ?	;-
1418
	dd ?	;-
1323
pseudo:
1419
pseudo:
1324
	dd ?	;-
1420
	dd ?	;-
1325
step1:
1421
step1:
1326
	dd ?	;-
1422
	dd ?	;-
Line 1335... Line 1431...
1335
sinus	rd 360*10
1431
sinus	rd 360*10
1336
eosinus:
1432
eosinus:
1337
;	rd 16*1024*4
1433
;	rd 16*1024*4
1338
;---------------------------------------------------------------------
1434
;---------------------------------------------------------------------
1339
align	4
1435
align	4
1340
	rb 1024
1436
	rb 4096
1341
stacktop:
1437
stacktop:
1342
;---------------------------------------------------------------------
1438
;---------------------------------------------------------------------
-
 
1439
procinfo:
-
 
1440
	rb 1024
-
 
1441
;---------------------------------------------------------------------
1343
path:
1442
path:
1344
	rb 4096
1443
	rb 4096
1345
;---------------------------------------------------------------------
1444
;---------------------------------------------------------------------
1346
file_name:
1445
file_name:
1347
	rb 4096
1446
	rb 4096