-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpong.cfg
75 lines (58 loc) · 3.15 KB
/
pong.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
exec blubvm/vmx86.cfg
exec blubvm/vmutil.cfg
// Now... as if a bouncing ball wasn't enough... I just HAD to go
// one step further...
// but this needs one new command I added to the engine: defer <delay in seconds> <command>
// I hope it gets in :P
// Oh and, for the controlls you have to bind some keys to pong_mov1 and pong_mov2
// with an offset as argument
// Have fun --blub
alias pong_init "mov pos_x 5; mov pos_y 5; mov dir_x 1; mov dir_y 0.5"
set pong_p1 " "
set pong_p2 " "
set pong_pos1 3
set pong_pos2 3
set pong_score1 0
set pong_score2 0
alias fecho_add "set ftext \"${ftext}$fnew\n\""
alias fecho "set fnew $*; fecho_add"
alias fclear "set ftext \"\""
fclear
alias fprint "cprint \"$ftext\""
alias pong_check "cmp pong_pos$1 0; jl \"set pong_pos$1 0\"; cmp pong_pos$1 9; jg \"set pong_pos$1 9\""
alias pong_mov1 "add pong_pos1 $1; pong_check 1"
alias pong_mov2 "add pong_pos2 $1; pong_check 2"
alias pong_px "set pong_p1 \" \"; set pong_p2 \" \"; cmp $pong_pos1 $iy; jz \"set pong_p1 \\\"|\\\"\"; cmp $pong_pos2 $iy; jz \"set pong_p2 \\\"|\\\"\""
alias pong_prpong "set pong_pr \"${pong_pr}O\""
alias pong_prspace "set pong_pr \"${pong_pr} \""
alias pong_prcreate "set pong_pr \"\"; forinc ix 0 $rpos_x pong_prspace; pong_prpong; forinc ix $rpos_x 19 pong_prspace"
alias pong_drawe "fecho +--------------------+"
alias pong_drawc "fecho \"${pong_p1} ${pong_p2}\""
alias pong_drawc0 "pong_px; pong_drawc"
alias pong_drawp "fecho \"${pong_p1}${pong_pr}${pong_p2}\""
alias pong_draw3 "pong_px; pong_prcreate; pong_drawp"
alias pong_draw22 "for iy $iy 10 pong_drawc0"
alias pong_draw2 "for iy 0 $rpos_y pong_drawc0; pong_draw3; inc iy; pong_draw22"
alias pong_draw "fecho \"$pong_score1 : $pong_score2\"; pong_drawe; pong_draw2; pong_drawe"
alias pong_score_1 "inc pong_score1; set pong_wait 2"
alias pong_score_2 "inc pong_score2; set pong_wait 2"
alias pong_bouncexpos "cmp $pong_diff 1; jg pong_score_1; mul dir_x -1"
alias pong_colx_pos "mov pong_diff $rpos_y; sub pong_diff $pong_pos2; abs pong_diff; cmp $pos_x 19; jge pong_bouncexpos"
alias pong_bouncexneg "cmp $pong_diff 1; jg pong_score_2; mul dir_x -1"
alias pong_colx_neg "mov pong_diff $rpos_y; sub pong_diff $pong_pos1; abs pong_diff; cmp $pos_x 0; jle pong_bouncexneg"
alias pong_bouncey "mul dir_y -1"
alias pong_coly_pos "cmp $pos_y 9; jge pong_bouncey"
alias pong_coly_neg "cmp $pos_y 0; jle pong_bouncey"
alias pong_colx_do "$pong_colx"
alias pong_coly_do "$pong_coly"
alias pong_collision_x "cmp $dir_x 0; mov pong_colx pong_colx_pos; cmovl pong_colx pong_colx_neg; pong_colx_do"
alias pong_collision_y "cmp $dir_y 0; mov pong_coly pong_coly_pos; cmovl pong_coly pong_coly_neg; pong_coly_do"
alias pong_collision "pong_collision_x; pong_collision_y"
alias pong_step "add pos_x dir_x; add pos_y dir_y"
alias pong_updatepos "mov rpos_x $pos_x; mov rpos_y $pos_y; floor rpos_x; floor rpos_y"
alias pong_frame "fclear; set pong_wait 0.1; pong_step; pong_updatepos; pong_draw; pong_collision; fprint"
pong_init
set frame 0
set pong_wait 0.1
alias pong_main "pong_frame; cmp frame 300; jl \"defer $pong_wait pong_main\""
// for f 0 44 pong_frame