├── .gitignore
├── LICENSE
├── README.md
├── bin
├── data
│ ├── actors
│ │ ├── actor.json
│ │ └── grampire.png
│ ├── audio
│ │ ├── asylum.ogg
│ │ ├── bighead-death.wav
│ │ ├── boss_dead_find_exit.ogg
│ │ ├── circus_idea.ogg
│ │ ├── death.wav
│ │ ├── door.wav
│ │ ├── grampire-death.wav
│ │ ├── grampire-hurt.wav
│ │ ├── highlight.wav
│ │ ├── hit.wav
│ │ ├── hooded_priest-death.wav
│ │ ├── hurt.wav
│ │ ├── ingame1.ogg
│ │ ├── key.wav
│ │ ├── machinegun.wav
│ │ ├── medkit.wav
│ │ ├── menuback.wav
│ │ ├── menuselect.wav
│ │ ├── monsters.ogg
│ │ ├── notify.wav
│ │ ├── pistol.wav
│ │ ├── rain.ogg
│ │ ├── raven-death.wav
│ │ ├── raven.wav
│ │ ├── reload.wav
│ │ ├── rust_ambient.ogg
│ │ ├── scroll.wav
│ │ ├── shotgun.wav
│ │ ├── skeleton-death.wav
│ │ ├── skeleton-old1.wav
│ │ ├── squish.wav
│ │ ├── thunder.wav
│ │ ├── uzis.wav
│ │ └── zombie-death.wav
│ ├── background.png
│ ├── effects
│ │ ├── fogLayer.png
│ │ ├── particle.png
│ │ └── rain.png
│ ├── hud
│ │ ├── arrow.png
│ │ ├── background2.png
│ │ ├── hitpoint.png
│ │ ├── hp.png
│ │ ├── life.png
│ │ ├── lifebar.png
│ │ ├── portrait_bernie.png
│ │ ├── portrait_fetusmaximus.png
│ │ ├── portrait_grampire.png
│ │ ├── portrait_maskkid.png
│ │ └── portrait_steven.png
│ ├── logo.png
│ ├── maps.json
│ ├── maps
│ │ ├── church.tmx
│ │ ├── circusTileset.png
│ │ ├── graveyardTileset.json
│ │ ├── graveyardTileset.png
│ │ ├── modern.tmx
│ │ ├── modernTileset.json
│ │ ├── modernTileset.png
│ │ ├── objectSet1.json
│ │ ├── objectSet1.png
│ │ ├── objects.json
│ │ ├── objects.png
│ │ ├── spawns.png
│ │ ├── theGraveyard.tmx
│ │ └── void_cavern.tmx
│ ├── particle.png
│ ├── qorpse.png
│ ├── shaders
│ │ ├── basic.fp
│ │ ├── basic.json
│ │ └── basic.vp
│ ├── things
│ │ ├── bernie.json
│ │ ├── bernie.png
│ │ ├── bighead.json
│ │ ├── bighead.png
│ │ ├── bloodpool1.png
│ │ ├── bloodpool2.png
│ │ ├── bullet.png
│ │ ├── fetus_maximus.png
│ │ ├── ghost.json
│ │ ├── ghost.png
│ │ ├── gib1.png
│ │ ├── gib2.png
│ │ ├── gib3.png
│ │ ├── hooded_priest.json
│ │ ├── hooded_priest.png
│ │ ├── mask_kid.json
│ │ ├── mask_kid.png
│ │ ├── meat_fly.json
│ │ ├── meat_fly.png
│ │ ├── raven.json
│ │ ├── raven.png
│ │ ├── scarecrow.png
│ │ ├── severed_head.json
│ │ ├── severed_head.png
│ │ ├── skeleton.json
│ │ ├── skeleton.png
│ │ ├── zombie.json
│ │ └── zombie.png
│ ├── vendor
│ │ └── ionicons
│ │ │ ├── .gitignore
│ │ │ ├── LICENSE
│ │ │ └── png
│ │ │ └── 512
│ │ │ ├── load-a.png
│ │ │ ├── load-b.png
│ │ │ ├── load-c.png
│ │ │ └── load-d.png
│ └── weapons.json
├── profiles
│ ├── default.json
│ ├── gamepad.json_
│ └── keyboard.json_
├── qorpse.desktop
├── settings.json
└── settings.schema.json
├── premake4.lua
├── qorpse.tasks
├── sg.json
└── src
├── Character.cpp
├── Character.h
├── CharacterInterface.cpp
├── CharacterInterface.h
├── HUD.cpp
├── HUD.h
├── Info.h
├── Main.cpp
├── MenuState.cpp
├── MenuState.h
├── QorpseState.cpp
├── QorpseState.h
├── TextScroller.cpp
├── TextScroller.h
├── Thing.cpp
├── Thing.h
├── Weapon.h
├── World.cpp
└── World.h
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/qorpse
2 | bin/qorpse_dist
3 | bin/*.log
4 | obj/
5 | src/kit
6 | src/Qor
7 | src/shaders
8 | src/scripts
9 | __pycache__/
10 | *.make
11 | Makefile
12 |
13 | # Compiled Object files
14 | *.slo
15 | *.lo
16 | *.o
17 | *.obj
18 |
19 | # Compiled Dynamic libraries
20 | *.so
21 | *.dylib
22 | *.dll
23 |
24 | # Compiled Static libraries
25 | *.lai
26 | *.la
27 | *.a
28 | *.lib
29 |
30 | # Executables
31 | *.exe
32 | *.out
33 | *.app
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Grady O'Connell
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Qorpse
2 | ======
3 |
4 | Retro horror shooter written in C++11.
5 |
6 | [](http://www.youtube.com/watch?v=5Fyw-sdIT_8)
7 |
8 | [](https://www.youtube.com/watch?v=3S3Bc8S_yjg)
9 |
10 | ## Credits ##
11 |
12 | ### Programming
13 | - [Grady O'Connell](http://github.com/flipcoder) (flipcoder@gmail.com)
14 |
15 | ### Graphics
16 | - [Mark "Alfred" McDaniel](http://github.com/AlfredAnonymous) (alfred523@gmail.com)
17 |
18 | ### Music & Sound
19 | - [Grady O'Connell](http://github.com/flipcoder) (flipcoder@gmail.com)
20 |
21 |
--------------------------------------------------------------------------------
/bin/data/actors/actor.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75 ],
6 | "mask" : [ 0.25, 0.5, 0.75, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "down": {
11 | "stand": [0],
12 | "walk": [0,1,0,2]
13 | },
14 | "up": {
15 | "stand": [3],
16 | "walk": [3,4,3,5]
17 | },
18 | "left": {
19 | "stand": [6],
20 | "walk": [6,7,6,8]
21 | },
22 | "right": {
23 | "stand": ["hflip",6],
24 | "walk": ["hflip",6,7,6,8]
25 | },
26 | "death": ["once",9,10,11]
27 | }
28 | },
29 | "skins": [
30 | "grampire"
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/bin/data/actors/grampire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/actors/grampire.png
--------------------------------------------------------------------------------
/bin/data/audio/asylum.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/asylum.ogg
--------------------------------------------------------------------------------
/bin/data/audio/bighead-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/bighead-death.wav
--------------------------------------------------------------------------------
/bin/data/audio/boss_dead_find_exit.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/boss_dead_find_exit.ogg
--------------------------------------------------------------------------------
/bin/data/audio/circus_idea.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/circus_idea.ogg
--------------------------------------------------------------------------------
/bin/data/audio/death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/death.wav
--------------------------------------------------------------------------------
/bin/data/audio/door.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/door.wav
--------------------------------------------------------------------------------
/bin/data/audio/grampire-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/grampire-death.wav
--------------------------------------------------------------------------------
/bin/data/audio/grampire-hurt.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/grampire-hurt.wav
--------------------------------------------------------------------------------
/bin/data/audio/highlight.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/highlight.wav
--------------------------------------------------------------------------------
/bin/data/audio/hit.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/hit.wav
--------------------------------------------------------------------------------
/bin/data/audio/hooded_priest-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/hooded_priest-death.wav
--------------------------------------------------------------------------------
/bin/data/audio/hurt.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/hurt.wav
--------------------------------------------------------------------------------
/bin/data/audio/ingame1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/ingame1.ogg
--------------------------------------------------------------------------------
/bin/data/audio/key.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/key.wav
--------------------------------------------------------------------------------
/bin/data/audio/machinegun.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/machinegun.wav
--------------------------------------------------------------------------------
/bin/data/audio/medkit.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/medkit.wav
--------------------------------------------------------------------------------
/bin/data/audio/menuback.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/menuback.wav
--------------------------------------------------------------------------------
/bin/data/audio/menuselect.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/menuselect.wav
--------------------------------------------------------------------------------
/bin/data/audio/monsters.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/monsters.ogg
--------------------------------------------------------------------------------
/bin/data/audio/notify.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/notify.wav
--------------------------------------------------------------------------------
/bin/data/audio/pistol.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/pistol.wav
--------------------------------------------------------------------------------
/bin/data/audio/rain.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/rain.ogg
--------------------------------------------------------------------------------
/bin/data/audio/raven-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/raven-death.wav
--------------------------------------------------------------------------------
/bin/data/audio/raven.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/raven.wav
--------------------------------------------------------------------------------
/bin/data/audio/reload.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/reload.wav
--------------------------------------------------------------------------------
/bin/data/audio/rust_ambient.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/rust_ambient.ogg
--------------------------------------------------------------------------------
/bin/data/audio/scroll.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/scroll.wav
--------------------------------------------------------------------------------
/bin/data/audio/shotgun.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/shotgun.wav
--------------------------------------------------------------------------------
/bin/data/audio/skeleton-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/skeleton-death.wav
--------------------------------------------------------------------------------
/bin/data/audio/skeleton-old1.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/skeleton-old1.wav
--------------------------------------------------------------------------------
/bin/data/audio/squish.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/squish.wav
--------------------------------------------------------------------------------
/bin/data/audio/thunder.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/thunder.wav
--------------------------------------------------------------------------------
/bin/data/audio/uzis.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/uzis.wav
--------------------------------------------------------------------------------
/bin/data/audio/zombie-death.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/audio/zombie-death.wav
--------------------------------------------------------------------------------
/bin/data/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/background.png
--------------------------------------------------------------------------------
/bin/data/effects/fogLayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/effects/fogLayer.png
--------------------------------------------------------------------------------
/bin/data/effects/particle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/effects/particle.png
--------------------------------------------------------------------------------
/bin/data/effects/rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/effects/rain.png
--------------------------------------------------------------------------------
/bin/data/hud/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/arrow.png
--------------------------------------------------------------------------------
/bin/data/hud/background2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/background2.png
--------------------------------------------------------------------------------
/bin/data/hud/hitpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/hitpoint.png
--------------------------------------------------------------------------------
/bin/data/hud/hp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/hp.png
--------------------------------------------------------------------------------
/bin/data/hud/life.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/life.png
--------------------------------------------------------------------------------
/bin/data/hud/lifebar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/lifebar.png
--------------------------------------------------------------------------------
/bin/data/hud/portrait_bernie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/portrait_bernie.png
--------------------------------------------------------------------------------
/bin/data/hud/portrait_fetusmaximus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/portrait_fetusmaximus.png
--------------------------------------------------------------------------------
/bin/data/hud/portrait_grampire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/portrait_grampire.png
--------------------------------------------------------------------------------
/bin/data/hud/portrait_maskkid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/portrait_maskkid.png
--------------------------------------------------------------------------------
/bin/data/hud/portrait_steven.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/hud/portrait_steven.png
--------------------------------------------------------------------------------
/bin/data/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/logo.png
--------------------------------------------------------------------------------
/bin/data/maps.json:
--------------------------------------------------------------------------------
1 | {
2 | "maps": [
3 | "theGraveyard",
4 | "modern",
5 | "church"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/bin/data/maps/church.tmx:
--------------------------------------------------------------------------------
1 |
2 |
120 |
--------------------------------------------------------------------------------
/bin/data/maps/circusTileset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/circusTileset.png
--------------------------------------------------------------------------------
/bin/data/maps/graveyardTileset.json:
--------------------------------------------------------------------------------
1 | {
2 | "1,1": {
3 | "sidewall": "right"
4 | },
5 | "2,1": {
6 | "sidewall": ""
7 | },
8 | "1,3": {
9 | "sidewall": ""
10 | },
11 | "1,4": {
12 | "sidewall": "right"
13 | },
14 | "3,1": {
15 | "door": ""
16 | },
17 | "4,7": {
18 | "trap": ""
19 | },
20 | "5,7": {
21 | "trap": ""
22 | },
23 | "5,1": {
24 | "window": ""
25 | },
26 | "7,1": {
27 | "window": ""
28 | },
29 | "3,1": {
30 | "door": ""
31 | },
32 | "8,3": {
33 | "sidewall": "",
34 | "door": ""
35 | },
36 | "0,14": {
37 | "sidewall":""
38 | },
39 | "1,14": {
40 | "sidewall": "right"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/bin/data/maps/graveyardTileset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/graveyardTileset.png
--------------------------------------------------------------------------------
/bin/data/maps/modernTileset.json:
--------------------------------------------------------------------------------
1 | {
2 | "3,3": {
3 | "door": ""
4 | },
5 | "3,7": {
6 | "window": ""
7 | },
8 | "4,2": {
9 | "sidewall": ""
10 | },
11 | "4,7": {
12 | "window": ""
13 | },
14 | "4,13": {
15 | "door": ""
16 | },
17 | "5,7": {
18 | "window": ""
19 | },
20 | "6,3": {
21 | "stairs": ""
22 | },
23 | "7,3": {
24 | "stairs": ""
25 | },
26 | "8,5": {
27 | "stairs": ""
28 | },
29 | "9,2": {
30 | "sidewall": ""
31 | },
32 | "9,6": {
33 | "door": ""
34 | },
35 | "10,6": {
36 | "stairs": ""
37 | },
38 | "12,0": {
39 | "door": ""
40 | },
41 | "12,5": {
42 | "window": ""
43 | },
44 | "12,6": {
45 | "window": ""
46 | },
47 | "13,5": {
48 | "window": ""
49 | },
50 | "13,6": {
51 | "window": ""
52 | },
53 | "14,5": {
54 | "window": ""
55 | },
56 | "14,6": {
57 | "window": ""
58 | },
59 | "15,5": {
60 | "window": ""
61 | },
62 | "15,6": {
63 | "window": ""
64 | },
65 | "16,5": {
66 | "window": ""
67 | },
68 | "16,6": {
69 | "window": ""
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/bin/data/maps/modernTileset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/modernTileset.png
--------------------------------------------------------------------------------
/bin/data/maps/objectSet1.json:
--------------------------------------------------------------------------------
1 | {
2 | "6,5": {
3 | "breakable": ""
4 | },
5 | "6,6": {
6 | "breakable": ""
7 | },
8 | "7,5": {
9 | "breakable": "",
10 | "explode": ""
11 | },
12 | "7,6": {
13 | "breakable": "",
14 | "explode": ""
15 | },
16 | "8,5": {
17 | "name": "lever"
18 | },
19 | "8,6": {
20 | "name": "lever"
21 | },
22 | "12,4": {
23 | "breakable": ""
24 | },
25 | "13,5": {
26 | "breakable": ""
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/bin/data/maps/objectSet1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/objectSet1.png
--------------------------------------------------------------------------------
/bin/data/maps/objects.json:
--------------------------------------------------------------------------------
1 | {
2 | "0,0": {
3 | "name": "player_start"
4 | },
5 | "0,1": {
6 | "name": "medkit"
7 | },
8 | "0,5": {
9 | "name": "scarecrow"
10 | },
11 | "0,6": {
12 | "name": "bernie"
13 | },
14 | "0,7": {
15 | "name": "fetus_maximus"
16 | },
17 | "1,2": {
18 | "name": "player_start_2"
19 | },
20 | "1,2":{
21 | "name": "tomb"
22 | },
23 | "1,5": {
24 | "name": "gorecrow"
25 | },
26 | "1,6": {
27 | "name": "zombie"
28 | },
29 | "1,7": {
30 | "name": "ghost"
31 | },
32 | "2,3": {
33 | "name": "comic"
34 | },
35 | "2,6": {
36 | "name": "grampire"
37 | },
38 | "2,7": {
39 | "name": "hooded_priest"
40 | },
41 | "3,0": {
42 | "name": "random_weapon_spawn"
43 | },
44 | "3,6": {
45 | "name": "mask_kid"
46 | },
47 | "3,7": {
48 | "name": "raven"
49 | },
50 | "4,0": {
51 | "name": "script_trigger"
52 | },
53 | "4,6": {
54 | "name": "severed_head"
55 | },
56 | "4,7": {
57 | "name": "bighead"
58 | },
59 | "5,6": {
60 | "name": "skeleton"
61 | },
62 | "5,7": {
63 | "name": "meatfly"
64 | },
65 | "6,0": {
66 | "name": "key"
67 | },
68 | "6,1": {
69 | "name": "lock"
70 | },
71 | "7,0": {
72 | "name": "rifle"
73 | },
74 | "7,1": {
75 | "name": "grenade_launcher"
76 | },
77 | "7,2": {
78 | "name": "flamethrower"
79 | },
80 | "7,3": {
81 | "name": "shotgun"
82 | },
83 | "7,4": {
84 | "name": "bazooka"
85 | },
86 | "7,5": {
87 | "name": "uzis"
88 | },
89 | "7,6": {
90 | "name": "minigun"
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/bin/data/maps/objects.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/objects.png
--------------------------------------------------------------------------------
/bin/data/maps/spawns.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/maps/spawns.png
--------------------------------------------------------------------------------
/bin/data/particle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/particle.png
--------------------------------------------------------------------------------
/bin/data/qorpse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/qorpse.png
--------------------------------------------------------------------------------
/bin/data/shaders/basic.fp:
--------------------------------------------------------------------------------
1 | #version 120
2 |
3 | /*varying vec3 VertexPosition;*/
4 | varying vec3 Position;
5 | varying vec2 Wrap;
6 | /*varying vec2 Normal;*/
7 |
8 | uniform sampler2D Texture;
9 | uniform vec4 Ambient = vec4(1.0, 1.0, 1.0, 1.0);
10 | /*uniform int Flags = 0;*/
11 |
12 | /*#define FLAG_FOG 0x1*/
13 |
14 | // This color key stuff could be done on the CPU, and using a separate tex
15 | /*uniform vec4 ColorKeyLow;*/
16 | /*uniform vec4 ColorKeyHigh;*/
17 | /*uniform vec4 ColorReplaceLow;*/
18 | /*uniform vec4 ColorReplaceHigh;*/
19 |
20 | #define M_PI 3.1415926535897932384626433832795
21 | #define M_TAU (M_PI * 2.0)
22 |
23 | bool floatcmp(float a, float b, float e)
24 | {
25 | return abs(a-b) < e;
26 | }
27 |
28 | bool colorcmp(vec4 a, vec4 b, float t)
29 | {
30 | return floatcmp(a.r,b.r,t) &&
31 | floatcmp(a.g,b.g,t) &&
32 | floatcmp(a.b,b.b,t);
33 | }
34 |
35 | vec4 grayscale(vec4 c)
36 | {
37 | float v = (c.r + c.g + c.b) / 3.0;
38 | return vec4(v,v,v, c.a);
39 | }
40 |
41 | vec4 evil(vec4 c)
42 | {
43 | if(colorcmp(c, vec4(1.0, 0.0, 0.0, 1.0), 0.1))
44 | return c;
45 | return grayscale(c);
46 | }
47 |
48 | float avg(vec3 c)
49 | {
50 | return (c.r + c.g + c.b) / 3.0;
51 | }
52 |
53 | float saturate(float v)
54 | {
55 | return clamp(v, 0.0, 1.0);
56 | }
57 |
58 | vec3 saturate(vec3 v)
59 | {
60 | vec3 r;
61 | r.x = saturate(v.x);
62 | r.y = saturate(v.y);
63 | r.z = saturate(v.z);
64 | return r;
65 | }
66 |
67 | void main()
68 | {
69 | vec4 color = texture2D(Texture, Wrap);
70 | float e = 0.1; // threshold
71 | if(floatcmp(color.r, 1.0, e) &&
72 | floatcmp(color.g, 0.0, e) &&
73 | floatcmp(color.b, 1.0, e))
74 | {
75 | discard;
76 | }
77 | if(floatcmp(color.a, 0.0, e)) {
78 | discard;
79 | }
80 |
81 | float dist = length(Position.xy);
82 | /*if((Flags & FLAG_FOG) != 0)*/
83 | /*{*/
84 | /*float fog = 1.0f - sqrt(dist * dist * dist) * 0.6f;*/
85 | /*gl_FragColor = vec4(saturate(vec3(color.xyz * Ambient.xyz * fog)), color.a * Ambient.a);*/
86 | /*}*/
87 | /*else*/
88 | /*{*/
89 | gl_FragColor = vec4(saturate(vec3(color.xyz * Ambient.xyz)), color.a * Ambient.a);
90 | /*}*/
91 | /*gl_FragColor = vec4(saturate(vec3(color * vec4(vec3(1.5),1.0) * fog)), 1.0);*/
92 | /*gl_FragColor = mix(color, evil(color), 1.0-fog) * LightBrightness;*/
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/bin/data/shaders/basic.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "shader"
3 | }
4 |
--------------------------------------------------------------------------------
/bin/data/shaders/basic.vp:
--------------------------------------------------------------------------------
1 | #version 120
2 |
3 | attribute vec3 VertexPosition;
4 | attribute vec2 VertexWrap;
5 |
6 | varying vec3 Position;
7 | varying vec2 Wrap;
8 |
9 | uniform mat4 ModelViewProjection;
10 | uniform mat4 ModelView;
11 | uniform mat4 NormalMatrix;
12 |
13 | void main()
14 | {
15 | /*Position = VertexPosition;*/
16 | gl_Position = ModelViewProjection * vec4(VertexPosition, 1.0);
17 | Wrap = VertexWrap;
18 | Position = gl_Position.xyz;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/bin/data/things/bernie.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bernie",
3 | "image": "bernie.png",
4 | "size" : [ 16, 16 ],
5 | "tile-size" : [ 16, 16 ],
6 | "origin" : [ 0.5, 0.75 ],
7 | "mask" : [ 0.25, 0.5, 0.875, 1.0 ],
8 | "animation" : {
9 | "speed" : 10.0,
10 | "frames" : {
11 | "down": [0,1],
12 | "up":[2,3],
13 | "left": [4,5],
14 | "right": ["hflip",4,5]
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bin/data/things/bernie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/bernie.png
--------------------------------------------------------------------------------
/bin/data/things/bighead.json:
--------------------------------------------------------------------------------
1 | {
2 | "size" : [ 32, 32 ],
3 | "tile-size" : [ 32, 32 ],
4 | "origin" : [ 0.5, 0.75 ],
5 | "mask" : [ 0.25, 0.5, 0.875, 1.0 ],
6 | "animation" : {
7 | "speed" : 10.0,
8 | "frames" : {
9 | "down": [0,1],
10 | "up": [4],
11 | "left": [2,3],
12 | "right": ["hflip",2,3],
13 | "death": ["once", 4,5,6]
14 | }
15 | },
16 | "hp": 10
17 | }
18 |
--------------------------------------------------------------------------------
/bin/data/things/bighead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/bighead.png
--------------------------------------------------------------------------------
/bin/data/things/bloodpool1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/bloodpool1.png
--------------------------------------------------------------------------------
/bin/data/things/bloodpool2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/bloodpool2.png
--------------------------------------------------------------------------------
/bin/data/things/bullet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/bullet.png
--------------------------------------------------------------------------------
/bin/data/things/fetus_maximus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/fetus_maximus.png
--------------------------------------------------------------------------------
/bin/data/things/ghost.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75 ],
6 | "mask" : [ 0.5, 0.5, 0.875, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "down": [0,1,2],
11 | "up":[3,4,5],
12 | "left": [6,7,8],
13 | "right": ["hflip",6,7,8]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bin/data/things/ghost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/ghost.png
--------------------------------------------------------------------------------
/bin/data/things/gib1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/gib1.png
--------------------------------------------------------------------------------
/bin/data/things/gib2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/gib2.png
--------------------------------------------------------------------------------
/bin/data/things/gib3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/gib3.png
--------------------------------------------------------------------------------
/bin/data/things/hooded_priest.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75 ],
6 | "mask" : [ 0.25, 0.50, 0.875, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "down": [0,1,0,2],
11 | "up":[3,4,3,5],
12 | "left": [6,7,6,8],
13 | "right": ["hflip",6,7,6,8],
14 | "death": ["once",9,10,11]
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bin/data/things/hooded_priest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/hooded_priest.png
--------------------------------------------------------------------------------
/bin/data/things/mask_kid.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75],
6 | "mask" : [ 0.25, 0.5, 0.75, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "down": [0,1,0,2],
11 | "up": [3,4,3,5],
12 | "left": [6,7,6,8],
13 | "right": ["hflip",6,7,6,8],
14 | "death": ["once", 9, 10, 11]
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bin/data/things/mask_kid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/mask_kid.png
--------------------------------------------------------------------------------
/bin/data/things/meat_fly.json:
--------------------------------------------------------------------------------
1 | {
2 | "size" : [ 16, 16 ],
3 | "tile-size" : [ 16, 16 ],
4 | "origin" : [ 0.5, 0.75 ],
5 | "mask" : [ 0.25, 0.5, 0.875, 1.0 ],
6 | "animation" : {
7 | "speed" : 10.0,
8 | "frames" : {
9 | "down": [0,1],
10 | "up":[2,3],
11 | "left": ["hflip",4,5],
12 | "right": [4,5],
13 | "death": ["once", 7,8]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bin/data/things/meat_fly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/meat_fly.png
--------------------------------------------------------------------------------
/bin/data/things/raven.json:
--------------------------------------------------------------------------------
1 | {
2 | "size" : [ 16, 16 ],
3 | "tile-size" : [ 16, 16 ],
4 | "origin" : [ 0.5, 0.75 ],
5 | "mask" : [ 0.25, 0.5, 0.875, 1.0 ],
6 | "animation" : {
7 | "speed" : 10.0,
8 | "frames" : {
9 | "down": [0,1],
10 | "up":[2,3],
11 | "left": ["hflip",4,5],
12 | "right": [4,5],
13 | "death": ["once", 6,7,8]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bin/data/things/raven.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/raven.png
--------------------------------------------------------------------------------
/bin/data/things/scarecrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/scarecrow.png
--------------------------------------------------------------------------------
/bin/data/things/severed_head.json:
--------------------------------------------------------------------------------
1 | {
2 | "size" : [ 16, 16 ],
3 | "tile-size" : [ 16, 16 ],
4 | "origin" : [ 0.5, 0.75 ],
5 | "mask" : [ 0.25, 0.5, 0.875, 1.0 ],
6 | "animation" : {
7 | "speed" : 10.0,
8 | "frames" : {
9 | "down": [0,1,2,3],
10 | "up": [0,1,2,3],
11 | "left": [0,1,2,3],
12 | "right": [0,1,2,3],
13 | "death": ["once",4,5,6,7]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bin/data/things/severed_head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/severed_head.png
--------------------------------------------------------------------------------
/bin/data/things/skeleton.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75 ],
6 | "mask" : [ 0.5, 0.5, 0.875, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "down": [0,1,2],
11 | "up":[3,4,5],
12 | "left": [6,7,8],
13 | "right": ["hflip",6,7,8],
14 | "death": ["once", 9,10]
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bin/data/things/skeleton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/skeleton.png
--------------------------------------------------------------------------------
/bin/data/things/zombie.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "sprite",
3 | "size" : [ 16, 16 ],
4 | "tile-size" : [ 16, 16 ],
5 | "origin" : [ 0.5, 0.75 ],
6 | "mask" : [ 0.5, 0.5, 0.875, 1.0 ],
7 | "animation" : {
8 | "speed" : 10.0,
9 | "frames" : {
10 | "spawn": [0,1,2],
11 | "down": [3,4,3,5],
12 | "up":[6,7,6,8],
13 | "left": [9,10,9,11],
14 | "right": ["hflip",9,10,9,11],
15 | "death": ["once",12,13,14]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/bin/data/things/zombie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/things/zombie.png
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | .sass-cache
3 | *.scssc
4 | *.swp
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Drifty (http://drifty.com/)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/png/512/load-a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/vendor/ionicons/png/512/load-a.png
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/png/512/load-b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/vendor/ionicons/png/512/load-b.png
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/png/512/load-c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/vendor/ionicons/png/512/load-c.png
--------------------------------------------------------------------------------
/bin/data/vendor/ionicons/png/512/load-d.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flipcoder/qorpse/218a92067d66b6a98b949e53c4063d712437b469/bin/data/vendor/ionicons/png/512/load-d.png
--------------------------------------------------------------------------------
/bin/data/weapons.json:
--------------------------------------------------------------------------------
1 | {
2 | "pistol": {
3 | "ammo-type": "pistol bullets",
4 | "gfx": "bullet",
5 | "ammo": 25,
6 | "in-clip": 5,
7 | "clip-capacity": 5,
8 | "chamber": 1,
9 | "range": 256.0,
10 | "fire-speed": 5.0,
11 | "reload-speed": 3.0,
12 | "bullet-speed": 512.0,
13 | "accuracy": 1.0
14 | },
15 | "shotgun": {
16 | "ammo-type": "shells",
17 | "gfx": "bullet",
18 | "ammo": 48,
19 | "in-clip": 8,
20 | "clip-capacity": 8,
21 | "chamber": 4,
22 | "range": 256.0,
23 | "fire-speed": 3.0,
24 | "reload-speed": 3.0,
25 | "bullet-speed": 512.0,
26 | "accuracy": 0.5
27 | },
28 | "uzis": {
29 | "ammo-type": "uzi rounds",
30 | "gfx": "bullet",
31 | "ammo": 128,
32 | "in-clip": 24,
33 | "clip-capacity":24,
34 | "chamber": 1,
35 | "range": 256.0,
36 | "fire-speed": 10.0,
37 | "reload-speed": 1.0,
38 | "bullet-speed": 512.0,
39 | "accuracy": 0.95,
40 | "flags": ["dual"]
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/bin/profiles/default.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Player",
3 | "actor": "grampire",
4 | "input": {
5 | "binds": {
6 | "left": "left",
7 | "right": "right",
8 | "up": "up",
9 | "down": "down",
10 | "z": [
11 | "shoot",
12 | "select"
13 | ],
14 | "left shift": "sprint",
15 | "x": "strafe",
16 | "v": "reload",
17 | "c": [
18 | "next_weapon",
19 | "back"
20 | ],
21 | "d": "previous_weapon",
22 | "a": "action",
23 | "escape": "escape"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bin/profiles/gamepad.json_:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Player",
3 | "actor": "grampire",
4 | "input": {
5 | "binds": {
6 | "gamepad hat 0": "left",
7 | "gamepad hat 1": "right",
8 | "gamepad hat 2": "up",
9 | "gamepad hat 3": "down",
10 | "gamepad 0": [
11 | "shoot",
12 | "select"
13 | ],
14 | "gamepad 12": "sprint",
15 | "gamepad 3": "strafe",
16 | "gamepad 1": "reload",
17 | "gamepad 4": [
18 | "next_weapon",
19 | "back"
20 | ],
21 | "gamepad 17": "previous_weapon",
22 | "gamepad 20": "action",
23 | "gamepad 21": "escape"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bin/profiles/keyboard.json_:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Player",
3 | "actor": "grampire",
4 | "input": {
5 | "binds": {
6 | "left": "left",
7 | "right": "right",
8 | "up": "up",
9 | "down": "down",
10 | "z": [
11 | "shoot",
12 | "select"
13 | ],
14 | "left shift": "sprint",
15 | "x": "strafe",
16 | "v": "reload",
17 | "c": [
18 | "next_weapon",
19 | "back"
20 | ],
21 | "d": "previous_weapon",
22 | "a": "action",
23 | "escape": "escape"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bin/qorpse.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=qorpse
3 | Exec=qorpse
4 | Icon=qorpse
5 | Terminal=false
6 | Type=Application
7 | Categories=Game;
8 |
--------------------------------------------------------------------------------
/bin/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "audio" : {
3 | "music-volume" : 100,
4 | "sound-volume" : 100,
5 | "volume" : 100
6 | },
7 | "video" : {
8 | "resolution" : "1920x1080",
9 | "vsync" : false,
10 | "windowed" : false
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/bin/settings.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "video": {
3 | "resolution": {
4 | ".name": "Display Resolution",
5 | ".testable": true
6 | },
7 | "windowed": {
8 | ".name": "Window",
9 | ".desc": "Play in windowed or fullscreen mode",
10 | ".values": [ false, true ],
11 | ".options": [
12 | "Fullscreen",
13 | "Windowed",
14 | "Borderless"
15 | ]
16 | },
17 | "aa": {
18 | ".name": "Anti-Aliasing",
19 | ".values": [ false ],
20 | ".desc": "Smooths sharp edges"
21 | },
22 | "vsync": {
23 | ".name": "Vertical Sync",
24 | ".desc": "Reduces tearing but may lower frame rate",
25 | ".values": [ false, true ]
26 | }
27 | },
28 |
29 | "audio": {
30 | "volume": {
31 | ".name": "Volume",
32 | ".min": 0,
33 | ".max": 100,
34 | ".default": 50,
35 | ".postfix": "%"
36 | }
37 | },
38 |
39 | "controls": {
40 | },
41 |
42 | "advanced": {
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/premake4.lua:
--------------------------------------------------------------------------------
1 | solution("qorpse")
2 | configurations {"Debug", "Release"}
3 |
4 | targetdir("bin")
5 | configuration "Debug"
6 | defines { "DEBUG" }
7 | --optimize "debug"
8 | flags { "Symbols" }
9 | configuration "Release"
10 | defines { "NDEBUG" }
11 | --optimize "speed"
12 | flags { "OptimizeSpeed", "FloatFast" }
13 | targetname("qorpse_dist")
14 |
15 | project("qorpse")
16 | --uuid("")
17 | kind("WindowedApp")
18 | language("C++")
19 | links {
20 | "pthread",
21 | "GL",
22 | "GLU",
23 | "SDL2",
24 | "GLEW",
25 | --"assimp",
26 | "IL",
27 | "ILU",
28 | "openal",
29 | "alut",
30 | "ogg",
31 | "vorbis",
32 | "vorbisfile",
33 | "boost_system",
34 | "boost_thread",
35 | "boost_filesystem",
36 | "boost_python",
37 | "boost_coroutine",
38 | "jsoncpp",
39 | "assimp",
40 | "freeimage"
41 | }
42 | files {
43 | "src/**.h",
44 | "src/**.cpp"
45 | }
46 | excludes {
47 | "src/Qor/Main.cpp",
48 | "src/Qor/Info.cpp",
49 | -- no physics:
50 | "src/Qor/Physics.*",
51 | -- no net:
52 | "src/Qor/Net.*",
53 | "src/Qor/DemoState.*",
54 | "src/Qor/tests/**",
55 | "src/Qor/scripts/**",
56 | "src/Qor/addons/**",
57 | "src/Qor/shaders/**"
58 | }
59 | includedirs {
60 | "vendor/include/",
61 | "/usr/local/include/",
62 | --"/usr/include/cegui-0/",
63 | "/usr/include/bullet/",
64 | }
65 | libdirs {
66 | --"/usr/lib/cegui-0.8/",
67 | "/usr/local/lib/",
68 | "/usr/local/lib64/",
69 | }
70 |
71 | defines { "QOR_NO_PHYSICS" }
72 | buildoptions {
73 | "`python2-config --includes`",
74 | "`pkg-config --cflags cairomm-1.0 pangomm-1.4`"
75 | }
76 | linkoptions {
77 | "`python2-config --libs`",
78 | "`pkg-config --libs cairomm-1.0 pangomm-1.4`"
79 | --"`pkg-config --libs cairomm pangomm`"
80 | }
81 | configuration {"debug"}
82 | defines { "BACKWARD_HAS_BFD=1" }
83 | links {
84 | "z",
85 | "bfd",
86 | "iberty"
87 | }
88 | linkoptions { "`llvm-config --libs core` `llvm-config --ldflags`" }
89 | configuration {}
90 |
91 | --configuration { "linux" }
92 | -- includedirs {
93 | -- "/usr/include/lua5.1",
94 | -- }
95 | --configuration {}
96 |
97 | configuration { "gmake" }
98 | buildoptions { "-std=c++11" }
99 | --buildoptions { "-std=c++11", "-pedantic", "-Wall", "-Wextra" }
100 | configuration { "macosx" }
101 | buildoptions { "-U__STRICT_ANSI__", "-stdlib=libc++" }
102 | linkoptions { "-stdlib=libc++" }
103 | configuration {}
104 |
105 |
--------------------------------------------------------------------------------
/qorpse.tasks:
--------------------------------------------------------------------------------
1 | [ ] Qor: Canvas draw optimizations
2 | [.] parallax view layers
3 | [.] BUG: transparency blend options don't work (?)
4 | [.] block walking outside the map
5 | [.] confine camera to map
6 | [?] would be nice to have access for resources to have access to config schema for value clamping
7 | # isn't there a better way to do this? don't remember what i was thinking when i wrote this ^
8 | # just add a validation function to meta?
9 | # access to value range allows visual progress bars, etc. instead of just validity test
10 | # they DO have access, schema is stored inside resource cache
11 | [|] keys, locked doors
12 | [x] keys and inventory
13 | [?] BUG Thing::LOCK collision still not working
14 | [ ] level win conditions
15 |
--------------------------------------------------------------------------------
/sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "options": {
3 | "env": {
4 | "CXX": "clang++"
5 | },
6 | "makefile_params": [
7 | "CXX='clang++'"
8 | ]
9 | },
10 |
11 | "required": {
12 | "flipcoder/qor": {
13 | "link": "Qor"
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Character.cpp:
--------------------------------------------------------------------------------
1 | #include "Character.h"
2 | using namespace std;
3 | using namespace glm;
4 |
5 | Character :: Character(
6 | Session* session,
7 | Profile* profile,
8 | const string& fn,
9 | Cache* resources,
10 | glm::vec3 pos = glm::vec3(0.0f)
11 | ):
12 | Sprite(fn, resources, profile->config()->at("actor"), pos),
13 | m_HP(100),
14 | m_MaxHP(100),
15 | m_Armor(0),
16 | m_MaxArmor(0),
17 | m_Skin(profile->config()->at("actor")),
18 | m_pSession(session),
19 | m_pProfile(profile),
20 | //m_pController(profile->controller().get()),
21 | m_pResources(resources)
22 | {
23 | auto cfg = make_shared(
24 | m_pResources->transform("weapons.json")
25 | );
26 | for(auto&& e: *cfg)
27 | {
28 | auto wpn = e.as>();
29 | m_Weapons.emplace_back(
30 | e.key,
31 | wpn->at("ammo-type"),
32 | wpn->at("gfx"),
33 | make_shared(wpn->at("ammo")),
34 | wpn->at("in-clip"),
35 | wpn->at("clip-capacity"),
36 | wpn->at("chamber"),
37 | wpn->at("range"),
38 | wpn->at("fire-speed"),
39 | wpn->at("reload-speed"),
40 | wpn->at("bullet-speed"),
41 | wpn->at("accuracy")
42 | );
43 | }
44 |
45 | m_Weapon.on_change.connect([this](const int&){
46 | if(m_Weapons.empty()){
47 | m_Ammo = 0;
48 | return;
49 | }
50 | m_Ammo = m_Weapons[m_Weapon].ammo();
51 | });
52 | set_states({"stand","down"});
53 | m_Dead.on_change.connect([this](const bool& b){
54 | if(b)
55 | set_states({"death"});
56 | });
57 | }
58 |
59 | void Character :: logic_self(Freq::Time t)
60 | {
61 | Sprite::logic_self(t);
62 | for(auto& w: m_Weapons)
63 | w.logic(t);
64 | }
65 |
66 | bool Character :: indoors(bool b)
67 | {
68 | //if(m_bIndoors == b)
69 | // return false;
70 |
71 | m_Indoors += b?1:-1;
72 | return m_Indoors;
73 |
74 | //bool clean = true;
75 | //for(auto&& c: m_Cameras) {
76 | // auto cam = c.lock();
77 | // if(not cam) {
78 | // clean = false;
79 | // continue;
80 | // }
81 | // cam->range(
82 | // -(b ? position().z: 100.0f),
83 | // 100.0f
84 | // );
85 | //}
86 | //if(not clean)
87 | // kit::remove_if(m_Cameras, [](weak_ptr cam){
88 | // return not cam.lock();
89 | // });
90 | }
91 |
92 | void Character :: add_camera(std::weak_ptr camera)
93 | {
94 | m_Cameras.push_back(camera);
95 | kit::remove_if(m_Cameras, [](weak_ptr const& cam){
96 | return not cam.lock();
97 | });
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/src/Character.h:
--------------------------------------------------------------------------------
1 | #ifndef PLAYER_H_R0CEOUXE
2 | #define PLAYER_H_R0CEOUXE
3 |
4 | #include
5 | #include "Qor/kit/cache/cache.h"
6 | #include "Qor/Sprite.h"
7 | #include "Qor/Session.h"
8 | #include "Qor/Profile.h"
9 | #include "Qor/Session.h"
10 | #include "Weapon.h"
11 | #include "Qor/kit/reactive/reactive.h"
12 |
13 | class Character:
14 | public Sprite
15 | {
16 | public:
17 |
18 | Character(
19 | Session* session,
20 | Profile* profile,
21 | const std::string& fn,
22 | Cache* resources,
23 | glm::vec3 pos
24 | );
25 | virtual ~Character() {}
26 |
27 | virtual void logic_self(Freq::Time t) override;
28 |
29 | void set_direction(glm::vec2 dir) {
30 | m_Dir = dir;
31 | }
32 |
33 | int clip() const {
34 | return weapon() ? weapon()->clip() : 0;
35 | }
36 | int ammo() const {
37 | return weapon() ? weapon()->ammo() : 0;
38 | }
39 | int clip_size() const {
40 | return weapon() ? weapon()->clip_size() : 0;
41 | }
42 | bool reload() {
43 | if(weapon())
44 | return weapon()->reload();
45 | return false;
46 | }
47 |
48 | void clip(int a) {
49 | if(weapon())
50 | weapon()->clip(a);
51 | }
52 |
53 | int hp() const {
54 | return m_HP;
55 | }
56 | void hp(int a) {
57 | m_HP = std::min(m_HP+a, m_MaxHP);
58 | }
59 | bool heal() {
60 | if(m_HP < m_MaxHP){
61 | m_HP = m_MaxHP;
62 | return true;
63 | }
64 | return false;
65 | }
66 | bool heal(int hp) {
67 | if(hp >= 0 && m_HP == m_MaxHP)
68 | return false;
69 | m_HP = std::min(m_HP+hp, m_MaxHP);
70 | if(m_HP <= 0) {
71 | m_HP = std::max(m_HP, 0);
72 | m_Dead = true;
73 | return false;
74 | }
75 | return true;
76 | }
77 | bool damage(int hp) { return heal(-hp); }
78 |
79 | int hp_percent() {
80 | // dont round
81 | return (
82 | (m_MaxHP ? (m_HP*1.0f) / (m_MaxHP*1.0f) : 0) +
83 | (m_MaxArmor ? (m_Armor*1.0f) / (m_MaxArmor*1.0f) : 0)
84 | ) * 100.0f;
85 | }
86 |
87 | int max_hp() const {
88 | return m_MaxHP;
89 | }
90 | void max_hp(int a) {
91 | m_MaxHP = a;
92 | }
93 |
94 | Weapon* weapon() {
95 | assert(m_Weapon < m_Weapons.size());
96 | if(!m_Weapons.empty())
97 | return &m_Weapons[m_Weapon];
98 | assert(false);
99 | return nullptr;
100 | }
101 | const Weapon* weapon() const {
102 | return const_cast(this)->weapon();
103 | }
104 |
105 | bool switch_weapon(int idx) {
106 | int old_idx = m_Weapon;
107 | m_Weapon = kit::mod(
108 | m_Weapon + idx, m_Weapons.size()
109 | );
110 | return idx == old_idx;
111 | }
112 |
113 | int shoot() {
114 | if(weapon())
115 | return weapon()->shoot();
116 | return 0;
117 | }
118 |
119 | bool indoors() const { return m_Indoors; }
120 |
121 | bool indoors(bool b);
122 |
123 | void add_camera(std::weak_ptr camera);
124 |
125 | bool alive() const { return not m_Dead; }
126 | bool dead() const { return m_Dead; }
127 |
128 | KIT_REACTIVE_SIGNAL(on_hp_change, m_HP)
129 | KIT_REACTIVE_SIGNAL(on_weapon_change, m_Weapon)
130 | KIT_REACTIVE_SIGNAL(on_ammo_change, m_Ammo)
131 |
132 | KIT_REACTIVE_SIGNAL(on_speak, m_Speak)
133 | KIT_REACTIVE_SIGNAL(on_death, m_Dead)
134 |
135 | void say(std::string msg) {
136 | m_Speak = msg; // reactive
137 | }
138 | bool give(std::string id) {
139 | if(not kit::has(m_Items, id)){
140 | m_Items.push_back(id);
141 | return true;
142 | }
143 | return false;
144 | }
145 | bool has(std::string id) const {
146 | return kit::has(m_Items, id);
147 | }
148 | std::string skin() const {
149 | return m_Skin;
150 | }
151 |
152 | private:
153 |
154 | kit::reactive m_Speak;
155 |
156 | kit::reactive m_Dead = false;
157 | kit::reactive m_HP;
158 | int m_MaxHP;
159 | kit::reactive m_Ammo; // current weapon ammo
160 | kit::reactive m_Armor;
161 | int m_MaxArmor;
162 | int m_Indoors = 0;
163 |
164 | std::vector m_Weapons;
165 | std::vector m_Items;
166 | kit::reactive m_Weapon = 0;
167 |
168 | std::string m_Skin;
169 | Session* m_pSession = nullptr;
170 | Profile* m_pProfile = nullptr;
171 | Controller* m_pController = nullptr;
172 | Cache* m_pResources = nullptr;
173 |
174 | glm::vec2 m_Dir;
175 |
176 | std::vector> m_Cameras;
177 | };
178 |
179 | #endif
180 |
181 |
--------------------------------------------------------------------------------
/src/CharacterInterface.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "CharacterInterface.h"
3 | #include "Qor/Sound.h"
4 | #include
5 | #include "World.h"
6 | using namespace std;
7 | using namespace glm;
8 |
9 | CharacterInterface :: CharacterInterface(
10 | const shared_ptr& input,
11 | const shared_ptr& character,
12 | World* world,
13 | Cache* resources
14 | ):
15 | NodeInterface(input, character),
16 | m_pWorld(world),
17 | m_pResources(resources)
18 | {
19 | lock_sprite();
20 | BOOST_SCOPE_EXIT(this_) {
21 | this_->unlock_sprite();
22 | } BOOST_SCOPE_EXIT_END
23 |
24 | m_ButtonNames = {
25 | "up",
26 | "down",
27 | "left",
28 | "right",
29 |
30 | "shoot",
31 | "sprint",
32 | "action",
33 | "strafe",
34 | "reload",
35 | "previous_weapon",
36 | "next_weapon"
37 | };
38 |
39 | m_StateNames = {
40 | "up",
41 | "down",
42 | "left",
43 | "right",
44 |
45 | "stand",
46 | "walk",
47 |
48 | "death"
49 | };
50 |
51 | for(unsigned int i=0; i<(unsigned int)Button::MAX; ++i)
52 | try{
53 | m_Buttons[i] = input->button_id(m_ButtonNames[i]);
54 | }catch(const out_of_range&){
55 | m_Buttons[i] = numeric_limits::max();
56 | }
57 | for(unsigned int i=0; i<(unsigned int)State::MAX; ++i)
58 | try{
59 | m_States[i] = m_pCharacter->state_id(m_StateNames[i]);
60 | }catch(const out_of_range&){
61 | m_States[i] = numeric_limits::max();
62 | }
63 |
64 | set_state(State::STAND);
65 | set_state(State::DOWN);
66 |
67 | auto crosshair = make_shared(
68 | resources->transform("arrow.png"),
69 | resources,
70 | "", // no skin
71 | vec3(0.0f, 0.0f, 10.0f)
72 | );
73 | crosshair->mesh()->offset(vec3(0.0f, -m_fCrosshairDist, 0.0f));
74 | m_pCharacter->add(crosshair);
75 | crosshair->each([](Node* n){
76 | n->layer(World::INDICATOR);
77 | }, Node::Each::RECURSIVE | Node::Each::INCLUDE_SELF);
78 |
79 | m_pCrosshair = crosshair;
80 |
81 | m_vDir = vec2(0.0f, 1.0f);
82 | m_CrosshairEase.stop(Angle::degrees(180));
83 | }
84 |
85 | void CharacterInterface :: event()
86 | {
87 | lock_input();
88 | BOOST_SCOPE_EXIT_ALL(this) {
89 | unlock_input();
90 | };
91 | lock_sprite();
92 | BOOST_SCOPE_EXIT_ALL(this) {
93 | unlock_sprite();
94 | };
95 |
96 | if(m_pCharacter->dead()) // block control on death
97 | {
98 | m_pCharacter->velocity(glm::vec3(0.0f));
99 | return;
100 | }
101 |
102 | auto crosshair = m_pCrosshair.lock();
103 | assert(crosshair);
104 |
105 | const bool strafe = button(Button::STRAFE);
106 |
107 | m_vMove = vec2(0.0f);
108 | if(button(Button::LEFT))
109 | m_vMove += vec2(-button(Button::LEFT).pressure(), 0.0f);
110 | if(button(Button::RIGHT))
111 | m_vMove += vec2(button(Button::RIGHT).pressure(), 0.0f);
112 | if(button(Button::UP))
113 | m_vMove += vec2(0.0f, -button(Button::UP).pressure());
114 | if(button(Button::DOWN))
115 | m_vMove += vec2(0.0f, button(Button::DOWN).pressure());
116 |
117 | if(m_vMove != vec2())
118 | m_vMove = glm::normalize(m_vMove);
119 |
120 | if(!strafe)
121 | {
122 | m_CrosshairEase.resume();
123 |
124 | if(m_vMove != vec2())
125 | {
126 | vec2 old_dir = m_vDir;
127 | m_vDir = normalize(m_vMove);
128 |
129 | Angle a(angle(old_dir, m_vDir), Angle::RADIANS);
130 | if(fabs(a.degrees()) > K_EPSILON)
131 | {
132 | //auto atest = orientedAngle(
133 | // vec2(m_vDir.x, -m_vDir.y),
134 | // vec2(0.0f, 1.0f)
135 | //);
136 | //LOGf("atest: %s", atest);
137 | m_CrosshairEase.stop(
138 | Angle::radians(
139 | orientedAngle(
140 | vec2(m_vDir.x, -m_vDir.y),
141 | vec2(0.0f, 1.0f)
142 | )
143 | ),
144 | Freq::Time(100),
145 | //Freq::Time((fabs(a.degrees()) > 90.0f + K_EPSILON) ? 0 : 100),
146 | INTERPOLATE(linear)
147 | //[](const Angle& a, const Angle& b, float t){
148 | // return a + (b-a)*t;
149 | //}
150 | );
151 | }
152 | }
153 |
154 | // TODO: get direction from crosshair angle
155 | if(fabs(m_vDir.y) > K_EPSILON)
156 | set_state(m_vDir.y > 0.0f ? State::DOWN : State::UP);
157 | else if(fabs(m_vDir.x) > K_EPSILON)
158 | set_state(m_vDir.x > 0.0f ? State::RIGHT: State::LEFT);
159 | }
160 | else
161 | {
162 | m_CrosshairEase.pause();
163 | }
164 |
165 | //crosshair->reset_orientation();
166 | //*crosshair->matrix() = rotate(mat4(),
167 | // orientedAngle(
168 | // vec2(m_vDir.x, -m_vDir.y), vec2(0.0f, 1.0f)
169 | // ),
170 | // Axis::Z
171 | //);
172 |
173 | m_fSpeed = m_fWalkSpeed * std::max(
174 | std::max(button(Button::LEFT).pressure(), button(Button::RIGHT).pressure()),
175 | std::max(button(Button::UP).pressure(), button(Button::DOWN).pressure())
176 | );
177 | if(button(Button::SPRINT) && !strafe)
178 | {
179 | m_fSpeed = m_fWalkSpeed * m_fSprintMult;
180 | m_pCharacter->speed(m_fSprintMult);
181 | }
182 | else
183 | {
184 | m_pCharacter->resume();
185 | }
186 |
187 | set_state(length(m_vMove) > K_EPSILON ? State::WALK : State::STAND);
188 |
189 | if(button(Button::PREVIOUS_WEAPON).pressed_now())
190 | m_pCharacter->switch_weapon(-1);
191 | if(button(Button::NEXT_WEAPON).pressed_now())
192 | m_pCharacter->switch_weapon(1);
193 | }
194 |
195 | void CharacterInterface :: logic(Freq::Time t)
196 | {
197 | lock_sprite();
198 | BOOST_SCOPE_EXIT_ALL(this) {
199 | unlock_sprite();
200 | };
201 | lock_input();
202 | BOOST_SCOPE_EXIT_ALL(this) {
203 | unlock_input();
204 | };
205 |
206 | if(m_pCharacter->dead()) // block control on death
207 | return;
208 |
209 | m_CrosshairEase.logic(t);
210 | auto crosshair = m_pCrosshair.lock();
211 | assert(crosshair);
212 | //*crosshair->matrix() = m_CrosshairEase.get();
213 |
214 | crosshair->reset_orientation();
215 | glm::vec3 pos = Matrix::translation(*crosshair->matrix());
216 |
217 | *crosshair->matrix() = glm::rotate(m_CrosshairEase.get().radians(), Axis::Z);
218 | //crosshair->pend(); // will pend below
219 | crosshair->position(pos);
220 |
221 | //if(length(m_vMove) > K_EPSILON)
222 | m_pCharacter->velocity(vec3(m_vMove * m_fSpeed, 0.0f));
223 |
224 | //if(!m_pCharacter->clip())
225 | // reload();
226 |
227 | if(button(Button::RELOAD).pressed())
228 | reload();
229 |
230 | if(m_pCharacter->weapon() && !m_pCharacter->weapon()->delayed() && button(Button::SHOOT).pressed())
231 | {
232 | if(m_pCharacter->clip())
233 | {
234 | unsigned num_bullets = m_pCharacter->shoot();
235 |
236 | if(num_bullets)
237 | {
238 | auto bulletsound = make_shared(
239 | m_pResources->transform(m_pCharacter->weapon()->name() + ".wav"),
240 | m_pResources
241 | );
242 | m_pCharacter->add(bulletsound);
243 | bulletsound->play();
244 | auto bulletsoundptr = bulletsound.get();
245 | bulletsound->on_tick.connect([bulletsoundptr](Freq::Time){
246 | if(not bulletsoundptr->source()->playing())
247 | bulletsoundptr->detach();
248 | });
249 | }
250 |
251 | auto path = m_pResources->transform(m_pCharacter->weapon()->bullet_gfx() + ".png");
252 | for(unsigned i=0; i(path, m_pResources);
255 | float vary = (rand() % (1+kit::round_int((1.0f - m_pCharacter->weapon()->accuracy()) * 45.0f))) * 1.0f;
256 | vary *= (rand() % 2) ? 1.0f : -1.0f;
257 | auto dir = (m_CrosshairEase.get() - Angle(90.0f + vary, Angle::DEGREES)).vector();
258 | auto bulletptr = bullet.get();
259 | auto range = make_shared(m_pCharacter->weapon()->range());
260 | auto bullet_speed = m_pCharacter->weapon()->bullet_speed();
261 | bullet->on_tick.connect([bulletptr, dir, range, bullet_speed, vary] (Freq::Time t){
262 | bulletptr->move(vec3(
263 | dir.x * bullet_speed * t.s(),
264 | dir.y * bullet_speed * t.s(),
265 | 0.0f
266 | ));
267 | *range -= t.s() * bullet_speed;
268 | if(*range <= 0.0f)
269 | bulletptr->detach();
270 | });
271 | crosshair->add(bullet);
272 | bullet->position(glm::vec3(0.0f, 0.0f, 0.0f));
273 | bullet->collapse(); // collapse to player
274 | bullet->collapse(); // collapse to root / map
275 | auto bpos = bullet->position();
276 | bullet->position(glm::vec3(
277 | bpos.x, bpos.y, m_pCharacter->position().z + 0.25f
278 | ));
279 | m_pWorld->setup_bullet(bullet);
280 | }
281 | }else{
282 | reload();
283 | }
284 | }
285 | }
286 |
287 | void CharacterInterface :: reload()
288 | {
289 | if(m_pCharacter->reload())
290 | {
291 | auto sound = make_shared(
292 | "reload.wav",
293 | m_pResources
294 | );
295 | m_pCharacter->add(sound);
296 | sound->play();
297 | auto soundptr = sound.get();
298 | sound->on_tick.connect([soundptr](Freq::Time){
299 | if(not soundptr->source()->playing())
300 | soundptr->detach();
301 | });
302 | }
303 | }
304 |
305 |
--------------------------------------------------------------------------------
/src/CharacterInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef _QORPSEINTERFACE_H_W5TRRMBU
2 | #define _QORPSEINTERFACE_H_W5TRRMBU
3 |
4 | #include
5 | #include
6 | #include
7 | #include "Qor/kit/cache/cache.h"
8 | #include "Qor/NodeInterface.h"
9 | #include "Qor/Input.h"
10 | #include "Qor/Sprite.h"
11 | #include "Qor/kit/freq/animation.h"
12 | #include "Character.h"
13 | class World;
14 |
15 | class CharacterInterface:
16 | public NodeInterface,
17 | public std::enable_shared_from_this
18 | {
19 | public:
20 |
21 | enum class Button: unsigned int
22 | {
23 | UP,
24 | DOWN,
25 | LEFT,
26 | RIGHT,
27 |
28 | SHOOT,
29 | SPRINT,
30 | ACTION,
31 | STRAFE,
32 | RELOAD,
33 | PREVIOUS_WEAPON,
34 | NEXT_WEAPON,
35 |
36 | MAX,
37 |
38 | };
39 |
40 | enum class State: unsigned int
41 | {
42 | UP,
43 | DOWN,
44 | LEFT,
45 | RIGHT,
46 |
47 | STAND,
48 | WALK,
49 |
50 | DEAD,
51 |
52 | MAX
53 | };
54 |
55 | CharacterInterface(
56 | const std::shared_ptr& input,
57 | const std::shared_ptr& character,
58 | World* world,
59 | Cache* resources
60 | );
61 | virtual ~CharacterInterface() {}
62 |
63 | virtual void event() override;
64 | virtual void logic(Freq::Time t) override;
65 |
66 | const Input::Switch& button(
67 | Button btn
68 | ){
69 | assert(m_pInput); // should be locked
70 |
71 | try{
72 | unsigned int idx = m_Buttons.at((unsigned int)btn);
73 | if(idx != std::numeric_limits::max())
74 | return m_pInput->button(idx);
75 | }catch(const std::out_of_range&){}
76 |
77 | return m_pInput->input()->dummy_switch();
78 | }
79 |
80 | void set_state(State state) {
81 | assert(m_pCharacter);
82 | unsigned int idx = m_States.at((unsigned int)state);
83 | assert(idx != std::numeric_limits::max());
84 | m_pCharacter->set_state(idx);
85 | }
86 |
87 | /*
88 | * Turns NodeInterface's controller() weak_ptr into m_pInput
89 | */
90 | void lock_input() { m_pInput = controller(); }
91 | void unlock_input() { m_pInput.reset(); }
92 | void lock_sprite() { m_pCharacter= std::static_pointer_cast(node()); }
93 | void unlock_sprite() { m_pCharacter.reset(); }
94 |
95 | /*
96 | * Make sure Input can call this interface's logic
97 | *
98 | * Warning: can't do this in constructor, so we do it on the fly
99 | */
100 | void plug() {
101 | if(!m_InterfaceID)
102 | m_InterfaceID = controller()->add_interface(
103 | std::static_pointer_cast(
104 | shared_from_this()
105 | )
106 | );
107 | }
108 | /*
109 | * Manually unplugs interface from input system
110 | *
111 | * This does not need to be called since Input system's weak_ptr's
112 | * will allow Interfaces that go out of scope to auto-unplug
113 | */
114 | void unplug() {
115 | if(m_InterfaceID)
116 | {
117 | controller()->remove_interface(
118 | *m_InterfaceID
119 | );
120 | m_InterfaceID = boost::optional();
121 | }
122 | }
123 |
124 | std::shared_ptr character() {
125 | return std::static_pointer_cast(node());
126 | }
127 |
128 | std::shared_ptr crosshair() {
129 | return m_pCrosshair.lock();
130 | }
131 |
132 | glm::vec2 direction() const {
133 | return m_vDir;
134 | }
135 |
136 | void reload();
137 |
138 | private:
139 |
140 | World* m_pWorld;
141 |
142 | std::shared_ptr m_pInput;
143 | std::shared_ptr m_pCharacter;
144 |
145 | std::array m_Buttons;
146 | std::array m_States;
147 | std::vector m_ButtonNames;
148 | std::vector m_StateNames;
149 |
150 | glm::vec2 m_vMove;
151 | glm::vec2 m_vDir;
152 |
153 | float m_fSprintMult = 1.5f;
154 | float m_fWalkSpeed = 100.0f;
155 | float m_fSpeed = 100.0f;
156 | float m_fCrosshairDist = 32.0f;
157 |
158 | Animation m_CrosshairEase;
159 | std::weak_ptr m_pCrosshair;
160 | boost::optional m_InterfaceID;
161 |
162 | Cache* m_pResources;
163 |
164 | };
165 |
166 | #endif
167 |
168 |
--------------------------------------------------------------------------------
/src/HUD.cpp:
--------------------------------------------------------------------------------
1 | #include "HUD.h"
2 | #include
3 | #include
4 | using namespace std;
5 | using namespace glm;
6 |
7 | HUD :: HUD(Window* win, const std::shared_ptr& character):
8 | m_pWindow(win),
9 | m_pCanvas(make_shared