-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathd_net.c
145 lines (115 loc) · 2.23 KB
/
d_net.c
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include "m_menu.h"
#include "p_local.h"
#include "i_system.h"
#include "i_video.h"
#include "g_game.h"
#include "doomdef.h"
#include "doomstat.h"
#include "st_stuff.h"
#include "w_wad.h"
#include "r_local.h"
#include "v_video.h"
#include "m_menu.h"
#include "hu_stuff.h"
#include "m_swap.h"
// [kg] new gameplay stuff
int sv_freeaim;
int sv_itemrespawn; // in ticks
int sv_weaponrespawn; // in ticks
int sw_powerrespawn; // in ticks
int sv_superrespawn; // in ticks
int playercount;
int net_mobjid;
static patch_t *background;
char network_message[512];
extern patch_t* hu_font[HU_FONTSIZE];
//
// NETWORKING
//
void D_ProcessEvents (void);
void G_BuildTiccmd (ticcmd_t *cmd);
void D_DoAdvanceDemo (void);
//
// NetUpdate
//
int gametime;
void NetUpdate (void)
{
}
#ifndef SERVER
//
// [kg] network screen
void D_StartNet()
{
int lump = W_CheckNumForName("INTERPIC");
if(lump < 0)
lump = W_CheckNumForName("WIMAP0");
gamestate = GS_NETWORK;
background = (patch_t*)W_CacheLumpNum(lump);
V_DrawPatch(0, 0, 0, background);
gametime = I_GetTime();
}
void D_NetDrawer()
{
int i;
int start, x, y;
char *msg = network_message;
char *ptr = network_message;
if(!netgame)
return;
if(gamestate == GS_NETWORK || netgame < 3)
V_DrawPatch(0, 0, 0, background);
// message
if(*msg && !menuactive)
{
y = 100 - M_StringHeight(network_message)/2;
while(1)
{
if(*msg == '\n' || !*msg)
{
char old = *msg;
*msg = 0;
x = 160 - M_StringWidth(ptr) / 2;
M_WriteText(x, y, ptr);
y += SHORT(hu_font[0]->height) + 1;
*msg = old;
ptr = msg + 1;
}
if(!*msg)
break;
msg++;
}
}
}
#endif
//
// TryRunTics
//
extern boolean advancedemo;
void TryRunTics (void)
{
int newtics;
int nowtime;
// check time
nowtime = I_GetTime();
// normal speed
newtics = nowtime - gametime;
gametime = nowtime;
// run the count ticks
for(nowtime = 0; nowtime < newtics; nowtime++)
{
#ifndef SERVER
if(!netgame && (in_weapon_menu || players[consoleplayer].cheats & CF_SLOWMO) && (gametime+nowtime) & 1)
// half speed
continue;
I_StartTic ();
D_ProcessEvents ();
G_BuildTiccmd(&players[consoleplayer].cmd);
if (advancedemo)
D_DoAdvanceDemo ();
M_Ticker ();
#endif
G_Ticker ();
gametic++;
}
}