-
Notifications
You must be signed in to change notification settings - Fork 31
/
p_tick.v
104 lines (85 loc) · 1.87 KB
/
p_tick.v
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
[translated]
module main
[typedef]
struct C.FILE {}
// vstart
[c: 'Z_Malloc']
fn z_malloc(size int, tag int, ptr voidptr) voidptr
[c: 'Z_Free']
fn z_free(ptr voidptr)
const ( // empty enum
)
[c: 'P_InitThinkers']
fn p_initthinkers()
[c: 'P_AddThinker']
fn p_addthinker(thinker &Thinker_t)
[c: 'P_RemoveThinker']
fn p_removethinker(thinker &Thinker_t)
[c: 'P_PlayerThink']
fn p_playerthink(player &Player_t)
[c: 'P_RespawnSpecials']
fn p_respawnspecials()
[c: 'P_UpdateSpecials']
fn p_updatespecials()
[weak]
__global (
menuactive bool
)
[c: 'P_InitThinkers']
fn p_initthinkers() {
thinkercap.prev = &thinkercap
thinkercap.next = &thinkercap
}
[c: 'P_AddThinker']
fn p_addthinker(thinker &Thinker_t) {
thinkercap.prev.next = thinker
thinker.next = &thinkercap
thinker.prev = thinkercap.prev
thinkercap.prev = thinker
}
[c: 'P_RemoveThinker']
fn p_removethinker(thinker &Thinker_t) {
thinker.function.acv = Actionf_v((-1))
}
[c: 'P_AllocateThinker']
fn p_allocatethinker(thinker &Thinker_t) {
}
[c: 'P_RunThinkers']
fn p_runthinkers() {
currentthinker := &Thinker_t(0)
nextthinker := &Thinker_t(0)
currentthinker = thinkercap.next
for currentthinker != &thinkercap {
if currentthinker.function.acv == Actionf_v((-1)) {
nextthinker = currentthinker.next
currentthinker.next.prev = currentthinker.prev
currentthinker.prev.next = currentthinker.next
z_free(currentthinker)
} else {
if currentthinker.function.acp1 {
currentthinker.function.acp1(currentthinker)
}
nextthinker = currentthinker.next
}
currentthinker = nextthinker
}
}
[c: 'P_Ticker']
fn p_ticker() {
i := 0
if paused {
return
}
if !netgame && menuactive && !demoplayback && players[consoleplayer].viewz != 1 {
return
}
for i = 0; i < 4; i++ {
if playeringame[i] {
p_playerthink(&players[i])
}
}
p_runthinkers()
p_updatespecials()
p_respawnspecials()
leveltime++
}