Skip to content

Commit b2c6d63

Browse files
committed
Add command-line toggles.
1 parent 9d67af9 commit b2c6d63

File tree

5 files changed

+137
-75
lines changed

5 files changed

+137
-75
lines changed

.clang-tidy

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ Checks: >
33
-altera-id-dependent-backward-branch,
44
-altera-struct-pack-align,
55
-altera-unroll-loops,
6-
-bugprone-narrowing-conversions,
7-
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
6+
-concurrency-mt-unsafe,
87
-cppcoreguidelines-avoid-magic-numbers,
98
-cppcoreguidelines-avoid-non-const-global-variables,
109
-cppcoreguidelines-init-variables,
11-
-cppcoreguidelines-narrowing-conversions,
1210
-google-readability-braces-around-statements,
1311
-hicpp-braces-around-statements,
1412
-hicpp-signed-bitwise,
15-
-hicpp-uppercase-literal-suffix,
1613
-llvmlibc-restrict-system-libc-headers,
1714
-readability-braces-around-statements,
1815
-readability-function-cognitive-complexity,
1916
-readability-identifier-length,
2017
-readability-isolate-declaration,
2118
-readability-magic-numbers,
22-
-readability-uppercase-literal-suffix
19+
-readability-math-missing-parentheses

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,29 @@ telnet doom.w-graj.net 666
1717
Binaries for Windows and Linux are provided as [github releases](https://github.com/wojciech-graj/doom-ascii/releases).
1818

1919
### Linux / Mac
20-
Requires Make and a C compiler. Creates ```doom_ascii/doom_ascii```
20+
Requires Make and a C compiler. Creates `doom_ascii/doom_ascii`
2121
```
2222
cd src
2323
make
2424
```
2525

2626
### Windows
27-
Compile on linux. Creates ```doom_ascii/doom_ascii.exe```
27+
Compile on linux. Creates `doom_ascii/doom_ascii.exe`
2828
```
2929
cd src
3030
make windows-cross
3131
```
3232

33+
## Settings
34+
35+
The following command-line arguments can be supplied:
36+
- `-nocolor`: Disable color.
37+
- `-nograd`: Disable text gradients, exclusively use # or █.
38+
- `-nobold`: Disable bold text.
39+
- `-unicode`: Use [unicode block elements](https://en.wikipedia.org/wiki/Block_Elements) instead of ASCII characters.
40+
- `-erase`: Erase previous frame instead of overwriting. May cause a strobe effect.
41+
- `-scaling <n>`: Set resolution. Smaller numbers denote a larger display. A scale of 4 is used by default, and should work flawlessly on all terminals. Most terminals (excluding Windows CMD) should manage with scales up to and including 2.
42+
3343
## Controls
3444
Default keybindings are listed below.
3545

@@ -46,15 +56,13 @@ Default keybindings are listed below.
4656
|SPEED |] |
4757
|WEAPON SELECT |1-7 |
4858

49-
Keybinds can be remapped in ```.default.cfg```, which should be placed in the same directory as the game executable.
59+
Keybinds can be remapped in `.default.cfg`, which should be placed in the same directory as the game executable.
5060

5161
## Performance tips
5262
### Display
5363
Most terminals aren't designed for massive throughput, so the game cannot be played at full 320x200 resolution at high frames per second.
5464

55-
Pass the command-line argument ```-scaling n``` to determine the level of scaling. Smaller numbers denote a larger display.
56-
57-
A scale of 4 is used by default, and should work flawlessly on all terminals. Most terminals (excluding Windows CMD) should manage with scales up to and including 2.
65+
Pass the command-line argument `-scaling` to determine the level of scaling (See [Settings](#settings)).
5866

5967
### Input
6068
For a better playing experience, increase the keyboard repeat rate, and reduce the keyboard repeat delay.

src/doomgeneric.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright(C) 2022 Wojciech Graj
2+
// Copyright(C) 2022-2025 Wojciech Graj
33
//
44
// This program is free software; you can redistribute it and/or
55
// modify it under the terms of the GNU General Public License
@@ -16,26 +16,28 @@
1616
//
1717

1818
#include "doomgeneric.h"
19-
#include "m_argv.h"
19+
2020
#include "i_video.h"
21+
#include "m_argv.h"
22+
23+
#include <stdlib.h>
2124

2225
unsigned DOOMGENERIC_RESX = 80;
2326
unsigned DOOMGENERIC_RESY = 50;
2427

25-
uint32_t* DG_ScreenBuffer = 0;
26-
28+
uint32_t *DG_ScreenBuffer = 0;
2729

2830
void dg_Create()
2931
{
3032
int i;
3133
i = M_CheckParmWithArgs("-scaling", 1);
32-
if (i > 0) {
34+
if (i > 0) {
3335
i = atoi(myargv[i + 1]);
3436
DOOMGENERIC_RESX = SCREENWIDTH / i;
3537
DOOMGENERIC_RESY = SCREENHEIGHT / i;
3638
}
3739

38-
DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
40+
DG_ScreenBuffer = malloc((unsigned long)DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
3941

4042
DG_Init();
4143
}

src/doomgeneric.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
#ifndef DOOM_GENERIC
22
#define DOOM_GENERIC
33

4-
#include <stdlib.h>
54
#include <stdint.h>
65

76
extern unsigned DOOMGENERIC_RESX;
87
extern unsigned DOOMGENERIC_RESY;
98

9+
extern uint32_t *DG_ScreenBuffer;
1010

11-
extern uint32_t* DG_ScreenBuffer;
12-
13-
14-
void DG_Init();
15-
void DG_DrawFrame();
11+
void DG_Init(void);
12+
void DG_DrawFrame(void);
1613
void DG_SleepMs(uint32_t ms);
17-
uint32_t DG_GetTicksMs();
18-
int DG_GetKey(int* pressed, unsigned char* key);
19-
void DG_SetWindowTitle(const char * title);
14+
uint32_t DG_GetTicksMs(void);
15+
int DG_GetKey(int *pressed, unsigned char *key);
16+
void DG_SetWindowTitle(const char *title);
2017
void DG_ReadInput(void);
2118

2219
#endif //DOOM_GENERIC

0 commit comments

Comments
 (0)