Skip to content

Commit 0cefc14

Browse files
committed
zephyrdoom, src: Clean implementation sources
IMPORTANT: The commit does not change functionality of the code! The commit contains the following changes: - Clean up of redundant/deprecated comments; - Clean up of redundant whitespaces and new lines; - Fix of spacing within lines; - Unify C comments to C89 and C98 code structure (/**/ instead of //); - Fix too long lines; - Unify comments among files; - Unify TODO sections within the code; - Remove deprecated sections of code; - Fix combining and dividing of conditions and loops; - Fix typos; - Fix various definitions of functions; Additionally, the source code structure has been unified using default auto formatter of C code which is up to date with recent standards. In Visual Studio code if not enabled by default, the key combination is Shift + Alt + F Some exceptions have been applied for better readability due to Doxygen, Chocolate Doom custom parser documentation and various directives available in the code.
1 parent c31c5bd commit 0cefc14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+15046
-15886
lines changed

zephyrdoom/src/FT810.h

Lines changed: 342 additions & 327 deletions
Large diffs are not rendered by default.

zephyrdoom/src/bluetooth_control.c

Lines changed: 310 additions & 147 deletions
Large diffs are not rendered by default.

zephyrdoom/src/bluetooth_control.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
int bluetooth_control_init(void);
55

6-
#endif
6+
#endif /* BLUETOOTH_CONTROL_H__ */

zephyrdoom/src/d_dedicated.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
//
2-
// Copyright(C) 2005-2014 Simon Howard
3-
//
4-
// This program is free software; you can redistribute it and/or
5-
// modify it under the terms of the GNU General Public License
6-
// as published by the Free Software Foundation; either version 2
7-
// of the License, or (at your option) any later version.
8-
//
9-
// This program is distributed in the hope that it will be useful,
10-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
// GNU General Public License for more details.
13-
//
14-
// Code specific to the standalone dedicated server.
15-
//
1+
/*
2+
* Copyright(C) 2005-2014 Simon Howard
3+
*
4+
* This program is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation; either version 2
7+
* of the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* DESCRIPTION:
15+
* Code specific to the standalone dedicated server.
16+
*/
1617

1718
#include <stdio.h>
1819
#include <stdlib.h>
@@ -29,11 +30,12 @@
2930

3031
void NET_CL_Run(void)
3132
{
32-
// No client present :-)
33-
//
34-
// This is here because the server code sometimes runs this
35-
// to let the client do some processing if it needs to.
36-
// In a standalone dedicated server, we don't have a client.
33+
/*
34+
* No client present.
35+
* This is here because the server code sometimes runs this
36+
* to let the client do some processing if it needs to.
37+
* In a standalone dedicated server, we don't have a client.
38+
*/
3739
}
3840

3941
void D_DoomMain(void)

zephyrdoom/src/d_event.c

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
//
2-
// Copyright(C) 1993-1996 Id Software, Inc.
3-
// Copyright(C) 2005-2014 Simon Howard
4-
//
5-
// This program is free software; you can redistribute it and/or
6-
// modify it under the terms of the GNU General Public License
7-
// as published by the Free Software Foundation; either version 2
8-
// of the License, or (at your option) any later version.
9-
//
10-
// This program is distributed in the hope that it will be useful,
11-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
// GNU General Public License for more details.
14-
//
15-
//
16-
// DESCRIPTION: Event handling.
17-
//
18-
// Events are asynchronous inputs generally generated by the game user.
19-
// Events can be discarded if no responder claims them
20-
//
1+
/*
2+
* Copyright(C) 1993-1996 Id Software, Inc.
3+
* Copyright(C) 2005-2014 Simon Howard
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 2
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* DESCRIPTION:
16+
* Event handling.
17+
* Events are asynchronous inputs generally generated by the game user.
18+
* Events can be discarded if no responder claims them.
19+
*/
2120

2221
#include <stdlib.h>
2322
#include "d_event.h"
@@ -28,33 +27,27 @@ static event_t events[MAXEVENTS];
2827
static int eventhead;
2928
static int eventtail;
3029

31-
//
32-
// D_PostEvent
33-
// Called by the I/O functions when input is detected
34-
//
35-
void D_PostEvent (event_t* ev)
30+
/* Called by the I/O functions when input is detected. */
31+
void D_PostEvent(event_t *ev)
3632
{
3733
events[eventhead] = *ev;
3834
eventhead = (eventhead + 1) % MAXEVENTS;
3935
}
4036

41-
// Read an event from the queue.
42-
37+
/* Read an event from the queue. */
4338
event_t *D_PopEvent(void)
4439
{
4540
event_t *result;
4641

47-
// No more events waiting.
48-
42+
/* No more events waiting */
4943
if (eventtail == eventhead)
5044
{
5145
return NULL;
5246
}
5347

5448
result = &events[eventtail];
5549

56-
// Advance to the next event in the queue.
57-
50+
/* Advance to the next event in the queue */
5851
eventtail = (eventtail + 1) % MAXEVENTS;
5952

6053
return result;

zephyrdoom/src/d_event.h

Lines changed: 107 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,143 @@
1-
//
2-
// Copyright(C) 1993-1996 Id Software, Inc.
3-
// Copyright(C) 2005-2014 Simon Howard
4-
//
5-
// This program is free software; you can redistribute it and/or
6-
// modify it under the terms of the GNU General Public License
7-
// as published by the Free Software Foundation; either version 2
8-
// of the License, or (at your option) any later version.
9-
//
10-
// This program is distributed in the hope that it will be useful,
11-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
// GNU General Public License for more details.
14-
//
15-
// DESCRIPTION:
16-
//
17-
//
18-
1+
/*
2+
* Copyright(C) 1993-1996 Id Software, Inc.
3+
* Copyright(C) 2005-2014 Simon Howard
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 2
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* DESCRIPTION:
16+
* Event handling.
17+
*/
1918

2019
#ifndef __D_EVENT__
2120
#define __D_EVENT__
2221

23-
2422
#include "doomtype.h"
2523

26-
27-
//
28-
// Event handling.
29-
//
30-
31-
// Input event types.
24+
/* Input event types. */
3225
typedef enum
3326
{
34-
// Key press/release events.
35-
// data1: Key code (from doomkeys.h) of the key that was
36-
// pressed or released. This is the key as it appears
37-
// on a US keyboard layout, and does not change with
38-
// layout.
39-
// For ev_keydown only:
40-
// data2: ASCII representation of the key that was pressed that
41-
// changes with the keyboard layout; eg. if 'Z' is
42-
// pressed on a German keyboard, data1='y',data2='z'.
43-
// Not affected by modifier keys.
44-
// data3: ASCII input, fully modified according to keyboard
45-
// layout and any modifier keys that are held down.
46-
// Only set if I_StartTextInput() has been called.
27+
/*
28+
* Key press/release events:
29+
* data1 - Key code (from doomkeys.h) of the key that was
30+
* pressed or released. This is the key as it appears
31+
* on a US keyboard layout, and does not change with
32+
* layout.
33+
*
34+
* For ev_keydown only:
35+
* data2 - ASCII representation of the key that was pressed that
36+
* changes with the keyboard layout; e.g. if 'Z' is
37+
* pressed on a German keyboard, data1='y',data2='z'.
38+
* Not affected by modifier keys.
39+
* data3 - ASCII input, fully modified according to keyboard
40+
* layout and any modifier keys that are held down.
41+
* Only set if I_StartTextInput() has been called.
42+
*/
4743
ev_keydown,
4844
ev_keyup,
4945

50-
// Mouse movement event.
51-
// data1: Bitfield of buttons currently held down.
52-
// (bit 0 = left; bit 1 = right; bit 2 = middle).
53-
// data2: X axis mouse movement (turn).
54-
// data3: Y axis mouse movement (forward/backward).
46+
/*
47+
* Mouse movement event:
48+
* data1 - Bitfield of buttons currently held down
49+
* (bit 0 = left; bit 1 = right; bit 2 = middle).
50+
* data2 - X axis mouse movement (turn).
51+
* data3 - Y axis mouse movement (forward/backward).
52+
*/
5553
ev_mouse,
5654

57-
// Joystick state.
58-
// data1: Bitfield of buttons currently pressed.
59-
// data2: X axis mouse movement (turn).
60-
// data3: Y axis mouse movement (forward/backward).
61-
// data4: Third axis mouse movement (strafe).
62-
// data5: Fourth axis mouse movement (look)
55+
/*
56+
* Joystick state:
57+
* data1 - Bitfield of buttons currently pressed.
58+
* data2 - X axis mouse movement (turn).
59+
* data3 - Y axis mouse movement (forward/backward).
60+
* data4 - Third axis mouse movement (strafe).
61+
* data5 - Fourth axis mouse movement (look)
62+
*/
6363
ev_joystick,
6464

65-
// Quit event. Triggered when the user clicks the "close" button
66-
// to terminate the application.
65+
/*
66+
* Quit event. Triggered when the user clicks the "close" button
67+
* to terminate the application.
68+
*/
6769
ev_quit
6870
} evtype_t;
6971

70-
// Event structure.
72+
/* Event structure. */
7173
typedef struct __attribute__((packed))
7274
{
7375
evtype_t type;
7476

75-
// Event-specific data; see the descriptions given above.
76-
// NRFD-NOTE: Changed from int to short
77+
/*
78+
* Event-specific data; see the descriptions given above.
79+
* NRFD-NOTE: Changed from int to short.
80+
*/
7781
short data1, data2, data3, data4, data5;
7882
} event_t;
7983

80-
81-
//
82-
// Button/action code definitions.
83-
//
84+
/* Button/action code definitions. */
8485
typedef enum
8586
{
86-
// Press "Fire".
87-
BT_ATTACK = 1,
88-
// Use button, to open doors, activate switches.
89-
BT_USE = 2,
90-
91-
// Flag: game events, not really buttons.
92-
BT_SPECIAL = 128,
93-
BT_SPECIALMASK = 3,
94-
95-
// Flag, weapon change pending.
96-
// If true, the next 3 bits hold weapon num.
97-
BT_CHANGE = 4,
98-
// The 3bit weapon mask and shift, convenience.
99-
BT_WEAPONMASK = (8+16+32),
100-
BT_WEAPONSHIFT = 3,
101-
102-
// Pause the game.
103-
BTS_PAUSE = 1,
104-
// Save the game at each console.
105-
BTS_SAVEGAME = 2,
106-
107-
// Savegame slot numbers
108-
// occupy the second byte of buttons.
109-
BTS_SAVEMASK = (4+8+16),
110-
BTS_SAVESHIFT = 2,
111-
87+
/* Press "Fire" */
88+
BT_ATTACK = 1,
89+
/* Use button, to open doors, activate switches */
90+
BT_USE = 2,
91+
92+
/* Flag game events, not really buttons */
93+
BT_SPECIAL = 128,
94+
BT_SPECIALMASK = 3,
95+
96+
/*
97+
* Flag, weapon change pending.
98+
* If true, the next 3 bits hold weapon num.
99+
*/
100+
BT_CHANGE = 4,
101+
/* The 3bit weapon mask and shift, convenience */
102+
BT_WEAPONMASK = (8 + 16 + 32),
103+
BT_WEAPONSHIFT = 3,
104+
105+
/* Pause the game */
106+
BTS_PAUSE = 1,
107+
/* Save the game at each console */
108+
BTS_SAVEGAME = 2,
109+
110+
/* Savegame slot numbers occupy the second byte of buttons */
111+
BTS_SAVEMASK = (4 + 8 + 16),
112+
BTS_SAVESHIFT = 2
112113
} buttoncode_t;
113114

114-
// villsa [STRIFE] Strife specific buttons
115-
// TODO - not finished
115+
/*
116+
* villsa [STRIFE] Strife specific buttons
117+
* TODO - not finished
118+
*/
116119
typedef enum
117120
{
118-
// Player view look up
119-
BT2_LOOKUP = 1,
120-
// Player view look down
121-
BT2_LOOKDOWN = 2,
122-
// Center player's view
123-
BT2_CENTERVIEW = 4,
124-
// Use inventory item
125-
BT2_INVUSE = 8,
126-
// Drop inventory item
127-
BT2_INVDROP = 16,
128-
// Jump up and down
129-
BT2_JUMP = 32,
130-
// Use medkit
131-
BT2_HEALTH = 128,
132-
121+
/* Player view look up */
122+
BT2_LOOKUP = 1,
123+
/* Player view look down */
124+
BT2_LOOKDOWN = 2,
125+
/* Center player's view */
126+
BT2_CENTERVIEW = 4,
127+
/* Use inventory item */
128+
BT2_INVUSE = 8,
129+
/* Drop inventory item */
130+
BT2_INVDROP = 16,
131+
/* Jump up and down */
132+
BT2_JUMP = 32,
133+
/* Use medkit */
134+
BT2_HEALTH = 128
133135
} buttoncode2_t;
134136

137+
/* Called by IO functions when input is detected. */
138+
void D_PostEvent(event_t *ev);
135139

136-
137-
138-
// Called by IO functions when input is detected.
139-
void D_PostEvent (event_t *ev);
140-
141-
// Read an event from the event queue
142-
140+
/* Read an event from the event queue. */
143141
event_t *D_PopEvent(void);
144142

145-
146-
#endif
143+
#endif /* __D_EVENT__ */

0 commit comments

Comments
 (0)