Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chinese Version #27

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# DungeonRush
![](screenshot.gif)
English | [简体中文](README.zh-CN.md)
>A game inspired by Snake, in pure C with SDL2.
>My piece of work from C assignment. Hope you like it :)

Expand Down Expand Up @@ -98,7 +99,7 @@ $ cmake -B build && cmake --build build
## Known issues
[Game speed too fast with some NVIDIA graphic cards on Linux](https://github.com/Rapiz1/DungeonRush/issues/4)
## License and Credits
DungeonRush has mixed meida with
DungeonRush has mixed media with
various licenses. Unfortunately I failed to track them all. In other word, there are many stuff excluding code that comes with unknown license. You should not reuse any of audio, bitmaps, font in this project. If you insist, use at your own risk.
### Code
GPL
Expand All @@ -114,3 +115,7 @@ GPL
|BOMB By Azureflux|CC BY-NC-SA 4.0|
|Unkown BGM|Unkown|
|The Essential Retro Video Game Sound Effects Collection By Juhani Junkala |CC BY 3.0|
### Font
|Name|License|
|----|-------|
|Unifont|GPLv2|
120 changes: 120 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# DungeonRush
![](screenshot.gif)
[English](README.md) | ��������
> ��̰������������Ϸ����C + SDLͼ�ο⡣
> �����ҵ�C��ҵ��ϣ����ϲ�� :)

*�����Ŀ�����Լ���д������ע�ͱȽ���*
## ����˵��

### v1.0-beta
- �޸�Bug
- ���� ���� / ��������Multiplayer / LAN��ģʽ

**ͨ������������ĺ�������ˣ�ɣ�**
*����Ҫ��ͬһ���������IPֱ������*

### v1.0-alpha

�����

## �淨

### ����ģʽ

ʹ�� WASD ���ƶ���

�ռ�Ӣ����������ľ��ӣ����������ܹ���Ĺ�����ÿ���ؿ�����һ�����ӵ�Ŀ�곤�ȡ��������Ŀ�곤�ȣ����������һ�������¿�ʼ���кܶණ���������ĵȼ����е�������������ֵ���˺�ϵ��������������������ȡ�

### ����ģʽ
ʹ�� WASD �ͼ�ͷ���������������ƶ���

����ģʽ���о���������ֹ���ܹ�������ѵĹ�����

### ����

�����ǻ������������ǿ�����������ͬ�����Ӣ�ۿ���װ����ͬ�����������

*�����������һ���ܿ��~~��ʺ��~~���ӣ������������ʦ�ٻ�����������Χ�Ķ����ˡ�*

### Buff/Debuff

Buff/Debuff����һ��ӵ���������˹���ʱ�������Լ���ijЩ������߶Ե��˵ļ��档

- �������Ա������ˣ����˽��޷��ƶ���
- ʥ�����Ը���һ�����ƣ������˺���ʹ���Debuff���ߡ�
- �󹭿������������е�Ӣ�۵Ĺ����˺���
- ���кܶࡣ

��Ȼ����Щ���������������Ը���ʩ��Debuff�� *���ͱ��緳�˵���Ţ�ֿ��Լ�������ƶ��ٶȣ�*


## ����

[Windows(64λ)](https://github.com/Rapiz1/DungeonRush/releases/download/v1.0-beta/DungeonRush-v1.0-beta-Windows-x86_64.zip)

[Windows(32λ)](https://github.com/Rapiz1/DungeonRush/releases/download/v1.0-beta/DungeonRush-v1.0-beta-Windows-i686.zip)

[Linux](https://github.com/Rapiz1/DungeonRush/releases/download/v1.0-beta/DungeonRush-v1.0-beta-linux.zip)

AppImage for Linux �������� Release ҳ�����ҵ���

*�����Ϸ֧��macOS������û��Mac����������*

��ִ���ļ���`dungeon_rush`

## ������ϵ
����Ŀ������ SDL �⡣
`SDL2, SDL2-image, SDL2-mixer, SDL2-net, SDL2-ttf`
### Arch
```
# pacman -S sdl2 sdl2_image sdl2_mixer sdl2_net sdl2_ttf --needed
```
### Debian

```
# apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
```

### openSUSE

```
# zypper in libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_net-devel libSDL2_ttf-devel
```

### MacOS

```
# brew install sdl2 sdl2_image sdl2_mixer sdl2_net sdl2_ttf
```

### ����ϵͳ

������Ų�ࡣ�����Բ��� SDL �̳������û�����
## Compilation
**��Ӧ��ȷ���ڱ���֮ǰ��װ������������**
```
$ cmake -B build && cmake --build build
```
## ��֪����
[��һЩװ��NVIDIA����Linuxϵͳ�ϣ�����Ϸ�ٶ�̫��](https://github.com/Rapiz1/DungeonRush/issues/4)
## ��Ȩ������
DungeonRush �Ѿ��Ѹ�������֤��ý�������һ�𡣲��ҵ�����û�ҵ����ǡ����仰˵�������಻�����������ڵ�δ֪����֤���㲻���������Ŀ���ظ�ʹ���κ���Ƶ��λͼ�����塣�������ʹ�ã������Ը���
### ����
GPL
### λͼ
|����|��ȨЭ��|
|----|--------|
|���� 0x72 �� DungeonTilesetII_v1.3|CC 0|
|�������� rapiz ��λͼ|CC BY-NC-SA 4.0|
### ��Ƶ
|����|��ȨЭ��|
|----|--------|
|���� Starbox �� Digital_Dream_Azureflux_Remix|CC BY-NC-SA 4.0|
|���� Azureflux �� BOMB|CC BY-NC-SA 4.0|
|δ֪��Ƶ|δ֪|
|���� Juhani Junkala �� The Essential Retro Video Game Sound Effects Collection|CC BY 3.0|
### ����
|����|��ȨЭ��|
|----|--------|
|Unifont|GPLv2|
Binary file added res/font/Unifont.ttf
Binary file not shown.
16 changes: 16 additions & 0 deletions res/messages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Stage Clear
Game Over
Paused
Score: %-6.0lf Got: %-6d Kill: %-6d Damage: %-6d Stand: %-6d
Player%d:%5d
Stage:%3d
Find %d more heros!
Listening
Listening.
Listening..
Listening...
Connecting
Connecting.
Connecting..
Connecting...
Enter IP
16 changes: 16 additions & 0 deletions res/messages.zh-CN.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
目标达成
游戏结束
暂停
分数: %-6.0lf 得到英雄: %-6d 击杀怪物: %-6d 造成伤害: %-6d 受到伤害: %-6d
玩家%d:%5d
阶段:%3d
再找到 %d 个英雄!
等待中
等待中.
等待中..
等待中...
连接中
连接中.
连接中..
连接中...
输入 IP
16 changes: 16 additions & 0 deletions res/messages.zh-TW.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
目標達成
遊戲結束
暫停
分數: %-6.0lf 得到英雄: %-6d 擊殺怪物: %-6d 造成傷害: %-6d 受到傷害: %-6d
玩家%d:%5d
階段:%3d
再找到 %d 個英雄!
等待中
等待中.
等待中..
等待中...
連接中
連接中.
連接中..
連接中...
輸入 IP
4 changes: 4 additions & 0 deletions res/text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Player 2
Singleplayer
Multiplayers
Ranklist
Languages
Exit
Normal
Hard
Expand All @@ -15,3 +16,6 @@ Local
Lan
Host a game
Join a game
English
繁體中文
简体中文
21 changes: 21 additions & 0 deletions res/text.zh-CN.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DungeonRush
作者 Rapiz
PLACEHOLDER
PLACEHOLDER
玩家1
rapiz1 marked this conversation as resolved.
Show resolved Hide resolved
玩家2
单人游戏
多人游戏
历史排名
界面语言
退出
正常
困难
疯狂
本地
局域网
创建房间
加入房间
English
简体中文
繁體中文
21 changes: 21 additions & 0 deletions res/text.zh-TW.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DungeonRush
作者 Rapiz
PLACEHOLDER
PLACEHOLDER
玩家1
rapiz1 marked this conversation as resolved.
Show resolved Hide resolved
玩家2
單人遊戲
多人遊戲
歷史排名
界面語言
退出
正常
困難
癲狂
本地
局域網
創建房間
加入房間
English
简体中文
繁體中文
3 changes: 3 additions & 0 deletions sh.exe.stackdump
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Stack trace:
rapiz1 marked this conversation as resolved.
Show resolved Hide resolved
Frame Function Args
End of stack trace
16 changes: 4 additions & 12 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ extern Weapon weapons[WEAPONS_SIZE];
extern Sprite commonSprites[COMMON_SPRITE_SIZE];

extern unsigned int renderFrames;
extern Text messages[];

// Map
Block map[MAP_SIZE][MAP_SIZE];
Item itemMap[MAP_SIZE][MAP_SIZE];
Expand Down Expand Up @@ -516,15 +518,8 @@ void destroyGame(int status) {
bullets = NULL;

blackout();
char* msg;
if (status == 0)
msg = "Stage Clear";
else
msg = "Game Over";
extern SDL_Color WHITE;
Text* text = createText(msg, WHITE);
Text* text = (status ? &messages[MSG_GAME_OVER] : &messages[MSG_STAGE_CLEAR]);
renderCenteredText(text, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 2);
destroyText(text);
SDL_RenderPresent(renderer);
sleep(RENDER_GAMEOVER_DURATION);
clearRenderer();
Expand Down Expand Up @@ -981,12 +976,9 @@ void pauseGame() {
pauseSound();
playAudio(AUDIO_BUTTON1);
dim();
const char msg[] = "Paused";
extern SDL_Color WHITE;
Text* text = createText(msg, WHITE);
Text* text = &messages[MSG_PAUSED];
renderCenteredText(text, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1);
SDL_RenderPresent(renderer);
destroyText(text);
SDL_Event e;
for (bool quit = 0; !quit;) {
while (SDL_PollEvent(&e)) {
Expand Down
18 changes: 9 additions & 9 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
TCPsocket lanServerSocket;
TCPsocket lanClientSocket;
SDLNet_SocketSet socketSet;
extern Text messages[MSG_COUNT];

static void CHECK() {
CASSERT(sizeof(LanPacket) == 4);
Expand Down Expand Up @@ -76,10 +77,10 @@ void hostGame() {

extern SDL_Color WHITE;
Text* listening[4] = {
createText("Listening", WHITE),
createText("Listening.", WHITE),
createText("Listening..", WHITE),
createText("Listening...", WHITE),
&messages[MSG_LAN_LISTENING0],
&messages[MSG_LAN_LISTENING1],
&messages[MSG_LAN_LISTENING2],
&messages[MSG_LAN_LISTENING3],
};

SDL_Event e;
Expand All @@ -102,7 +103,6 @@ void hostGame() {
// Clean up after connecting
SDLNet_TCP_Close(lanServerSocket);
lanServerSocket = NULL;
for (unsigned i = 0; i < 4; i++) destroyText(listening[i]);

blackout();

Expand Down Expand Up @@ -150,10 +150,10 @@ void joinGame(const char* hostname, Uint16 port) {

extern SDL_Color WHITE;
Text* connecting[4] = {
createText("Connecting", WHITE),
createText("Connecting.", WHITE),
createText("Connecting..", WHITE),
createText("Connecting...", WHITE),
&messages[MSG_LAN_CONNECTING0],
&messages[MSG_LAN_CONNECTING1],
&messages[MSG_LAN_CONNECTING2],
&messages[MSG_LAN_CONNECTING3],
};

bool quit = false;
Expand Down
7 changes: 4 additions & 3 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern int texturesCount;
extern Texture textures[TEXTURES_SIZE];
extern int textsCount;
extern Text texts[TEXTSET_SIZE];
extern Text messages[MSG_COUNT];
Text* stageText;
Text* taskText;
Text* scoresText[MAX_PALYERS_NUM];
Expand Down Expand Up @@ -58,7 +59,7 @@ void initCountDownBar() {
void initInfo() {
extern int stage;
char buf[1 << 8];
sprintf(buf, "Stage:%3d", stage);
sprintf(buf, messages[MSG_INFO_STAGE_FORMAT].text, stage);
if (stageText)
setText(stageText, buf);
else
Expand Down Expand Up @@ -374,7 +375,7 @@ void renderInfo() {
for (int i = 0; i < playersCount; i++) {
char buf[1 << 8];
calcScore(spriteSnake[i]->score);
sprintf(buf, "Player%d:%5d", i + 1,
sprintf(buf, messages[MSG_INFO_PLAYER_FORMAT].text, i + 1,
(int)(spriteSnake[i]->score->rank + 0.5));
setText(scoresText[i], buf);
renderText(scoresText[i], startX, startY, 1);
Expand All @@ -383,7 +384,7 @@ void renderInfo() {
if (playersCount == 1) {
extern int GAME_WIN_NUM;
char buf[1 << 8];
sprintf(buf, "Find %d more heros!",
sprintf(buf, messages[MSG_INFO_FIND_HEROS].text,
GAME_WIN_NUM > spriteSnake[0]->num
? GAME_WIN_NUM - spriteSnake[0]->num
: 0);
Expand Down
Loading