Compare commits
466 Commits
69ce48a8b9
...
tools
| Author | SHA1 | Date | |
|---|---|---|---|
| 88903fee94 | |||
| 1e8311fc04 | |||
| 2b78370cb8 | |||
| 8f78bba9e9 | |||
| 41a4be678e | |||
| 8b2b4b7c3d | |||
| 1f3a29f89d | |||
| c4c93097cd | |||
| eedb7769e6 | |||
| 98db62a4bc | |||
| df48c8e500 | |||
| db9cc0f4c6 | |||
| a79ee429b4 | |||
| 6acfca6d48 | |||
| 1cd6f4cb72 | |||
| 3271e8c7d6 | |||
| 0bcde064af | |||
| 957980b3c5 | |||
| 03eb328d81 | |||
| e1716a741f | |||
| e24707c847 | |||
| 7c4b8c307f | |||
| 109318aeaf | |||
| 1f2657cea0 | |||
| 382c435bac | |||
| 130fe4ca5d | |||
| 31ba3fe127 | |||
| f68b31158f | |||
| 653ca9a72d | |||
| ba7857f4df | |||
| 23e617ea21 | |||
| cdf5a5229c | |||
| f841a35a53 | |||
| efd31237be | |||
| 6502822583 | |||
| a9e6f2b2a5 | |||
| 510a94b42c | |||
| d805be47ce | |||
| f9ea8e380a | |||
| 5cb05beb30 | |||
| 677768e6ab | |||
| ed6c951783 | |||
| 54254348b8 | |||
| 782fd07a8d | |||
| a8fd55cb38 | |||
| d7f515575a | |||
| bafbf2ec2f | |||
| 7415944e0a | |||
| 1ff990ff44 | |||
| 73e73d8772 | |||
| 6d876bb767 | |||
| 2be0fe9f06 | |||
| e1fb082927 | |||
| 65ca5ae4c4 | |||
| 2cea43dc70 | |||
| 44a0700800 | |||
| 1613a378f1 | |||
| deed98a27d | |||
| 9d0cb8fb46 | |||
| d8fe0f6923 | |||
| 581dbc2b3c | |||
| 7301d2ad76 | |||
| 3232a14d1d | |||
| 84c1f88d42 | |||
| 3695b10e4b | |||
| 6da02b25fa | |||
| 3bc544fba1 | |||
| 368d370f49 | |||
| bb29c0edef | |||
| 6edcf75a0c | |||
| 31cc186424 | |||
| 0e94c1fa6d | |||
| 6d9e2dd3e1 | |||
| 4a4adeb3c8 | |||
| ff77f8cfa0 | |||
| 36db89c36e | |||
| a9948142ad | |||
| 8d05510584 | |||
| d373de7a29 | |||
| 1efa9a9f7b | |||
| 0fb3ba2f91 | |||
| 3b4c5b5153 | |||
| 9293aeeec8 | |||
| 03ae83b119 | |||
| abd63cc6cf | |||
| 2e43aa2c44 | |||
| 3d984e13c2 | |||
| 010900fe21 | |||
| ffed626447 | |||
| 61f69af35a | |||
| bd248ee91c | |||
| 194255bffe | |||
| 52ee627079 | |||
| bd4200e707 | |||
| 73e7d6c7f3 | |||
| a41b0e916b | |||
| 19f2a2c616 | |||
| 998601f722 | |||
| 7c3386cf3e | |||
| d161182997 | |||
| 1646dc2dbd | |||
| b640295be2 | |||
| b89ae2391b | |||
| a0fad441d0 | |||
| 340084dac3 | |||
| c78135aa09 | |||
| d19f8bbd30 | |||
| 4205899f5a | |||
| 7dd3940770 | |||
| 00d94e3015 | |||
| 7bacb3ee2b | |||
| 8e49be5ac4 | |||
| 3b94598d2c | |||
| bddc9af3b6 | |||
| 2451d73a7c | |||
| 1dd2efa182 | |||
| acea610773 | |||
| 8f2f1fd496 | |||
| 39c775872a | |||
| bdb3cbd109 | |||
| ff84ce2b04 | |||
| 225f405592 | |||
| 715ecffa18 | |||
| e51cdc8992 | |||
| 133685ea37 | |||
| 6aff98d555 | |||
| acdc524284 | |||
| 1ee5ec7b43 | |||
| 46a5403511 | |||
| 87bfb92576 | |||
| c7a3e5601c | |||
| 4009130f6e | |||
| c91243f6e9 | |||
| 0e3871ac26 | |||
| 55baafec8a | |||
| b5a66993ca | |||
| 0b570b5fd6 | |||
| 378227c377 | |||
| 650645eaff | |||
| 62c71f3fe6 | |||
| 041ec3d710 | |||
| 5f2d871bad | |||
| a30b151e4d | |||
| 5a651d2d1f | |||
| 4b3826edd9 | |||
| bae1ff3759 | |||
| fd82486431 | |||
| c9cd91cbd8 | |||
| c8abd374fe | |||
| 2b9ee8f721 | |||
| d02673e04a | |||
| f0117b8e6e | |||
| bb7c41c754 | |||
| efa583c154 | |||
| d16ea13c14 | |||
| 673d8e0a18 | |||
| 37cfdde1ee | |||
| 0778ffb57a | |||
| 42099f7241 | |||
| c52e1d22b7 | |||
| 0d7b0aadd1 | |||
| 4cd3355ef1 | |||
| 98d70b96d1 | |||
| 64735bdf43 | |||
| 7b87347b77 | |||
| b5b29d7061 | |||
| 9ec21f85a0 | |||
| da1a5a3f1b | |||
| 0885da8d44 | |||
| 8af961c6d3 | |||
| ef5febdde3 | |||
| 6d7fbd3926 | |||
| 2680d373d8 | |||
| 2b2ddb3cf2 | |||
| 85ff95296b | |||
| 314a2de41a | |||
| 26fafab47a | |||
| e56ff20e2d | |||
| 55d44f229d | |||
| 1c5e50cc4d | |||
| ea898da6c2 | |||
| dbb7e9f53c | |||
| cbb68a399d | |||
| 0e794f28b1 | |||
| 87d2d9123e | |||
| 6823a4ddb5 | |||
| 20a7c70081 | |||
| 9caa33b3bb | |||
| 2d7e61460a | |||
| a4b7fb3f44 | |||
| 70056cf4ca | |||
| 5f4ab71ade | |||
| f3adb3257b | |||
| 438edda7fd | |||
| d5b0441e6f | |||
| 9ba0ceb000 | |||
| 9474a68995 | |||
| 09c35f0aa6 | |||
| a2113442cb | |||
| d91808487f | |||
| 933949cc19 | |||
| 407620387d | |||
| 98947dea26 | |||
| ebff7af9b5 | |||
| b23c4b83ae | |||
| c0cff40628 | |||
| 97513e354c | |||
| c277ae7aff | |||
| e1835e6282 | |||
| 5ac21db997 | |||
| ca0e9fc3b2 | |||
| 66ebcb1608 | |||
| ff92a78dda | |||
| 7356286fe0 | |||
| 54e8e68f86 | |||
| d21cd7f78b | |||
| 1d7516982a | |||
| c77a11442c | |||
| 5bd43a4643 | |||
| 9b87dfa1a9 | |||
| 2e3173ea40 | |||
| 68eac7cf83 | |||
| 6709505630 | |||
| af6e962a5d | |||
| 18e6bdabaa | |||
| 9743942eae | |||
| 23062137a8 | |||
| 46f7fb5ccd | |||
| 9c90c49a6b | |||
| 4517b63557 | |||
| 58c239f4b4 | |||
| cc8845ba3e | |||
| 6b69ce2901 | |||
| 55300ed21c | |||
| 7346dd4339 | |||
| 2caf3b92ce | |||
| af2cd72a1f | |||
| 3d455ec1f8 | |||
| 15982d7735 | |||
| 5ae3542bd9 | |||
| b1b02ae24b | |||
| f0964e2c92 | |||
| e9661d2998 | |||
| ea6468f2a9 | |||
| a2b38d3b83 | |||
| d67ef02941 | |||
| 549ebe25d8 | |||
| 9a98348582 | |||
| c5f5b025a6 | |||
| 23eaffa3a7 | |||
| c161809248 | |||
| 4bf26dc818 | |||
| 5dd22fad6c | |||
| 2c3fdf7803 | |||
| e984b9f5d7 | |||
| a3c2e37b17 | |||
| edf1b5a0a3 | |||
| 8efdf59ebd | |||
| 5c4537b2fa | |||
| 71e6079054 | |||
| dd048d9b0d | |||
| 93074d653e | |||
| 9139c4350a | |||
| 38ce768168 | |||
| 82b3dc576c | |||
| 2167889f48 | |||
| e9b02c2acf | |||
| 9ee446431b | |||
| df106e3988 | |||
| d0a057e0ee | |||
| 8b49902bf6 | |||
| 71c1e56564 | |||
| 1b12e67de2 | |||
| 291bb4bb81 | |||
| 342ddb19f8 | |||
| 9c9d2d548e | |||
| d7a0bb4509 | |||
| 2b1a3323a8 | |||
| 99d030003c | |||
| 92a753560b | |||
| af9904c892 | |||
| e5e8c49f6c | |||
| b37e5f45ca | |||
| e1f08b07aa | |||
| 073ee8dca9 | |||
| a26e51cf46 | |||
| dfed732825 | |||
| 87aa70c6d2 | |||
| aa2979ffe7 | |||
| 236e16aa6d | |||
| 184bb970e6 | |||
| bd54469891 | |||
| 2f5dccc3ef | |||
| 592edb90a0 | |||
| 3db7e6b1b9 | |||
| 13c4df0d85 | |||
| ef25fb09da | |||
| 03cf4a9efe | |||
| 53dd36efdd | |||
| ad9e841a42 | |||
| 14f3f464c7 | |||
| cbe51cc8d0 | |||
| efaa3f6eea | |||
| 52cce9a3b0 | |||
| b7b390311e | |||
| c1eeddd14b | |||
| 1a7a55dfc3 | |||
| fe5927ea6a | |||
| 119c794ad7 | |||
| e2076b2c1c | |||
| 5208c5148e | |||
| d80660b097 | |||
| b916d0278b | |||
| d51e13e620 | |||
| 40ad4326ef | |||
| b8afc1684a | |||
| 8348b31ac8 | |||
| 411f2dbcce | |||
| ee89c08160 | |||
| 357607a89f | |||
| 8d6dc2df44 | |||
| 5207582ab3 | |||
| 71768e6154 | |||
| ecbe235523 | |||
| afef079d1e | |||
| df17696c69 | |||
| 065bf0908f | |||
| 5b6755e9cf | |||
| b08482acf1 | |||
| 80c9c1d389 | |||
| bb7db57bda | |||
| 6a83ac767c | |||
| 7e47ef9d74 | |||
| e7ec603526 | |||
| 2d8ae09bd8 | |||
| b2affbc0a7 | |||
| d50bc61ada | |||
| ec6b032b45 | |||
| bc72f48496 | |||
| dcf06fbd36 | |||
| 96311d72c2 | |||
| 07938cccc7 | |||
| 097c8c00f9 | |||
| aa5b41fe31 | |||
| 0d56859d94 | |||
| 1af5f238e4 | |||
| dd697d5650 | |||
| 5cf299a1c7 | |||
| 67bf825cc9 | |||
| 56e1696cd4 | |||
| d955fb6430 | |||
| dd910a31aa | |||
| 708c4d0ec3 | |||
| ad13d6c6a1 | |||
| 1c32158142 | |||
| 5cea284906 | |||
| 13dba8b604 | |||
| 22398ddcef | |||
| 94e2cc6210 | |||
| da3513f63d | |||
| 2c83e4ba9f | |||
| c862071126 | |||
| fed819e9b2 | |||
| c6f4518684 | |||
| 053778a502 | |||
| 78e1ae885a | |||
| 982d28a3e0 | |||
| c2cad858a5 | |||
| 794e0574ad | |||
| c190271565 | |||
| ae8a869f64 | |||
| 69d64eb8e4 | |||
| b2f2df650a | |||
| 6af570fab2 | |||
| 9ed902017c | |||
| 32b41c98e1 | |||
| 6bdb4ae30d | |||
| 25dc97e3cc | |||
| cc85983736 | |||
| 6e78ee188d | |||
| 9b73f1717f | |||
| c7b9a53535 | |||
| 2b9be6675c | |||
| fb93453482 | |||
| 81b08b2eba | |||
| d1b03c4cb3 | |||
| 9544d15a18 | |||
| 0392dd0e7f | |||
| 9c25fde548 | |||
| 2c9d0c6cff | |||
| 9897dbe031 | |||
| e78f117cfd | |||
| 07afc3813a | |||
| d788de8637 | |||
| d749ac8a91 | |||
| f71c271c97 | |||
| e1d7b7308f | |||
| 26a71a823a | |||
| 5e39097faa | |||
| 0df7845f2c | |||
| af5bf987c8 | |||
| 024ace1078 | |||
| 8d00fe9d16 | |||
| ab422b14dd | |||
| 95c0690216 | |||
| 6cb80e9e23 | |||
| 83b799caa8 | |||
| a793ac2ff7 | |||
| aec937b04b | |||
| 8ee46fd204 | |||
| 726233e55f | |||
| 7940f4c487 | |||
| b16dbaceec | |||
| f39b2060a8 | |||
| aed202ebf9 | |||
| a495179e5f | |||
| 4e1b404820 | |||
| 8c74ee31e0 | |||
| 77d3c54ebb | |||
| b5de39926b | |||
| 3a8dafbb91 | |||
| 6b22f547fe | |||
| de78be3e25 | |||
| 9f507be7bc | |||
| 9aaf271996 | |||
| b01c0d37b0 | |||
| 538079880d | |||
| fe0529d021 | |||
| d068f0f2c3 | |||
| f9a64b8d54 | |||
| 01cbfaae95 | |||
| f9006a90d5 | |||
| 7daeaee6b5 | |||
| 03218ce20f | |||
| 6f33522c1c | |||
| 3697cc3eef | |||
| 51a1077fda | |||
| 8740c2b165 | |||
| 6ed2bdd4c5 | |||
| c32df89490 | |||
| bd5a67676b | |||
| 903dab49e3 | |||
| 1668c4b0d2 | |||
| 2179a27bf5 | |||
| 6e7a0cba76 | |||
| 69b37b30bc | |||
| ae941a0fdb | |||
| 1b741a81e5 | |||
| edf321515b | |||
| c874e6c197 | |||
| 9a59c22288 | |||
| 750e8840f0 | |||
| cf59989167 | |||
| 7c194ab4b4 | |||
| be422d0a1e | |||
| 68b63d3007 | |||
| 8525138594 | |||
| 7b9f8b190e | |||
| 67f62daa9f | |||
| 0ec701f30b | |||
| c53439066e | |||
| 7278bd0c6f | |||
| b842e5821a | |||
| f7d4cce485 | |||
| 4f502b707f | |||
| 09f182228f |
@@ -1,82 +0,0 @@
|
|||||||
name: Build Dusk
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev
|
|
||||||
- name: Configure CMake
|
|
||||||
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=linux
|
|
||||||
- name: Build
|
|
||||||
run: cmake --build build -- -j$(nproc)
|
|
||||||
- name: List build output
|
|
||||||
run: ls -lh build
|
|
||||||
- name: Upload Linux binary
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dusk-linux
|
|
||||||
path: build/Dusk
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-psp:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev
|
|
||||||
- name: Configure CMake
|
|
||||||
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=psp
|
|
||||||
- name: Build
|
|
||||||
run: cmake --build build -- -j$(nproc)
|
|
||||||
- name: Move EBOOT.PBP to Dusk subfolder
|
|
||||||
run: |
|
|
||||||
mkdir -p build/gitea/Dusk
|
|
||||||
mv build/EBOOT.PBP build/gitea/Dusk/EBOOT.PBP
|
|
||||||
- name: List build output
|
|
||||||
run: ls -lh build/gitea/Dusk
|
|
||||||
- name: Upload PSP binary
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dusk-psp
|
|
||||||
path: build/gitea/
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- build-linux
|
|
||||||
- build-psp
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
- name: Download Linux binary
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dusk-linux
|
|
||||||
path: ./release-assets/linux
|
|
||||||
- name: Download PSP binary
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dusk-psp
|
|
||||||
path: ./release-assets/psp
|
|
||||||
- name: Create Gitea Release
|
|
||||||
uses: akkuman/gitea-release-action@v1
|
|
||||||
env:
|
|
||||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
||||||
files: ./release-assets/*
|
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
name: Build Dusk
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
run-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Run tests in Docker
|
||||||
|
run: ./scripts/test-linux-docker.sh
|
||||||
|
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build Linux
|
||||||
|
run: ./scripts/build-linux-docker.sh
|
||||||
|
- name: Upload Linux binary
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-linux
|
||||||
|
path: build-linux/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-psp:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build psp
|
||||||
|
run: ./scripts/build-psp-docker.sh
|
||||||
|
- name: Move EBOOT.PBP to Dusk subfolder
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk/PSP/GAME/Dusk
|
||||||
|
cp build-psp/EBOOT.PBP ./git-artifcats/Dusk/PSP/GAME/Dusk/EBOOT.PBP
|
||||||
|
- name: Upload psp binary
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-psp
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# build-vita:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - name: Checkout repository
|
||||||
|
# uses: actions/checkout@v6
|
||||||
|
# - name: Set up Docker
|
||||||
|
# uses: docker/setup-docker-action@v5
|
||||||
|
# - name: Build Vita
|
||||||
|
# run: ./scripts/build-vita-docker.sh
|
||||||
|
# - name: Upload Vita binary
|
||||||
|
# uses: actions/upload-artifact@v6
|
||||||
|
# with:
|
||||||
|
# name: dusk-vita
|
||||||
|
# path: build-vita/Dusk.vpk
|
||||||
|
# if-no-files-found: error
|
||||||
|
|
||||||
|
build-knulli:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build knulli
|
||||||
|
run: ./scripts/build-knulli-docker.sh
|
||||||
|
- name: Move output to Dusk subfolder
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk
|
||||||
|
cp -r build-knulli/dusk ./git-artifcats/Dusk
|
||||||
|
- name: Upload knulli binary
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-knulli
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-gamecube:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build GameCube
|
||||||
|
run: ./scripts/build-gamecube-docker.sh
|
||||||
|
- name: Copy output files.
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk
|
||||||
|
cp build-gamecube/Dusk.dol ./git-artifcats/Dusk/Dusk.dol
|
||||||
|
cp build-gamecube/dusk.dsk ./git-artifcats/Dusk/dusk.dsk
|
||||||
|
- name: Upload GameCube binary
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-gamecube
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-gamecube-iso:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build GameCube ISO
|
||||||
|
run: ./scripts/build-gamecube-iso-docker.sh
|
||||||
|
- name: Copy output files.
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk
|
||||||
|
cp build-gamecube-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso
|
||||||
|
cp build-gamecube-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso
|
||||||
|
cp build-gamecube-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso
|
||||||
|
- name: Upload GameCube ISO
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-gamecube-iso
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-wii:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build Wii
|
||||||
|
run: ./scripts/build-wii-docker.sh
|
||||||
|
- name: Copy output files.
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk/apps/Dusk
|
||||||
|
cp build-wii/Dusk.dol ./git-artifcats/Dusk/apps/Dusk/boot.dol
|
||||||
|
cp build-wii/dusk.dsk ./git-artifcats/Dusk/apps/Dusk/dusk.dsk
|
||||||
|
cp build-wii/meta.xml ./git-artifcats/Dusk/apps/Dusk/meta.xml
|
||||||
|
- name: Upload Wii binary
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-wii
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-wii-iso:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-docker-action@v5
|
||||||
|
- name: Build Wii ISO
|
||||||
|
run: ./scripts/build-wii-iso-docker.sh
|
||||||
|
- name: Copy output files.
|
||||||
|
run: |
|
||||||
|
mkdir -p ./git-artifcats/Dusk
|
||||||
|
cp build-wii-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso
|
||||||
|
cp build-wii-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso
|
||||||
|
cp build-wii-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso
|
||||||
|
- name: Upload Wii ISO
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: dusk-wii-iso
|
||||||
|
path: ./git-artifcats/Dusk
|
||||||
|
if-no-files-found: error
|
||||||
+13
-2
@@ -83,7 +83,6 @@ assets/borrowed
|
|||||||
.VSCode*
|
.VSCode*
|
||||||
|
|
||||||
/vita
|
/vita
|
||||||
|
|
||||||
._*
|
._*
|
||||||
|
|
||||||
*~
|
*~
|
||||||
@@ -94,4 +93,16 @@ assets/borrowed
|
|||||||
/archive1
|
/archive1
|
||||||
# /archive
|
# /archive
|
||||||
|
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
yarn-error.log
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
.editor
|
||||||
|
.venv
|
||||||
|
|
||||||
|
/build2
|
||||||
|
/build*
|
||||||
|
/assets/test
|
||||||
|
/tools_old
|
||||||
+86
-76
@@ -5,14 +5,20 @@
|
|||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
||||||
|
cmake_policy(SET CMP0079 NEW)
|
||||||
|
# set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
|
||||||
|
|
||||||
if(NOT DEFINED DUSK_TARGET_SYSTEM)
|
option(DUSK_BUILD_TESTS "Enable tests" OFF)
|
||||||
set(DUSK_TARGET_SYSTEM "linux")
|
|
||||||
#set(DUSK_TARGET_SYSTEM "psp")
|
# Game identity — override these per-project
|
||||||
endif()
|
set(DUSK_GAME_NAME "Dusk" CACHE STRING "Game display name")
|
||||||
|
set(DUSK_GAME_AUTHOR "YouWish" CACHE STRING "Game author / coder")
|
||||||
|
set(DUSK_GAME_SHORT_DESCRIPTION "Dusk game" CACHE STRING "One-line description")
|
||||||
|
set(DUSK_GAME_LONG_DESCRIPTION "No description yet." CACHE STRING "Full description")
|
||||||
|
|
||||||
# Prep cache
|
# Prep cache
|
||||||
set(DUSK_CACHE_TARGET "dusk-target")
|
set(DUSK_CACHE_TARGET "dusk-target")
|
||||||
@@ -21,101 +27,105 @@ set(DUSK_CACHE_TARGET "dusk-target")
|
|||||||
set(DUSK_ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
set(DUSK_ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
||||||
set(DUSK_BUILD_DIR "${CMAKE_BINARY_DIR}")
|
set(DUSK_BUILD_DIR "${CMAKE_BINARY_DIR}")
|
||||||
set(DUSK_SOURCES_DIR "${DUSK_ROOT_DIR}/src")
|
set(DUSK_SOURCES_DIR "${DUSK_ROOT_DIR}/src")
|
||||||
|
set(DUSK_TEST_DIR "${DUSK_ROOT_DIR}/test")
|
||||||
set(DUSK_TEMP_DIR "${DUSK_BUILD_DIR}/temp")
|
set(DUSK_TEMP_DIR "${DUSK_BUILD_DIR}/temp")
|
||||||
set(DUSK_TOOLS_DIR "${DUSK_ROOT_DIR}/tools")
|
set(DUSK_TOOLS_DIR "${DUSK_ROOT_DIR}/tools")
|
||||||
set(DUSK_DATA_DIR "${DUSK_ROOT_DIR}/data")
|
set(DUSK_DATA_DIR "${DUSK_ROOT_DIR}/data")
|
||||||
set(DUSK_ASSETS_DIR "${DUSK_ROOT_DIR}/assets")
|
set(DUSK_ASSETS_DIR "${DUSK_ROOT_DIR}/assets")
|
||||||
set(DUSK_BUILT_ASSETS_DIR "${DUSK_BUILD_DIR}/built_assets" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_BUILT_ASSETS_DIR "${DUSK_BUILD_DIR}/built_assets" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
set(DUSK_GENERATED_HEADERS_DIR "${DUSK_BUILD_DIR}/generated")
|
set(DUSK_GENERATED_HEADERS_DIR "${DUSK_BUILD_DIR}/generated")
|
||||||
set(DUSK_TARGET_NAME "Dusk" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
|
||||||
set(DUSK_BUILD_BINARY ${DUSK_BUILD_DIR}/Dusk CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_BUILD_BINARY ${DUSK_BUILD_DIR}/Dusk CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
set(DUSK_ASSETS "" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_ASSETS "" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
set(DUSK_LIBRARY_TARGET_NAME "DuskCore" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
set(DUSK_BINARY_TARGET_NAME "Dusk" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
set(DUSK_ASSETS_ZIP "${DUSK_BUILD_DIR}/dusk.dsk" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
|
||||||
|
if(NOT DEFINED DUSK_TARGET_SYSTEM)
|
||||||
|
set(DUSK_TARGET_SYSTEM "linux")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
file(MAKE_DIRECTORY ${DUSK_GENERATED_HEADERS_DIR})
|
file(MAKE_DIRECTORY ${DUSK_GENERATED_HEADERS_DIR})
|
||||||
|
file(MAKE_DIRECTORY ${DUSK_TEMP_DIR})
|
||||||
|
file(MAKE_DIRECTORY ${DUSK_BUILT_ASSETS_DIR})
|
||||||
|
|
||||||
# Find packages
|
# Required build packages
|
||||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||||
|
|
||||||
# Toolchains
|
# Init Project.
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
project(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
find_package(pspsdk REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Init Project
|
|
||||||
project(${DUSK_TARGET_NAME}
|
|
||||||
VERSION 1.0.0
|
VERSION 1.0.0
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
)
|
)
|
||||||
|
|
||||||
# Executable
|
# Either, create library and binary separately (used for tests), or make them
|
||||||
add_executable(${DUSK_TARGET_NAME})
|
# one in the same so all code is in the binary only.
|
||||||
|
# Binary Executable
|
||||||
|
add_executable(${DUSK_BINARY_TARGET_NAME} ${DUSK_SOURCES_DIR}/dusk/null.c)
|
||||||
|
|
||||||
|
if(DUSK_BUILD_TESTS)
|
||||||
|
# MainLibrary
|
||||||
|
add_library(${DUSK_LIBRARY_TARGET_NAME} STATIC)
|
||||||
|
|
||||||
|
# Link library to binary
|
||||||
|
target_link_libraries(${DUSK_BINARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(DUSK_LIBRARY_TARGET_NAME "${DUSK_BINARY_TARGET_NAME}" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED DUSK_VERSION)
|
||||||
|
string(TIMESTAMP DUSK_VERSION "debug-%y%m%d%H%M%S")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Definitions
|
||||||
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
DUSK_TARGET_SYSTEM="${DUSK_TARGET_SYSTEM}"
|
||||||
|
DUSK_GAME_NAME="${DUSK_GAME_NAME}"
|
||||||
|
DUSK_GAME_AUTHOR="${DUSK_GAME_AUTHOR}"
|
||||||
|
DUSK_GAME_SHORT_DESCRIPTION="${DUSK_GAME_SHORT_DESCRIPTION}"
|
||||||
|
DUSK_GAME_LONG_DESCRIPTION="${DUSK_GAME_LONG_DESCRIPTION}"
|
||||||
|
DUSK_VERSION="${DUSK_VERSION}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Toolchains
|
||||||
|
include(cmake/targets/${DUSK_TARGET_SYSTEM}.cmake)
|
||||||
|
|
||||||
# Add tools
|
# Add tools
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
|
|
||||||
# Assets
|
# Include generated headers from tools.
|
||||||
add_subdirectory(assets)
|
target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
|
|
||||||
# Add libraries
|
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
|
||||||
find_package(SDL2 REQUIRED)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
target_link_libraries(${DUSK_TARGET_NAME} PRIVATE
|
|
||||||
SDL2
|
|
||||||
OpenGL::GL
|
|
||||||
GL
|
|
||||||
)
|
|
||||||
|
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
|
||||||
find_package(SDL2 REQUIRED)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
target_link_libraries(${DUSK_TARGET_NAME} PUBLIC
|
|
||||||
${SDL2_LIBRARIES}
|
|
||||||
SDL2
|
|
||||||
OpenGL::GL
|
|
||||||
zip
|
|
||||||
bz2
|
|
||||||
z
|
|
||||||
mbedtls
|
|
||||||
mbedcrypto
|
|
||||||
lzma
|
|
||||||
)
|
|
||||||
target_include_directories(${DUSK_TARGET_NAME} PRIVATE
|
|
||||||
${SDL2_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add code
|
|
||||||
add_subdirectory(src)
|
|
||||||
|
|
||||||
# Build assets
|
|
||||||
add_custom_target(DUSK_ASSETS_BUILT ALL
|
|
||||||
COMMAND
|
|
||||||
${Python3_EXECUTABLE} ${DUSK_TOOLS_DIR}/assetstool/main.py
|
|
||||||
--assets ${DUSK_GAME_ASSETS_DIR}
|
|
||||||
--build-type wad
|
|
||||||
--output-assets ${DUSK_BUILT_ASSETS_DIR}
|
|
||||||
--output-file ${DUSK_BUILD_DIR}/dusk.dsk
|
|
||||||
--headers-dir ${DUSK_GENERATED_HEADERS_DIR}
|
|
||||||
--input ${DUSK_ASSETS}
|
|
||||||
)
|
|
||||||
add_dependencies(${DUSK_TARGET_NAME} DUSK_ASSETS_BUILT)
|
|
||||||
|
|
||||||
# Include generated headers
|
|
||||||
target_include_directories(${DUSK_TARGET_NAME} PUBLIC
|
|
||||||
${DUSK_GENERATED_HEADERS_DIR}
|
${DUSK_GENERATED_HEADERS_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Postbuild
|
# Add main code
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
add_subdirectory(${DUSK_SOURCES_DIR})
|
||||||
create_pbp_file(
|
|
||||||
TARGET "${DUSK_TARGET_NAME}"
|
# Include generated headers
|
||||||
ICON_PATH NULL
|
target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
BACKGROUND_PATH NULL
|
${DUSK_GENERATED_HEADERS_DIR}
|
||||||
PREVIEW_PATH NULL
|
)
|
||||||
TITLE "${DUSK_TARGET_NAME}"
|
|
||||||
PSAR_PATH ${DUSK_BUILD_DIR}/dusk.dsk
|
# Handle tests
|
||||||
VERSION 01.00
|
if(DUSK_BUILD_TESTS)
|
||||||
)
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Build assets
|
||||||
|
file(GLOB_RECURSE DUSK_ASSET_FILES CONFIGURE_DEPENDS "${DUSK_ASSETS_DIR}/*")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${DUSK_ASSETS_ZIP}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${DUSK_ASSETS_DIR}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E rm -f "${DUSK_ASSETS_ZIP}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E tar "cf" "${DUSK_ASSETS_ZIP}" --format=zip -- .
|
||||||
|
WORKING_DIRECTORY "${DUSK_ASSETS_DIR}"
|
||||||
|
DEPENDS ${DUSK_ASSET_FILES}
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(DUSK_ASSETS_BUILT DEPENDS "${DUSK_ASSETS_ZIP}")
|
||||||
|
add_dependencies(${DUSK_LIBRARY_TARGET_NAME} DUSK_ASSETS_BUILT)
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Dusk
|
||||||
|
RPG Game Project, small and able to run on a PSP.
|
||||||
|
|
||||||
|
# Building
|
||||||
|
Each build target has different requirements. You can take a look at the git
|
||||||
|
workflow to see how the builds are done for each target. In addition, for
|
||||||
|
accessing the editor and building the game on your host system, install the
|
||||||
|
following packages, depending on your system;
|
||||||
|
|
||||||
|
Fedora;
|
||||||
|
```
|
||||||
|
sudo dnf install git make gcc cmake python python-polib python3-pillow python3-dotenv python3-numpy python-qt5 python3-pyopengl SDL2-devel zlib-devel libzip-devel bzip2-devel openssl-devel lzma-sdk-devel xz xz-devel lua-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
Ubuntu;
|
||||||
|
```
|
||||||
|
sudo apt-get install git build-essential gcc python python-polib python3-pillow python3-dotenv python3-numpy python3-pyqt5 python3-opengl
|
||||||
|
```
|
||||||
|
|
||||||
|
Arch Linux;
|
||||||
|
```
|
||||||
|
sudo pacman -S git base-devel gcc python python-polib python-pillow python-dotenv python-numpy python-pyqt5 python-opengl
|
||||||
|
```
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import sys, os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
# Check if the script is run with the correct arguments
|
||||||
|
parser = argparse.ArgumentParser(description="Generate chunk header files")
|
||||||
|
parser.add_argument('--assets', required=True, help='Dir to output built assets')
|
||||||
|
parser.add_argument('--headers-dir', required=True, help='Directory to output individual asset headers (required for header build)')
|
||||||
|
parser.add_argument('--output-headers', help='Output header file for built assets (required for header build)')
|
||||||
|
parser.add_argument('--output-assets', required=True, help='Output directory for built assets')
|
||||||
|
parser.add_argument('--output-file', required=True, help='Output file for built assets (required for wad build)')
|
||||||
|
parser.add_argument('--input', required=True, help='Input assets to process', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import sys, os
|
||||||
|
from tools.asset.args import args
|
||||||
|
from tools.asset.process.asset import processAsset
|
||||||
|
from tools.asset.process.palette import processPaletteList
|
||||||
|
from tools.asset.process.tileset import processTilesetList
|
||||||
|
from tools.asset.process.language import processLanguageList
|
||||||
|
from tools.asset.path import getBuiltAssetsRelativePath
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
# Parse input file args.
|
||||||
|
inputAssets = []
|
||||||
|
for inputArg in args.input:
|
||||||
|
files = inputArg.split('$')
|
||||||
|
for file in files:
|
||||||
|
if str(file).strip() == '':
|
||||||
|
continue
|
||||||
|
|
||||||
|
pieces = file.split('#')
|
||||||
|
|
||||||
|
if len(pieces) < 2:
|
||||||
|
print(f"Error: Invalid input asset format '{file}'. Expected format: type#path[#option1%option2...]")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
options = {}
|
||||||
|
if len(pieces) > 2:
|
||||||
|
optionParts = pieces[2].split('%')
|
||||||
|
for part in optionParts:
|
||||||
|
partSplit = part.split('=')
|
||||||
|
|
||||||
|
if len(partSplit) < 1:
|
||||||
|
continue
|
||||||
|
if len(partSplit) == 2:
|
||||||
|
options[partSplit[0]] = partSplit[1]
|
||||||
|
else:
|
||||||
|
options[partSplit[0]] = True
|
||||||
|
|
||||||
|
inputAssets.append({
|
||||||
|
'type': pieces[0],
|
||||||
|
'path': pieces[1],
|
||||||
|
'options': options
|
||||||
|
})
|
||||||
|
|
||||||
|
if not inputAssets:
|
||||||
|
print("Error: No input assets provided.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Process each asset.
|
||||||
|
files = []
|
||||||
|
for asset in inputAssets:
|
||||||
|
asset = processAsset(asset)
|
||||||
|
files.extend(asset['files'])
|
||||||
|
|
||||||
|
# Generate additional files
|
||||||
|
files.extend(processLanguageList()['files'])
|
||||||
|
|
||||||
|
# Take assets and add to a zip archive.
|
||||||
|
outputFileName = args.output_file
|
||||||
|
print(f"Creating output file: {outputFileName}")
|
||||||
|
with zipfile.ZipFile(outputFileName, 'w') as zipf:
|
||||||
|
for file in files:
|
||||||
|
relativeOutputPath = getBuiltAssetsRelativePath(file)
|
||||||
|
zipf.write(file, arcname=relativeOutputPath)
|
||||||
|
|
||||||
|
# Generate additional headers.
|
||||||
|
processPaletteList()
|
||||||
|
processTilesetList()
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from args import args
|
from tools.asset.args import args
|
||||||
|
|
||||||
def getAssetRelativePath(fullPath):
|
def getAssetRelativePath(fullPath):
|
||||||
# Get the relative path to the asset
|
# Get the relative path to the asset
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
import sys
|
import sys
|
||||||
# from processtileset import processTileset
|
# from processtileset import processTileset
|
||||||
from processimage import processImage
|
from tools.asset.process.image import processImage
|
||||||
from processpalette import processPalette
|
from tools.asset.process.palette import processPalette
|
||||||
from processtileset import processTileset
|
from tools.asset.process.tileset import processTileset
|
||||||
from processmap import processMap
|
from tools.asset.process.map import processMap
|
||||||
from processlanguage import processLanguage
|
from tools.asset.process.language import processLanguage
|
||||||
|
from tools.asset.process.script import processScript
|
||||||
|
|
||||||
processedAssets = []
|
processedAssets = []
|
||||||
|
|
||||||
@@ -25,6 +26,8 @@ def processAsset(asset):
|
|||||||
return processMap(asset)
|
return processMap(asset)
|
||||||
elif t == 'language':
|
elif t == 'language':
|
||||||
return processLanguage(asset)
|
return processLanguage(asset)
|
||||||
|
elif t == 'script':
|
||||||
|
return processScript(asset)
|
||||||
else:
|
else:
|
||||||
print(f"Error: Unknown asset type '{asset['type']}' for path '{asset['path']}'")
|
print(f"Error: Unknown asset type '{asset['type']}' for path '{asset['path']}'")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from processpalette import extractPaletteFromImage, palettes
|
from tools.asset.process.palette import extractPaletteFromImage, palettes
|
||||||
from args import args
|
from tools.asset.args import args
|
||||||
from assethelpers import getAssetRelativePath
|
from tools.asset.path import getAssetRelativePath
|
||||||
from assetcache import assetGetCache, assetCache
|
from tools.asset.cache import assetGetCache, assetCache
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
|
|
||||||
@@ -35,10 +35,24 @@ def processPalettizedImage(asset):
|
|||||||
imagePalette = extractPaletteFromImage(image)
|
imagePalette = extractPaletteFromImage(image)
|
||||||
|
|
||||||
# Find palette that contains every color
|
# Find palette that contains every color
|
||||||
for palette in palettes:
|
palette = None
|
||||||
if all(color in palette['pixels'] for color in imagePalette):
|
for p in palettes:
|
||||||
|
hasAllColors = True
|
||||||
|
for color in imagePalette:
|
||||||
|
for palColor in p['pixels']:
|
||||||
|
if color[0] == palColor[0] and color[1] == palColor[1] and color[2] == palColor[2] and color[3] == palColor[3]:
|
||||||
|
break
|
||||||
|
elif color[3] == 0 and palColor[3] == 0:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('Pallete {} does not contain color #{}'.format(p['paletteName'], '{:02x}{:02x}{:02x}{:02x}'.format(color[0], color[1], color[2], color[3])))
|
||||||
|
hasAllColors = False
|
||||||
|
break
|
||||||
|
if hasAllColors:
|
||||||
|
palette = p
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
|
if palette is None:
|
||||||
palette = palettes[0] # Just to avoid reference error
|
palette = palettes[0] # Just to avoid reference error
|
||||||
print(f"No matching palette found for {assetPath}!")
|
print(f"No matching palette found for {assetPath}!")
|
||||||
# Find which pixel is missing
|
# Find which pixel is missing
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from args import args
|
from tools.asset.args import args
|
||||||
from assetcache import assetCache, assetGetCache
|
from tools.asset.cache import assetCache, assetGetCache
|
||||||
from assethelpers import getAssetRelativePath
|
from tools.asset.path import getAssetRelativePath
|
||||||
|
from tools.dusk.defs import defs
|
||||||
import polib
|
import polib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
LANGUAGE_CHUNK_CHAR_COUNT = 6 * 1024 # 6 KB per chunk
|
LANGUAGE_CHUNK_CHAR_COUNT = int(defs.get('ASSET_LANG_CHUNK_CHAR_COUNT'))
|
||||||
|
|
||||||
LANGUAGE_DATA = {}
|
LANGUAGE_DATA = {}
|
||||||
LANGUAGE_KEYS = []
|
LANGUAGE_KEYS = []
|
||||||
@@ -140,14 +141,49 @@ def processLanguageList():
|
|||||||
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
||||||
with open(outputFile, "wb") as f:
|
with open(outputFile, "wb") as f:
|
||||||
f.write(langBuffer)
|
f.write(langBuffer)
|
||||||
|
|
||||||
|
|
||||||
# Write out the language keys header file
|
# Write out the language keys header file
|
||||||
outputFile = os.path.join(args.headers_dir, "locale", "language", "keys.h")
|
outputFile = os.path.join(args.headers_dir, "locale", "language", "keys.h")
|
||||||
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
||||||
with open(outputFile, "w") as f:
|
with open(outputFile, "w") as f:
|
||||||
f.write(headerKeys)
|
f.write(headerKeys)
|
||||||
|
|
||||||
|
# Generate language list.
|
||||||
|
langValues = {}
|
||||||
|
headerLocale = "#pragma once\n#include \"locale/localeinfo.h\"\n\n"
|
||||||
|
headerLocale += "typedef enum {\n"
|
||||||
|
count = 0
|
||||||
|
headerLocale += f" DUSK_LOCALE_NULL = {count},\n"
|
||||||
|
count += 1
|
||||||
|
for lang in LANGUAGE_DATA:
|
||||||
|
langKey = lang.replace('-', '_').replace(' ', '_').upper()
|
||||||
|
langValues[lang] = count
|
||||||
|
headerLocale += f" DUSK_LOCALE_{langKey} = {count},\n"
|
||||||
|
count += 1
|
||||||
|
headerLocale += f" DUSK_LOCALE_COUNT = {count}\n"
|
||||||
|
headerLocale += "} dusklocale_t;\n\n"
|
||||||
|
|
||||||
|
headerLocale += f"static const localeinfo_t LOCALE_INFOS[DUSK_LOCALE_COUNT] = {{\n"
|
||||||
|
for lang in LANGUAGE_DATA:
|
||||||
|
langKey = lang.replace('-', '_').replace(' ', '_').upper()
|
||||||
|
headerLocale += f" [DUSK_LOCALE_{langKey}] = {{\n"
|
||||||
|
headerLocale += f" .file = \"{lang}\"\n"
|
||||||
|
headerLocale += f" }},\n"
|
||||||
|
headerLocale += "};\n"
|
||||||
|
|
||||||
|
headerLocale += f"static const char_t *LOCALE_SCRIPT = \n"
|
||||||
|
for lang in LANGUAGE_DATA:
|
||||||
|
langKey = lang.replace('-', '_').replace(' ', '_').upper()
|
||||||
|
langValue = langValues[lang]
|
||||||
|
headerLocale += f" \"DUSK_LOCALE_{langKey} = {langValue}\\n\"\n"
|
||||||
|
headerLocale += ";\n"
|
||||||
|
|
||||||
|
# Write out the locale enum header file
|
||||||
|
outputFile = os.path.join(args.headers_dir, "locale", "locale.h")
|
||||||
|
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
||||||
|
with open(outputFile, "w") as f:
|
||||||
|
f.write(headerLocale)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'files': files
|
'files': files
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
from tools.asset.args import args
|
||||||
|
from tools.asset.cache import assetCache, assetGetCache
|
||||||
|
from tools.asset.path import getAssetRelativePath
|
||||||
|
from tools.dusk.defs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH, CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, CHUNK_TILE_COUNT
|
||||||
|
from tools.dusk.map import Map
|
||||||
|
from tools.dusk.chunk import Chunk
|
||||||
|
|
||||||
|
def convertModelData(modelData):
|
||||||
|
# TLDR; Model data stores things efficiently with indices, but we buffer it
|
||||||
|
# out to 6 vertex quads for simplicity.
|
||||||
|
outVertices = []
|
||||||
|
outUVs = []
|
||||||
|
outColors = []
|
||||||
|
for indice in modelData['indices']:
|
||||||
|
vertex = modelData['vertices'][indice]
|
||||||
|
uv = modelData['uvs'][indice]
|
||||||
|
color = modelData['colors'][indice]
|
||||||
|
outVertices.append(vertex)
|
||||||
|
outUVs.append(uv)
|
||||||
|
outColors.append(color)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'vertices': outVertices,
|
||||||
|
'uvs': outUVs,
|
||||||
|
'colors': outColors
|
||||||
|
}
|
||||||
|
|
||||||
|
def processChunk(chunk):
|
||||||
|
cache = assetGetCache(chunk.getFilename())
|
||||||
|
if cache:
|
||||||
|
return cache
|
||||||
|
|
||||||
|
baseModel = {
|
||||||
|
'vertices': [],
|
||||||
|
'colors': [],
|
||||||
|
'uvs': []
|
||||||
|
}
|
||||||
|
models = [ baseModel ]
|
||||||
|
|
||||||
|
for tileIndex, tile in chunk.tiles.items():
|
||||||
|
tileBase = tile.getBaseTileModel()
|
||||||
|
|
||||||
|
convertedBase = convertModelData(tileBase)
|
||||||
|
baseModel['vertices'].extend(convertedBase['vertices'])
|
||||||
|
baseModel['colors'].extend(convertedBase['colors'])
|
||||||
|
baseModel['uvs'].extend(convertedBase['uvs'])
|
||||||
|
|
||||||
|
# Generate binary buffer for efficient output
|
||||||
|
buffer = bytearray()
|
||||||
|
buffer.extend(b'DMC')# Header
|
||||||
|
buffer.extend(len(chunk.tiles).to_bytes(4, 'little')) # Number of tiles
|
||||||
|
buffer.extend(len(models).to_bytes(1, 'little')) # Number of models
|
||||||
|
buffer.extend(len(chunk.entities).to_bytes(1, 'little')) # Number of entities
|
||||||
|
|
||||||
|
# Buffer tile data as array of uint8_t
|
||||||
|
for tileIndex, tile in chunk.tiles.items():
|
||||||
|
buffer.extend(tile.shape.to_bytes(1, 'little'))
|
||||||
|
|
||||||
|
# # For each model
|
||||||
|
for model in models:
|
||||||
|
vertexCount = len(model['vertices'])
|
||||||
|
buffer.extend(vertexCount.to_bytes(4, 'little'))
|
||||||
|
for i in range(vertexCount):
|
||||||
|
vertex = model['vertices'][i]
|
||||||
|
uv = model['uvs'][i]
|
||||||
|
color = model['colors'][i]
|
||||||
|
|
||||||
|
buffer.extend(color[0].to_bytes(1, 'little'))
|
||||||
|
buffer.extend(color[1].to_bytes(1, 'little'))
|
||||||
|
buffer.extend(color[2].to_bytes(1, 'little'))
|
||||||
|
buffer.extend(color[3].to_bytes(1, 'little'))
|
||||||
|
|
||||||
|
buffer.extend(bytearray(struct.pack('<f', uv[0])))
|
||||||
|
buffer.extend(bytearray(struct.pack('<f', uv[1])))
|
||||||
|
|
||||||
|
buffer.extend(bytearray(struct.pack('<f', vertex[0])))
|
||||||
|
buffer.extend(bytearray(struct.pack('<f', vertex[1])))
|
||||||
|
buffer.extend(bytearray(struct.pack('<f', vertex[2])))
|
||||||
|
|
||||||
|
# For each entity
|
||||||
|
for entity in chunk.entities.values():
|
||||||
|
buffer.extend(entity.type.to_bytes(1, 'little'))
|
||||||
|
buffer.extend(entity.localX.to_bytes(1, 'little'))
|
||||||
|
buffer.extend(entity.localY.to_bytes(1, 'little'))
|
||||||
|
buffer.extend(entity.localZ.to_bytes(1, 'little'))
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Write out map file
|
||||||
|
relative = getAssetRelativePath(chunk.getFilename())
|
||||||
|
fileNameWithoutExt = os.path.splitext(os.path.basename(relative))[0]
|
||||||
|
outputFileRelative = os.path.join(os.path.dirname(relative), f"{fileNameWithoutExt}.dmc")
|
||||||
|
outputFilePath = os.path.join(args.output_assets, outputFileRelative)
|
||||||
|
os.makedirs(os.path.dirname(outputFilePath), exist_ok=True)
|
||||||
|
with open(outputFilePath, "wb") as f:
|
||||||
|
f.write(buffer)
|
||||||
|
|
||||||
|
outChunk = {
|
||||||
|
'files': [ outputFilePath ],
|
||||||
|
'chunk': chunk
|
||||||
|
}
|
||||||
|
return assetCache(chunk.getFilename(), outChunk)
|
||||||
|
|
||||||
|
def processMap(asset):
|
||||||
|
cache = assetGetCache(asset['path'])
|
||||||
|
if cache is not None:
|
||||||
|
return cache
|
||||||
|
|
||||||
|
map = Map(None)
|
||||||
|
map.load(asset['path'])
|
||||||
|
chunksDir = map.getChunkDirectory()
|
||||||
|
|
||||||
|
files = os.listdir(chunksDir)
|
||||||
|
if len(files) == 0:
|
||||||
|
print(f"Error: No chunk files found in {chunksDir}.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
chunkFiles = []
|
||||||
|
for fileName in files:
|
||||||
|
if not fileName.endswith('.json'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
fNameNoExt = os.path.splitext(fileName)[0]
|
||||||
|
fnPieces = fNameNoExt.split('_')
|
||||||
|
if len(fnPieces) != 3:
|
||||||
|
print(f"Error: Chunk filename {fileName} does not contain valid chunk coordinates.")
|
||||||
|
sys.exit(1)
|
||||||
|
chunk = Chunk(map, int(fnPieces[0]), int(fnPieces[1]), int(fnPieces[2]))
|
||||||
|
chunk.load()
|
||||||
|
result = processChunk(chunk)
|
||||||
|
chunkFiles.extend(result['files'])
|
||||||
|
|
||||||
|
# Map file
|
||||||
|
outBuffer = bytearray()
|
||||||
|
outBuffer.extend(b'DMF')
|
||||||
|
outBuffer.extend(len(chunkFiles).to_bytes(4, 'little'))
|
||||||
|
|
||||||
|
# DMF (Dusk Map file)
|
||||||
|
fileRelative = getAssetRelativePath(asset['path'])
|
||||||
|
fileNameWithoutExt = os.path.splitext(os.path.basename(fileRelative))[0]
|
||||||
|
outputMapRelative = os.path.join(os.path.dirname(fileRelative), f"{fileNameWithoutExt}.dmf")
|
||||||
|
outputMapPath = os.path.join(args.output_assets, outputMapRelative)
|
||||||
|
os.makedirs(os.path.dirname(outputMapPath), exist_ok=True)
|
||||||
|
with open(outputMapPath, "wb") as f:
|
||||||
|
f.write(outBuffer)
|
||||||
|
|
||||||
|
outMap = {
|
||||||
|
'files': chunkFiles
|
||||||
|
}
|
||||||
|
outMap['files'].append(outputMapPath)
|
||||||
|
return assetCache(asset['path'], outMap)
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import json
|
||||||
import os
|
import os
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from args import args
|
|
||||||
import sys
|
|
||||||
import datetime
|
import datetime
|
||||||
from assetcache import assetCache, assetGetCache
|
from tools.asset.args import args
|
||||||
|
from tools.asset.cache import assetCache, assetGetCache
|
||||||
|
|
||||||
palettes = []
|
palettes = []
|
||||||
|
|
||||||
@@ -79,6 +79,7 @@ def processPalette(asset):
|
|||||||
|
|
||||||
def processPaletteList():
|
def processPaletteList():
|
||||||
data = f"// Auto-generated palette list\n"
|
data = f"// Auto-generated palette list\n"
|
||||||
|
print(f"Generating palette list with {len(palettes)} palettes.")
|
||||||
for palette in palettes:
|
for palette in palettes:
|
||||||
data += f"#include \"{palette['headerFile']}\"\n"
|
data += f"#include \"{palette['headerFile']}\"\n"
|
||||||
data += f"\n"
|
data += f"\n"
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from tools.asset.args import args
|
||||||
|
from tools.asset.cache import assetCache, assetGetCache
|
||||||
|
from tools.asset.path import getAssetRelativePath
|
||||||
|
from tools.dusk.defs import fileDefs
|
||||||
|
|
||||||
|
def processScript(asset):
|
||||||
|
cache = assetGetCache(asset['path'])
|
||||||
|
if cache is not None:
|
||||||
|
return cache
|
||||||
|
|
||||||
|
# Load the lua file as a string
|
||||||
|
with open(asset['path'], 'r', encoding='utf-8') as f:
|
||||||
|
luaCode = f.read()
|
||||||
|
|
||||||
|
# TODO: I will precompile or minify the Lua code here in the future
|
||||||
|
|
||||||
|
# Replace all definitions in the code
|
||||||
|
for key, val in fileDefs.items():
|
||||||
|
luaCode = luaCode.replace(key, str(val))
|
||||||
|
|
||||||
|
# Create output Dusk Script File (DSF) data
|
||||||
|
data = ""
|
||||||
|
data += "DSF"
|
||||||
|
data += luaCode
|
||||||
|
|
||||||
|
# Write to relative output file path.
|
||||||
|
relative = getAssetRelativePath(asset['path'])
|
||||||
|
fileNameWithoutExt = os.path.splitext(os.path.basename(asset['path']))[0]
|
||||||
|
outputFileRelative = os.path.join(os.path.dirname(relative), f"{fileNameWithoutExt}.dsf")
|
||||||
|
outputFilePath = os.path.join(args.output_assets, outputFileRelative)
|
||||||
|
os.makedirs(os.path.dirname(outputFilePath), exist_ok=True)
|
||||||
|
with open(outputFilePath, "wb") as f:
|
||||||
|
f.write(data.encode('utf-8'))
|
||||||
|
|
||||||
|
outScript = {
|
||||||
|
'data': data,
|
||||||
|
'path': asset['path'],
|
||||||
|
'files': [ outputFilePath ],
|
||||||
|
'scriptPath': outputFileRelative,
|
||||||
|
}
|
||||||
|
return assetCache(asset['path'], outScript)
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import json
|
import json
|
||||||
from processimage import processImage
|
|
||||||
import sys
|
import sys
|
||||||
from assethelpers import getAssetRelativePath
|
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
from args import args
|
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
from assetcache import assetGetCache, assetCache
|
from tools.asset.process.image import processImage
|
||||||
|
from tools.asset.path import getAssetRelativePath
|
||||||
|
from tools.asset.args import args
|
||||||
|
from tools.asset.cache import assetGetCache, assetCache
|
||||||
|
|
||||||
tilesets = []
|
tilesets = []
|
||||||
|
|
||||||
@@ -126,6 +126,7 @@ def processTileset(asset):
|
|||||||
data += f"#pragma once\n"
|
data += f"#pragma once\n"
|
||||||
data += f"#include \"display/tileset/tileset.h\"\n\n"
|
data += f"#include \"display/tileset/tileset.h\"\n\n"
|
||||||
data += f"static const tileset_t TILESET_{tilesetNameUpper} = {{\n"
|
data += f"static const tileset_t TILESET_{tilesetNameUpper} = {{\n"
|
||||||
|
data += f" .name = {json.dumps(tilesetName)},\n"
|
||||||
data += f" .tileWidth = {tilesetData['tileWidth']},\n"
|
data += f" .tileWidth = {tilesetData['tileWidth']},\n"
|
||||||
data += f" .tileHeight = {tilesetData['tileHeight']},\n"
|
data += f" .tileHeight = {tilesetData['tileHeight']},\n"
|
||||||
data += f" .tileCount = {tilesetData['columns'] * tilesetData['rows']},\n"
|
data += f" .tileCount = {tilesetData['columns'] * tilesetData['rows']},\n"
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "assetpalette.h"
|
||||||
|
#include "asset/assettype.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
|
||||||
|
errorret_t assetPaletteLoad(assetentire_t entire) {
|
||||||
|
assertNotNull(entire.data, "Data pointer cannot be NULL.");
|
||||||
|
assertNotNull(entire.output, "Output pointer cannot be NULL.");
|
||||||
|
|
||||||
|
assetpalette_t *assetData = (assetpalette_t *)entire.data;
|
||||||
|
palette_t *palette = (palette_t *)entire.output;
|
||||||
|
|
||||||
|
// Read header and version (first 4 bytes)
|
||||||
|
if(
|
||||||
|
assetData->header[0] != 'D' ||
|
||||||
|
assetData->header[1] != 'P' ||
|
||||||
|
assetData->header[2] != 'F'
|
||||||
|
) {
|
||||||
|
errorThrow("Invalid palette header");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version (can only be 1 atm)
|
||||||
|
if(assetData->version != 0x01) {
|
||||||
|
errorThrow("Unsupported palette version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check color count.
|
||||||
|
if(
|
||||||
|
assetData->colorCount == 0 ||
|
||||||
|
assetData->colorCount > PALETTE_COLOR_COUNT_MAX
|
||||||
|
) {
|
||||||
|
errorThrow("Invalid palette color count");
|
||||||
|
}
|
||||||
|
|
||||||
|
paletteInit(
|
||||||
|
palette,
|
||||||
|
assetData->colorCount,
|
||||||
|
assetData->colors
|
||||||
|
);
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
|
#include "display/texture/palette.h"
|
||||||
|
|
||||||
|
typedef struct assetentire_s assetentire_t;
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct {
|
||||||
|
char_t header[3];
|
||||||
|
uint8_t version;
|
||||||
|
|
||||||
|
uint8_t colorCount;
|
||||||
|
color_t colors[PALETTE_COLOR_COUNT_MAX];
|
||||||
|
} assetpalette_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a palette from the given data pointer into the output palette.
|
||||||
|
*
|
||||||
|
* @param entire Data received from the asset loader system.
|
||||||
|
* @return An error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetPaletteLoad(assetentire_t entire);
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Copyright (c) 2026 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
camera.c
|
||||||
|
)
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "camera.h"
|
||||||
|
#include "display/display.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
#include "display/framebuffer/framebuffer.h"
|
||||||
|
#include "display/screen/screen.h"
|
||||||
|
|
||||||
|
void cameraInit(camera_t *camera) {
|
||||||
|
cameraInitPerspective(camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cameraInitPerspective(camera_t *camera) {
|
||||||
|
assertNotNull(camera, "Not a camera component");
|
||||||
|
|
||||||
|
camera->projType = CAMERA_PROJECTION_TYPE_PERSPECTIVE;
|
||||||
|
camera->perspective.fov = glm_rad(45.0f);
|
||||||
|
camera->nearClip = 0.1f;
|
||||||
|
camera->farClip = 10000.0f;
|
||||||
|
|
||||||
|
camera->viewType = CAMERA_VIEW_TYPE_LOOKAT;
|
||||||
|
glm_vec3_copy((vec3){ 5.0f, 5.0f, 5.0f }, camera->lookat.position);
|
||||||
|
glm_vec3_copy((vec3){ 0.0f, 1.0f, 0.0f }, camera->lookat.up);
|
||||||
|
glm_vec3_copy((vec3){ 0.0f, 0.0f, 0.0f }, camera->lookat.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cameraInitOrthographic(camera_t *camera) {
|
||||||
|
assertNotNull(camera, "Not a camera component");
|
||||||
|
|
||||||
|
camera->projType = CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC;
|
||||||
|
camera->orthographic.left = 0.0f;
|
||||||
|
camera->orthographic.right = SCREEN.width;
|
||||||
|
camera->orthographic.top = SCREEN.height;
|
||||||
|
camera->orthographic.bottom = 0.0f;
|
||||||
|
camera->nearClip = 0.1f;
|
||||||
|
camera->farClip = 1.0f;
|
||||||
|
|
||||||
|
camera->viewType = CAMERA_VIEW_TYPE_2D;
|
||||||
|
glm_vec2_copy((vec2){ 0.0f, 0.0f }, camera->_2d.position);
|
||||||
|
camera->_2d.zoom = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cameraGetProjectionMatrix(camera_t *camera, mat4 dest) {
|
||||||
|
assertNotNull(camera, "Not a camera component");
|
||||||
|
assertNotNull(dest, "Destination matrix must not be null");
|
||||||
|
|
||||||
|
if(
|
||||||
|
camera->projType == CAMERA_PROJECTION_TYPE_PERSPECTIVE ||
|
||||||
|
camera->projType == CAMERA_PROJECTION_TYPE_PERSPECTIVE_FLIPPED
|
||||||
|
) {
|
||||||
|
glm_mat4_identity(dest);
|
||||||
|
glm_perspective(
|
||||||
|
camera->perspective.fov,
|
||||||
|
SCREEN.aspect,
|
||||||
|
camera->nearClip,
|
||||||
|
camera->farClip,
|
||||||
|
dest
|
||||||
|
);
|
||||||
|
|
||||||
|
if(camera->projType == CAMERA_PROJECTION_TYPE_PERSPECTIVE_FLIPPED) {
|
||||||
|
dest[1][1] *= -1.0f;
|
||||||
|
}
|
||||||
|
} else if(camera->projType == CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC) {
|
||||||
|
glm_mat4_identity(dest);
|
||||||
|
glm_ortho(
|
||||||
|
camera->orthographic.left,
|
||||||
|
camera->orthographic.right,
|
||||||
|
camera->orthographic.top,
|
||||||
|
camera->orthographic.bottom,
|
||||||
|
camera->nearClip,
|
||||||
|
camera->farClip,
|
||||||
|
dest
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cameraGetViewMatrix(camera_t *camera, mat4 dest) {
|
||||||
|
assertNotNull(camera, "Not a camera component");
|
||||||
|
assertNotNull(dest, "Destination matrix must not be null");
|
||||||
|
|
||||||
|
if(camera->viewType == CAMERA_VIEW_TYPE_MATRIX) {
|
||||||
|
glm_mat4_ucopy(camera->view, dest);
|
||||||
|
} else if(camera->viewType == CAMERA_VIEW_TYPE_LOOKAT) {
|
||||||
|
glm_mat4_identity(dest);
|
||||||
|
glm_lookat(
|
||||||
|
camera->lookat.position,
|
||||||
|
camera->lookat.target,
|
||||||
|
camera->lookat.up,
|
||||||
|
dest
|
||||||
|
);
|
||||||
|
} else if(camera->viewType == CAMERA_VIEW_TYPE_2D) {
|
||||||
|
glm_mat4_identity(dest);
|
||||||
|
glm_lookat(
|
||||||
|
(vec3){ camera->_2d.position[0], camera->_2d.position[1], 0.5f },
|
||||||
|
(vec3){ camera->_2d.position[0], camera->_2d.position[1], 0.0f },
|
||||||
|
(vec3){ 0.0f, 1.0f, 0.0f },
|
||||||
|
dest
|
||||||
|
);
|
||||||
|
} else if(camera->viewType == CAMERA_VIEW_TYPE_LOOKAT_PIXEL_PERFECT) {
|
||||||
|
assertUnreachable("LOOKAT_PIXEL_PERFECT view type is not implemented yet");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,14 +8,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "dusk.h"
|
#include "dusk.h"
|
||||||
#include "display/color.h"
|
#include "display/color.h"
|
||||||
|
#include "display/camera/cameraplatform.h"
|
||||||
|
|
||||||
#define CAMERA_COUNT_MAX 4
|
#ifndef cameraPushMatrixPlatform
|
||||||
|
#error "cameraPushMatrixPlatform must be defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CAMERA_PROJECTION_TYPE_PERSPECTIVE,
|
|
||||||
CAMERA_PROJECTION_TYPE_PERSPECTIVE_FLIPPED,
|
|
||||||
CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC
|
|
||||||
} cameraprojectiontype_t;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CAMERA_VIEW_TYPE_MATRIX,
|
CAMERA_VIEW_TYPE_MATRIX,
|
||||||
@@ -24,28 +22,25 @@ typedef enum {
|
|||||||
CAMERA_VIEW_TYPE_LOOKAT_PIXEL_PERFECT
|
CAMERA_VIEW_TYPE_LOOKAT_PIXEL_PERFECT
|
||||||
} cameraviewtype_t;
|
} cameraviewtype_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct camera_s {
|
||||||
cameraprojectiontype_t projType;
|
|
||||||
cameraviewtype_t viewType;
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
mat4 view;
|
mat4 view;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
float_t position[3];
|
vec3 position;
|
||||||
float_t target[3];
|
vec3 target;
|
||||||
float_t up[3];
|
vec3 up;
|
||||||
} lookat;
|
} lookat;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
float_t offset[3];
|
vec3 offset;
|
||||||
float_t target[3];
|
vec3 target;
|
||||||
float_t up[3];
|
vec3 up;
|
||||||
float_t pixelsPerUnit;
|
float_t pixelsPerUnit;
|
||||||
} lookatPixelPerfect;
|
} lookatPixelPerfect;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
float_t position[2];
|
vec2 position;
|
||||||
float_t zoom;
|
float_t zoom;
|
||||||
} _2d;
|
} _2d;
|
||||||
};
|
};
|
||||||
@@ -65,6 +60,9 @@ typedef struct {
|
|||||||
|
|
||||||
float_t nearClip;
|
float_t nearClip;
|
||||||
float_t farClip;
|
float_t farClip;
|
||||||
|
|
||||||
|
cameraprojectiontype_t projType;
|
||||||
|
cameraviewtype_t viewType;
|
||||||
} camera_t;
|
} camera_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,13 +81,17 @@ void cameraInitPerspective(camera_t *camera);
|
|||||||
void cameraInitOrthographic(camera_t *camera);
|
void cameraInitOrthographic(camera_t *camera);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes the camera's view matrix onto the matrix stack.
|
* Gets the projection matrix for a camera.
|
||||||
*
|
*
|
||||||
* @param id The ID of the camera entity to use.
|
* @param camera Camera to get the projection matrix for
|
||||||
|
* @param dest Matrix to store the projection matrix in
|
||||||
*/
|
*/
|
||||||
void cameraPushMatrix(camera_t* camera);
|
void cameraGetProjectionMatrix(camera_t *camera, mat4 dest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pops the camera's view matrix off the matrix stack.
|
* Gets the view matrix for a camera.
|
||||||
|
*
|
||||||
|
* @param camera Camera to get the view matrix for
|
||||||
|
* @param dest Matrix to store the view matrix in
|
||||||
*/
|
*/
|
||||||
void cameraPopMatrix(void);
|
void cameraGetViewMatrix(camera_t *camera, mat4 dest);
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
from tools.dusk.event import Event
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, CHUNK_VERTEX_COUNT_MAX, TILE_SHAPE_NULL
|
||||||
|
from tools.dusk.tile import Tile
|
||||||
|
from tools.dusk.entity import Entity
|
||||||
|
from tools.dusk.region import Region
|
||||||
|
from tools.editor.map.vertexbuffer import VertexBuffer
|
||||||
|
from OpenGL.GL import *
|
||||||
|
|
||||||
|
class Chunk:
|
||||||
|
def __init__(self, map, x, y, z):
|
||||||
|
self.map = map
|
||||||
|
self.x = x
|
||||||
|
self.y = y
|
||||||
|
self.z = z
|
||||||
|
self.current = {}
|
||||||
|
self.original = {}
|
||||||
|
self.entities = {}
|
||||||
|
self.regions = {}
|
||||||
|
self.onChunkData = Event()
|
||||||
|
self.dirty = False
|
||||||
|
|
||||||
|
self.tiles = {}
|
||||||
|
self.vertexBuffer = VertexBuffer()
|
||||||
|
|
||||||
|
# Test Region
|
||||||
|
region = self.regions[0] = Region(self)
|
||||||
|
region.minX = 0
|
||||||
|
region.minY = 0
|
||||||
|
region.minZ = 0
|
||||||
|
region.maxX = 32
|
||||||
|
region.maxY = 32
|
||||||
|
region.maxZ = 32
|
||||||
|
region.updateVertexs()
|
||||||
|
|
||||||
|
# Gen tiles.
|
||||||
|
tileIndex = 0
|
||||||
|
for tz in range(CHUNK_DEPTH):
|
||||||
|
for ty in range(CHUNK_HEIGHT):
|
||||||
|
for tx in range(CHUNK_WIDTH):
|
||||||
|
self.tiles[tileIndex] = Tile(self, tx, ty, tz, tileIndex)
|
||||||
|
tileIndex += 1
|
||||||
|
|
||||||
|
# Update vertices
|
||||||
|
self.tileUpdateVertices()
|
||||||
|
|
||||||
|
def reload(self, newX, newY, newZ):
|
||||||
|
self.x = newX
|
||||||
|
self.y = newY
|
||||||
|
self.z = newZ
|
||||||
|
self.entities = {}
|
||||||
|
for tile in self.tiles.values():
|
||||||
|
tile.chunkReload(newX, newY, newZ)
|
||||||
|
self.load()
|
||||||
|
|
||||||
|
def tileUpdateVertices(self):
|
||||||
|
self.vertexBuffer.clear()
|
||||||
|
for tile in self.tiles.values():
|
||||||
|
tile.buffer(self.vertexBuffer)
|
||||||
|
self.vertexBuffer.buildData()
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
fname = self.getFilename()
|
||||||
|
if not fname or not os.path.exists(fname):
|
||||||
|
self.new()
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
with open(fname, 'r') as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
if not 'shapes' in data:
|
||||||
|
data['shapes'] = []
|
||||||
|
|
||||||
|
# For each tile.
|
||||||
|
for tile in self.tiles.values():
|
||||||
|
tile.load(data)
|
||||||
|
|
||||||
|
# For each entity.
|
||||||
|
self.entities = {}
|
||||||
|
if 'entities' in data:
|
||||||
|
for id, entData in enumerate(data['entities']):
|
||||||
|
ent = Entity(self)
|
||||||
|
ent.load(entData)
|
||||||
|
self.entities[id] = ent
|
||||||
|
|
||||||
|
self.tileUpdateVertices()
|
||||||
|
self.dirty = False
|
||||||
|
self.onChunkData.invoke(self)
|
||||||
|
self.map.onEntityData.invoke()
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeError(f"Failed to load chunk file: {e}")
|
||||||
|
|
||||||
|
def save(self):
|
||||||
|
if not self.isDirty():
|
||||||
|
return
|
||||||
|
|
||||||
|
dataOut = {
|
||||||
|
'shapes': [],
|
||||||
|
'entities': []
|
||||||
|
}
|
||||||
|
|
||||||
|
for tile in self.tiles.values():
|
||||||
|
dataOut['shapes'].append(tile.shape)
|
||||||
|
|
||||||
|
for ent in self.entities.values():
|
||||||
|
entData = {}
|
||||||
|
ent.save(entData)
|
||||||
|
dataOut['entities'].append(entData)
|
||||||
|
|
||||||
|
fname = self.getFilename()
|
||||||
|
if not fname:
|
||||||
|
raise ValueError("No filename specified for saving chunk.")
|
||||||
|
try:
|
||||||
|
with open(fname, 'w') as f:
|
||||||
|
json.dump(dataOut, f)
|
||||||
|
self.dirty = False
|
||||||
|
self.onChunkData.invoke(self)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeError(f"Failed to save chunk file: {e}")
|
||||||
|
|
||||||
|
def new(self):
|
||||||
|
for tile in self.tiles.values():
|
||||||
|
tile.shape = TILE_SHAPE_NULL
|
||||||
|
|
||||||
|
self.tileUpdateVertices()
|
||||||
|
self.dirty = False
|
||||||
|
self.onChunkData.invoke(self)
|
||||||
|
|
||||||
|
def isDirty(self):
|
||||||
|
return self.dirty
|
||||||
|
|
||||||
|
def getFilename(self):
|
||||||
|
if not self.map or not hasattr(self.map, 'getChunkDirectory'):
|
||||||
|
return None
|
||||||
|
dirPath = self.map.getChunkDirectory()
|
||||||
|
if dirPath is None:
|
||||||
|
return None
|
||||||
|
return f"{dirPath}/{self.x}_{self.y}_{self.z}.json"
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
self.vertexBuffer.draw()
|
||||||
|
|
||||||
|
def addEntity(self, localX=0, localY=0, localZ=0):
|
||||||
|
ent = Entity(self, localX, localY, localZ)
|
||||||
|
self.entities[len(self.entities)] = ent
|
||||||
|
self.map.onEntityData.invoke()
|
||||||
|
self.dirty = True
|
||||||
|
return ent
|
||||||
|
|
||||||
|
def removeEntity(self, entity):
|
||||||
|
for key, val in list(self.entities.items()):
|
||||||
|
if val == entity:
|
||||||
|
del self.entities[key]
|
||||||
|
self.map.onEntityData.invoke()
|
||||||
|
self.dirty = True
|
||||||
|
return True
|
||||||
|
return False
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
from dotenv import load_dotenv, dotenv_values
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
current_file_path = os.path.abspath(__file__)
|
||||||
|
duskDefsPath = os.path.join(os.path.dirname(current_file_path), "..", "..", "src", "duskdefs.env")
|
||||||
|
|
||||||
|
# Ensure the .env file exists
|
||||||
|
if not os.path.isfile(duskDefsPath):
|
||||||
|
print(f"Error: .env file not found at {duskDefsPath}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
load_dotenv(dotenv_path=duskDefsPath)
|
||||||
|
defs = {key: os.getenv(key) for key in os.environ.keys()}
|
||||||
|
|
||||||
|
fileDefs = dotenv_values(dotenv_path=duskDefsPath)
|
||||||
|
|
||||||
|
# Parsed out definitions
|
||||||
|
CHUNK_WIDTH = int(defs.get('CHUNK_WIDTH'))
|
||||||
|
CHUNK_HEIGHT = int(defs.get('CHUNK_HEIGHT'))
|
||||||
|
CHUNK_DEPTH = int(defs.get('CHUNK_DEPTH'))
|
||||||
|
CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH
|
||||||
|
CHUNK_VERTEX_COUNT_MAX = int(defs.get('CHUNK_VERTEX_COUNT_MAX'))
|
||||||
|
|
||||||
|
TILE_WIDTH = float(defs.get('TILE_WIDTH'))
|
||||||
|
TILE_HEIGHT = float(defs.get('TILE_HEIGHT'))
|
||||||
|
TILE_DEPTH = float(defs.get('TILE_DEPTH'))
|
||||||
|
|
||||||
|
RPG_CAMERA_PIXELS_PER_UNIT = float(defs.get('RPG_CAMERA_PIXELS_PER_UNIT'))
|
||||||
|
RPG_CAMERA_Z_OFFSET = float(defs.get('RPG_CAMERA_Z_OFFSET'))
|
||||||
|
RPG_CAMERA_FOV = float(defs.get('RPG_CAMERA_FOV'))
|
||||||
|
|
||||||
|
MAP_WIDTH = 5
|
||||||
|
MAP_HEIGHT = 5
|
||||||
|
MAP_DEPTH = 3
|
||||||
|
MAP_CHUNK_COUNT = MAP_WIDTH * MAP_HEIGHT * MAP_DEPTH
|
||||||
|
|
||||||
|
TILE_SHAPES = {}
|
||||||
|
for key in defs.keys():
|
||||||
|
if key.startswith('TILE_SHAPE_'):
|
||||||
|
globals()[key] = int(defs.get(key))
|
||||||
|
TILE_SHAPES[key] = int(defs.get(key))
|
||||||
|
|
||||||
|
ENTITY_TYPES = {}
|
||||||
|
for key in defs.keys():
|
||||||
|
if key.startswith('ENTITY_TYPE_'):
|
||||||
|
globals()[key] = int(defs.get(key))
|
||||||
|
if key != 'ENTITY_TYPE_COUNT':
|
||||||
|
ENTITY_TYPES[key] = int(defs.get(key))
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
from tools.dusk.defs import ENTITY_TYPE_NULL, ENTITY_TYPE_NPC, CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
|
||||||
|
from tools.editor.map.vertexbuffer import VertexBuffer
|
||||||
|
|
||||||
|
class Entity:
|
||||||
|
def __init__(self, chunk, localX=0, localY=0, localZ=0):
|
||||||
|
self.type = ENTITY_TYPE_NPC
|
||||||
|
self.name = "Unititled"
|
||||||
|
self.localX = localX % CHUNK_WIDTH
|
||||||
|
self.localY = localY % CHUNK_HEIGHT
|
||||||
|
self.localZ = localZ % CHUNK_DEPTH
|
||||||
|
|
||||||
|
self.chunk = chunk
|
||||||
|
self.vertexBuffer = VertexBuffer()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def load(self, obj):
|
||||||
|
self.type = obj.get('type', ENTITY_TYPE_NULL)
|
||||||
|
self.localX = obj.get('x', 0)
|
||||||
|
self.localY = obj.get('y', 0)
|
||||||
|
self.localZ = obj.get('z', 0)
|
||||||
|
self.name = obj.get('name', "Untitled")
|
||||||
|
pass
|
||||||
|
|
||||||
|
def save(self, obj):
|
||||||
|
obj['type'] = self.type
|
||||||
|
obj['name'] = self.name
|
||||||
|
obj['x'] = self.localX
|
||||||
|
obj['y'] = self.localY
|
||||||
|
obj['z'] = self.localZ
|
||||||
|
pass
|
||||||
|
|
||||||
|
def setType(self, entityType):
|
||||||
|
if self.type == entityType:
|
||||||
|
return
|
||||||
|
self.type = entityType
|
||||||
|
self.chunk.dirty = True
|
||||||
|
self.chunk.map.onEntityData.invoke()
|
||||||
|
|
||||||
|
def setName(self, name):
|
||||||
|
if self.name == name:
|
||||||
|
return
|
||||||
|
self.name = name
|
||||||
|
self.chunk.dirty = True
|
||||||
|
self.chunk.map.onEntityData.invoke()
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
self.vertexBuffer.clear()
|
||||||
|
|
||||||
|
startX = (self.chunk.x * CHUNK_WIDTH + self.localX) * TILE_WIDTH
|
||||||
|
startY = (self.chunk.y * CHUNK_HEIGHT + self.localY) * TILE_HEIGHT
|
||||||
|
startZ = (self.chunk.z * CHUNK_DEPTH + self.localZ) * TILE_DEPTH
|
||||||
|
w = TILE_WIDTH
|
||||||
|
h = TILE_HEIGHT
|
||||||
|
d = TILE_DEPTH
|
||||||
|
|
||||||
|
# Center
|
||||||
|
startX -= w / 2
|
||||||
|
startY -= h / 2
|
||||||
|
startZ -= d / 2
|
||||||
|
|
||||||
|
# Offset upwards a little
|
||||||
|
startZ += 1
|
||||||
|
|
||||||
|
# Buffer simple quad at current position (need 6 positions)
|
||||||
|
self.vertexBuffer.vertices = [
|
||||||
|
startX, startY, startZ,
|
||||||
|
startX + w, startY, startZ,
|
||||||
|
startX + w, startY + h, startZ,
|
||||||
|
startX, startY, startZ,
|
||||||
|
startX + w, startY + h, startZ,
|
||||||
|
startX, startY + h, startZ,
|
||||||
|
]
|
||||||
|
self.vertexBuffer.colors = [
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
1.0, 0.0, 1.0, 1.0,
|
||||||
|
]
|
||||||
|
self.vertexBuffer.uvs = [
|
||||||
|
0.0, 0.0,
|
||||||
|
1.0, 0.0,
|
||||||
|
1.0, 1.0,
|
||||||
|
0.0, 0.0,
|
||||||
|
1.0, 1.0,
|
||||||
|
0.0, 1.0,
|
||||||
|
]
|
||||||
|
self.vertexBuffer.buildData()
|
||||||
|
self.vertexBuffer.draw()
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
class Event:
|
||||||
|
def __init__(self):
|
||||||
|
self._subscribers = []
|
||||||
|
|
||||||
|
def sub(self, callback):
|
||||||
|
"""Subscribe a callback to the event."""
|
||||||
|
if callback not in self._subscribers:
|
||||||
|
self._subscribers.append(callback)
|
||||||
|
|
||||||
|
def unsub(self, callback):
|
||||||
|
"""Unsubscribe a callback from the event."""
|
||||||
|
if callback in self._subscribers:
|
||||||
|
self._subscribers.remove(callback)
|
||||||
|
|
||||||
|
def invoke(self, *args, **kwargs):
|
||||||
|
"""Invoke all subscribers with the given arguments."""
|
||||||
|
for callback in self._subscribers:
|
||||||
|
callback(*args, **kwargs)
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
import json
|
||||||
|
import sys
|
||||||
|
from tools.dusk.event import Event
|
||||||
|
from PyQt5.QtWidgets import QFileDialog, QMessageBox
|
||||||
|
from PyQt5.QtCore import QTimer
|
||||||
|
import os
|
||||||
|
from tools.dusk.chunk import Chunk
|
||||||
|
from tools.dusk.defs import MAP_WIDTH, MAP_HEIGHT, MAP_DEPTH, CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
MAP_DEFAULT_PATH = os.path.join(os.path.dirname(__file__), '../../assets/map/')
|
||||||
|
EDITOR_CONFIG_PATH = os.path.join(os.path.dirname(__file__), '.editor')
|
||||||
|
|
||||||
|
class Map:
|
||||||
|
def __init__(self, parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.data = {}
|
||||||
|
self.dataOriginal = {}
|
||||||
|
self.position = [None, None, None] # x, y, z
|
||||||
|
self.topLeftX = None
|
||||||
|
self.topLeftY = None
|
||||||
|
self.topLeftZ = None
|
||||||
|
self.chunks = {}
|
||||||
|
self.onMapData = Event()
|
||||||
|
self.onPositionChange = Event()
|
||||||
|
self.onEntityData = Event()
|
||||||
|
self.mapFileName = None
|
||||||
|
self.lastFile = None
|
||||||
|
self.firstLoad = True
|
||||||
|
|
||||||
|
index = 0
|
||||||
|
for x in range(MAP_WIDTH):
|
||||||
|
for y in range(MAP_HEIGHT):
|
||||||
|
for z in range(MAP_DEPTH):
|
||||||
|
self.chunks[index] = Chunk(self, x, y, z)
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
# Only in editor instances:
|
||||||
|
self.moveTo(0, 0, 0)
|
||||||
|
if parent is not None:
|
||||||
|
QTimer.singleShot(16, self.loadLastFile)
|
||||||
|
|
||||||
|
def loadLastFile(self):
|
||||||
|
if not os.path.exists(EDITOR_CONFIG_PATH):
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
with open(EDITOR_CONFIG_PATH, 'r') as f:
|
||||||
|
config = json.load(f)
|
||||||
|
lastFile = config.get('lastFile')
|
||||||
|
lastPosition = config.get('lastPosition')
|
||||||
|
leftPanelIndex = config.get('leftPanelIndex')
|
||||||
|
if lastFile and os.path.exists(lastFile):
|
||||||
|
self.load(lastFile)
|
||||||
|
if lastPosition and isinstance(lastPosition, list) and len(lastPosition) == 3:
|
||||||
|
self.moveTo(*lastPosition)
|
||||||
|
if leftPanelIndex is not None:
|
||||||
|
self.parent.leftPanel.tabs.setCurrentIndex(leftPanelIndex)
|
||||||
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def updateEditorConfig(self):
|
||||||
|
if self.parent is None:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
mapFileName = self.getMapFilename()
|
||||||
|
config = {
|
||||||
|
'lastFile': mapFileName if mapFileName else "",
|
||||||
|
'lastPosition': self.position,
|
||||||
|
'leftPanelIndex': self.parent.leftPanel.tabs.currentIndex()
|
||||||
|
}
|
||||||
|
config_dir = os.path.dirname(EDITOR_CONFIG_PATH)
|
||||||
|
if not os.path.exists(config_dir):
|
||||||
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
with open(EDITOR_CONFIG_PATH, 'w') as f:
|
||||||
|
json.dump(config, f, indent=2)
|
||||||
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def newFile(self):
|
||||||
|
self.data = {}
|
||||||
|
self.dataOriginal = {}
|
||||||
|
self.mapFileName = None
|
||||||
|
self.lastFile = None
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
chunk.new()
|
||||||
|
self.moveTo(0, 0, 0)
|
||||||
|
self.onMapData.invoke(self.data)
|
||||||
|
self.updateEditorConfig()
|
||||||
|
|
||||||
|
def save(self, fname=None):
|
||||||
|
if not self.getMapFilename() and fname is None:
|
||||||
|
filePath, _ = QFileDialog.getSaveFileName(None, "Save Map File", MAP_DEFAULT_PATH, "Map Files (*.json)")
|
||||||
|
if not filePath:
|
||||||
|
return
|
||||||
|
self.mapFileName = filePath
|
||||||
|
if fname:
|
||||||
|
self.mapFileName = fname
|
||||||
|
try:
|
||||||
|
with open(self.getMapFilename(), 'w') as f:
|
||||||
|
json.dump(self.data, f, indent=2)
|
||||||
|
self.dataOriginal = json.loads(json.dumps(self.data)) # Deep copy
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
chunk.save()
|
||||||
|
self.updateEditorConfig()
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
QMessageBox.critical(None, "Save Error", f"Failed to save map file:\n{e}")
|
||||||
|
|
||||||
|
def load(self, fileName):
|
||||||
|
try:
|
||||||
|
with open(fileName, 'r') as f:
|
||||||
|
self.data = json.load(f)
|
||||||
|
self.mapFileName = fileName
|
||||||
|
self.dataOriginal = json.loads(json.dumps(self.data)) # Deep copy
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
chunk.load()
|
||||||
|
self.onMapData.invoke(self.data)
|
||||||
|
self.updateEditorConfig()
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
QMessageBox.critical(None, "Load Error", f"Failed to load map file:\n{e}")
|
||||||
|
|
||||||
|
def isMapFileDirty(self):
|
||||||
|
return json.dumps(self.data, sort_keys=True) != json.dumps(self.dataOriginal, sort_keys=True)
|
||||||
|
|
||||||
|
def isDirty(self):
|
||||||
|
return self.isMapFileDirty() or self.anyChunksDirty()
|
||||||
|
|
||||||
|
def getMapFilename(self):
|
||||||
|
return self.mapFileName if self.mapFileName and os.path.exists(self.mapFileName) else None
|
||||||
|
|
||||||
|
def getMapDirectory(self):
|
||||||
|
if self.mapFileName is None:
|
||||||
|
return None
|
||||||
|
dirname = os.path.dirname(self.mapFileName)
|
||||||
|
return dirname
|
||||||
|
|
||||||
|
def getChunkDirectory(self):
|
||||||
|
dirName = self.getMapDirectory()
|
||||||
|
if dirName is None:
|
||||||
|
return None
|
||||||
|
return os.path.join(dirName, 'chunks')
|
||||||
|
|
||||||
|
def anyChunksDirty(self):
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
if chunk.isDirty():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def moveTo(self, x, y, z):
|
||||||
|
if self.position == [x, y, z]:
|
||||||
|
return
|
||||||
|
|
||||||
|
# We need to decide if the chunks should be unloaded here or not.
|
||||||
|
newTopLeftChunkX = x // CHUNK_WIDTH - (MAP_WIDTH // 2)
|
||||||
|
newTopLeftChunkY = y // CHUNK_HEIGHT - (MAP_HEIGHT // 2)
|
||||||
|
newTopLeftChunkZ = z // CHUNK_DEPTH - (MAP_DEPTH // 2)
|
||||||
|
|
||||||
|
if(newTopLeftChunkX != self.topLeftX or
|
||||||
|
newTopLeftChunkY != self.topLeftY or
|
||||||
|
newTopLeftChunkZ != self.topLeftZ):
|
||||||
|
|
||||||
|
chunksToUnload = []
|
||||||
|
chunksToKeep = []
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
chunkWorldX = chunk.x
|
||||||
|
chunkWorldY = chunk.y
|
||||||
|
chunkWorldZ = chunk.z
|
||||||
|
if(chunkWorldX < newTopLeftChunkX or
|
||||||
|
chunkWorldX >= newTopLeftChunkX + MAP_WIDTH or
|
||||||
|
chunkWorldY < newTopLeftChunkY or
|
||||||
|
chunkWorldY >= newTopLeftChunkY + MAP_HEIGHT or
|
||||||
|
chunkWorldZ < newTopLeftChunkZ or
|
||||||
|
chunkWorldZ >= newTopLeftChunkZ + MAP_DEPTH):
|
||||||
|
chunksToUnload.append(chunk)
|
||||||
|
else:
|
||||||
|
chunksToKeep.append(chunk)
|
||||||
|
|
||||||
|
# Unload chunks that are out of the new bounds.
|
||||||
|
for chunk in chunksToUnload:
|
||||||
|
if chunk.isDirty():
|
||||||
|
print(f"Can't move map, some chunks are dirty: ({chunk.x}, {chunk.y}, {chunk.z})")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Now we can safely unload the chunks.
|
||||||
|
chunkIndex = 0
|
||||||
|
newChunks = {}
|
||||||
|
for chunk in chunksToKeep:
|
||||||
|
newChunks[chunkIndex] = chunk
|
||||||
|
chunkIndex += 1
|
||||||
|
|
||||||
|
for xPos in range(newTopLeftChunkX, newTopLeftChunkX + MAP_WIDTH):
|
||||||
|
for yPos in range(newTopLeftChunkY, newTopLeftChunkY + MAP_HEIGHT):
|
||||||
|
for zPos in range(newTopLeftChunkZ, newTopLeftChunkZ + MAP_DEPTH):
|
||||||
|
# Check if we already have this chunk.
|
||||||
|
found = False
|
||||||
|
for chunk in chunksToKeep:
|
||||||
|
if chunk.x == xPos and chunk.y == yPos and chunk.z == zPos:
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if not found:
|
||||||
|
# Create a new chunk.
|
||||||
|
newChunk = chunksToUnload.pop()
|
||||||
|
newChunk.reload(xPos, yPos, zPos)
|
||||||
|
newChunks[chunkIndex] = newChunk
|
||||||
|
chunkIndex += 1
|
||||||
|
|
||||||
|
self.chunks = newChunks
|
||||||
|
self.topLeftX = newTopLeftChunkX
|
||||||
|
self.topLeftY = newTopLeftChunkY
|
||||||
|
self.topLeftZ = newTopLeftChunkZ
|
||||||
|
|
||||||
|
self.position = [x, y, z]
|
||||||
|
self.onPositionChange.invoke(self.position)
|
||||||
|
if not self.firstLoad:
|
||||||
|
self.updateEditorConfig()
|
||||||
|
self.firstLoad = False
|
||||||
|
|
||||||
|
def moveRelative(self, x, y, z):
|
||||||
|
self.moveTo(
|
||||||
|
self.position[0] + x,
|
||||||
|
self.position[1] + y,
|
||||||
|
self.position[2] + z
|
||||||
|
)
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
chunk.draw()
|
||||||
|
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
for entity in chunk.entities.values():
|
||||||
|
entity.draw()
|
||||||
|
|
||||||
|
# Only render on Region tab
|
||||||
|
if self.parent.leftPanel.tabs.currentWidget() == self.parent.leftPanel.regionPanel:
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
for region in chunk.regions.values():
|
||||||
|
region.draw()
|
||||||
|
|
||||||
|
def getChunkAtWorldPos(self, x, y, z):
|
||||||
|
chunkX = x // CHUNK_WIDTH
|
||||||
|
chunkY = y // CHUNK_HEIGHT
|
||||||
|
chunkZ = z // CHUNK_DEPTH
|
||||||
|
for chunk in self.chunks.values():
|
||||||
|
if chunk.x == chunkX and chunk.y == chunkY and chunk.z == chunkZ:
|
||||||
|
return chunk
|
||||||
|
return None
|
||||||
|
|
||||||
|
def getTileAtWorldPos(self, x, y, z):
|
||||||
|
chunk = self.getChunkAtWorldPos(x, y, z)
|
||||||
|
if not chunk:
|
||||||
|
print("No chunk found at position:", (x, y, z))
|
||||||
|
return None
|
||||||
|
|
||||||
|
tileX = x % CHUNK_WIDTH
|
||||||
|
tileY = y % CHUNK_HEIGHT
|
||||||
|
tileZ = z % CHUNK_DEPTH
|
||||||
|
tileIndex = tileX + tileY * CHUNK_WIDTH + tileZ * CHUNK_WIDTH * CHUNK_HEIGHT
|
||||||
|
return chunk.tiles.get(tileIndex)
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
|
||||||
|
from tools.editor.map.vertexbuffer import VertexBuffer
|
||||||
|
from OpenGL.GL import *
|
||||||
|
from OpenGL.GLU import *
|
||||||
|
|
||||||
|
class Region:
|
||||||
|
def __init__(self, chunk):
|
||||||
|
self.minX = 0
|
||||||
|
self.minY = 0
|
||||||
|
self.minZ = 0
|
||||||
|
self.maxX = 0
|
||||||
|
self.maxY = 0
|
||||||
|
self.maxZ = 0
|
||||||
|
self.chunk = chunk
|
||||||
|
self.vertexBuffer = VertexBuffer()
|
||||||
|
self.color = (1.0, 0.0, 0.0)
|
||||||
|
self.updateVertexs()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def updateVertexs(self):
|
||||||
|
# Draw a quad, semi transparent with solid outlines
|
||||||
|
vminX = (self.minX * CHUNK_WIDTH) * TILE_WIDTH
|
||||||
|
vminY = (self.minY * CHUNK_HEIGHT) * TILE_HEIGHT
|
||||||
|
vminZ = (self.minZ * CHUNK_DEPTH) * TILE_DEPTH
|
||||||
|
vmaxX = (self.maxX * CHUNK_WIDTH) * TILE_WIDTH
|
||||||
|
vmaxY = (self.maxY * CHUNK_HEIGHT) * TILE_HEIGHT
|
||||||
|
vmaxZ = (self.maxZ * CHUNK_DEPTH) * TILE_DEPTH
|
||||||
|
alpha = 0.25
|
||||||
|
|
||||||
|
# Move back half a tile width
|
||||||
|
vminX -= TILE_WIDTH / 2
|
||||||
|
vmaxX -= TILE_WIDTH / 2
|
||||||
|
vminY -= TILE_HEIGHT / 2
|
||||||
|
vmaxY -= TILE_HEIGHT / 2
|
||||||
|
vminZ -= TILE_DEPTH / 2
|
||||||
|
vmaxZ -= TILE_DEPTH / 2
|
||||||
|
|
||||||
|
# Cube (6 verts per face)
|
||||||
|
self.vertexBuffer.vertices = [
|
||||||
|
# Front face
|
||||||
|
vminX, vminY, vmaxZ,
|
||||||
|
vmaxX, vminY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vmaxZ,
|
||||||
|
vminX, vminY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vmaxZ,
|
||||||
|
vminX, vmaxY, vmaxZ,
|
||||||
|
|
||||||
|
# Back face
|
||||||
|
vmaxX, vminY, vminZ,
|
||||||
|
vminX, vminY, vminZ,
|
||||||
|
vminX, vmaxY, vminZ,
|
||||||
|
vmaxX, vminY, vminZ,
|
||||||
|
vminX, vmaxY, vminZ,
|
||||||
|
vmaxX, vmaxY, vminZ,
|
||||||
|
|
||||||
|
# Left face
|
||||||
|
vminX, vminY, vminZ,
|
||||||
|
vminX, vminY, vmaxZ,
|
||||||
|
vminX, vmaxY, vmaxZ,
|
||||||
|
vminX, vminY, vminZ,
|
||||||
|
vminX, vmaxY, vmaxZ,
|
||||||
|
vminX, vmaxY, vminZ,
|
||||||
|
|
||||||
|
# Right face
|
||||||
|
vmaxX, vminY, vmaxZ,
|
||||||
|
vmaxX, vminY, vminZ,
|
||||||
|
vmaxX, vmaxY, vminZ,
|
||||||
|
vmaxX, vminY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vminZ,
|
||||||
|
vmaxX, vmaxY, vmaxZ,
|
||||||
|
|
||||||
|
# Top face
|
||||||
|
vminX, vmaxY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vminZ,
|
||||||
|
vminX, vmaxY, vmaxZ,
|
||||||
|
vmaxX, vmaxY, vminZ,
|
||||||
|
vminX, vmaxY, vminZ,
|
||||||
|
|
||||||
|
# Bottom face
|
||||||
|
vminX, vminY, vminZ,
|
||||||
|
vmaxX, vminY, vminZ,
|
||||||
|
vmaxX, vminY, vmaxZ,
|
||||||
|
vminX, vminY, vminZ,
|
||||||
|
vmaxX, vminY, vmaxZ,
|
||||||
|
vminX, vminY, vmaxZ,
|
||||||
|
]
|
||||||
|
|
||||||
|
self.vertexBuffer.colors = [
|
||||||
|
# Front face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
|
||||||
|
# Back face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
|
||||||
|
# Left face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
|
||||||
|
# Right face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
|
||||||
|
# Top face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
|
||||||
|
# Bottom face
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
self.color[0], self.color[1], self.color[2], alpha,
|
||||||
|
]
|
||||||
|
self.vertexBuffer.buildData()
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
self.vertexBuffer.draw()
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
from OpenGL.GL import *
|
||||||
|
from tools.dusk.defs import (
|
||||||
|
TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH,
|
||||||
|
CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH,
|
||||||
|
TILE_SHAPE_NULL, TILE_SHAPE_FLOOR,
|
||||||
|
TILE_SHAPE_RAMP_NORTH, TILE_SHAPE_RAMP_SOUTH,
|
||||||
|
TILE_SHAPE_RAMP_EAST, TILE_SHAPE_RAMP_WEST,
|
||||||
|
TILE_SHAPE_RAMP_SOUTHWEST, TILE_SHAPE_RAMP_SOUTHEAST,
|
||||||
|
TILE_SHAPE_RAMP_NORTHWEST, TILE_SHAPE_RAMP_NORTHEAST
|
||||||
|
)
|
||||||
|
|
||||||
|
def getItem(arr, index, default):
|
||||||
|
if index < len(arr):
|
||||||
|
return arr[index]
|
||||||
|
return default
|
||||||
|
|
||||||
|
class Tile:
|
||||||
|
def __init__(self, chunk, x, y, z, tileIndex):
|
||||||
|
self.shape = TILE_SHAPE_NULL
|
||||||
|
|
||||||
|
self.chunk = chunk
|
||||||
|
self.x = x
|
||||||
|
self.y = y
|
||||||
|
self.z = z
|
||||||
|
self.index = tileIndex
|
||||||
|
|
||||||
|
self.posX = x * TILE_WIDTH + chunk.x * CHUNK_WIDTH * TILE_WIDTH
|
||||||
|
self.posY = y * TILE_HEIGHT + chunk.y * CHUNK_HEIGHT * TILE_HEIGHT
|
||||||
|
self.posZ = z * TILE_DEPTH + chunk.z * CHUNK_DEPTH * TILE_DEPTH
|
||||||
|
|
||||||
|
def chunkReload(self, newX, newY, newZ):
|
||||||
|
self.posX = self.x * TILE_WIDTH + newX * CHUNK_WIDTH * TILE_WIDTH
|
||||||
|
self.posY = self.y * TILE_HEIGHT + newY * CHUNK_HEIGHT * TILE_HEIGHT
|
||||||
|
self.posZ = self.z * TILE_DEPTH + newZ * CHUNK_DEPTH * TILE_DEPTH
|
||||||
|
|
||||||
|
def load(self, chunkData):
|
||||||
|
self.shape = getItem(chunkData['shapes'], self.index, TILE_SHAPE_NULL)
|
||||||
|
|
||||||
|
def setShape(self, shape):
|
||||||
|
if shape == self.shape:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.shape = shape
|
||||||
|
self.chunk.dirty = True
|
||||||
|
self.chunk.tileUpdateVertices()
|
||||||
|
self.chunk.onChunkData.invoke(self.chunk)
|
||||||
|
|
||||||
|
def getBaseTileModel(self):
|
||||||
|
vertices = []
|
||||||
|
indices = []
|
||||||
|
uvs = []
|
||||||
|
colors = []
|
||||||
|
|
||||||
|
if self.shape == TILE_SHAPE_NULL:
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_FLOOR:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (255, 255, 255, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_NORTH:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (255, 0, 0, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_SOUTH:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (0, 255, 0, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_EAST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (0, 0, 255, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_WEST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (255, 255, 0, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_SOUTHWEST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (255, 128, 0, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_NORTHWEST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (128, 255, 0, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_NORTHEAST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (0, 255, 128, 255) ] * 4
|
||||||
|
|
||||||
|
elif self.shape == TILE_SHAPE_RAMP_SOUTHEAST:
|
||||||
|
vertices = [
|
||||||
|
(self.posX, self.posY, self.posZ),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH),
|
||||||
|
(self.posX, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH)
|
||||||
|
]
|
||||||
|
indices = [0, 1, 2, 0, 2, 3]
|
||||||
|
uvs = [ (0, 0), (1, 0), (1, 1), (0, 1) ]
|
||||||
|
colors = [ (255, 128, 255, 255) ] * 4
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Solid black cube for unknown shape
|
||||||
|
x0, y0, z0 = self.posX, self.posY, self.posZ
|
||||||
|
x1, y1, z1 = self.posX + TILE_WIDTH, self.posY + TILE_HEIGHT, self.posZ + TILE_DEPTH
|
||||||
|
vertices = [
|
||||||
|
(x0, y0, z0), (x1, y0, z0), (x1, y1, z0), (x0, y1, z0), # bottom
|
||||||
|
(x0, y0, z1), (x1, y0, z1), (x1, y1, z1), (x0, y1, z1) # top
|
||||||
|
]
|
||||||
|
indices = [
|
||||||
|
0,1,2, 0,2,3, # bottom
|
||||||
|
4,5,6, 4,6,7, # top
|
||||||
|
0,1,5, 0,5,4, # front
|
||||||
|
2,3,7, 2,7,6, # back
|
||||||
|
1,2,6, 1,6,5, # right
|
||||||
|
3,0,4, 3,4,7 # left
|
||||||
|
]
|
||||||
|
uvs = [ (0,0) ] * 8
|
||||||
|
colors = [ (0,0,0,255) ] * 8
|
||||||
|
|
||||||
|
return {
|
||||||
|
'vertices': vertices,
|
||||||
|
'indices': indices,
|
||||||
|
'uvs': uvs,
|
||||||
|
'colors': colors
|
||||||
|
}
|
||||||
|
|
||||||
|
def buffer(self, vertexBuffer):
|
||||||
|
if self.shape == TILE_SHAPE_NULL:
|
||||||
|
return
|
||||||
|
|
||||||
|
# New code:
|
||||||
|
baseData = self.getBaseTileModel()
|
||||||
|
|
||||||
|
# Base data is indiced but we need to buffer unindiced data
|
||||||
|
for index in baseData['indices']:
|
||||||
|
verts = baseData['vertices'][index]
|
||||||
|
uv = baseData['uvs'][index]
|
||||||
|
color = baseData['colors'][index]
|
||||||
|
|
||||||
|
vertexBuffer.vertices.extend([
|
||||||
|
verts[0] - (TILE_WIDTH / 2.0),
|
||||||
|
verts[1] - (TILE_HEIGHT / 2.0),
|
||||||
|
verts[2] - (TILE_DEPTH / 2.0)
|
||||||
|
])
|
||||||
|
|
||||||
|
vertexBuffer.colors.extend([
|
||||||
|
color[0] / 255.0,
|
||||||
|
color[1] / 255.0,
|
||||||
|
color[2] / 255.0,
|
||||||
|
color[3] / 255.0
|
||||||
|
])
|
||||||
Executable
+57
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
from PyQt5.QtWidgets import (
|
||||||
|
QApplication, QVBoxLayout, QPushButton,
|
||||||
|
QDialog
|
||||||
|
)
|
||||||
|
from OpenGL.GL import *
|
||||||
|
from OpenGL.GLU import *
|
||||||
|
from tools.editor.maptool import MapWindow
|
||||||
|
from tools.editor.langtool import LangToolWindow
|
||||||
|
from tools.editor.cutscenetool import CutsceneToolWindow
|
||||||
|
|
||||||
|
DEFAULT_TOOL = None
|
||||||
|
DEFAULT_TOOL = "map"
|
||||||
|
# DEFAULT_TOOL = "cutscene"
|
||||||
|
|
||||||
|
TOOLS = [
|
||||||
|
("Map Editor", "map", MapWindow),
|
||||||
|
("Language Editor", "language", LangToolWindow),
|
||||||
|
("Cutscene Editor", "cutscene", CutsceneToolWindow),
|
||||||
|
]
|
||||||
|
|
||||||
|
class EditorChoiceDialog(QDialog):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setWindowTitle("Choose Tool")
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
self.selected = None
|
||||||
|
for label, key, win_cls in TOOLS:
|
||||||
|
btn = QPushButton(label)
|
||||||
|
btn.clicked.connect(lambda checked, w=win_cls: self.choose_tool(w))
|
||||||
|
layout.addWidget(btn)
|
||||||
|
|
||||||
|
def choose_tool(self, win_cls):
|
||||||
|
self.selected = win_cls
|
||||||
|
self.accept()
|
||||||
|
|
||||||
|
def get_choice(self):
|
||||||
|
return self.selected
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
tool_map = { key: win_cls for _, key, win_cls in TOOLS }
|
||||||
|
if DEFAULT_TOOL in tool_map:
|
||||||
|
win_cls = tool_map[DEFAULT_TOOL]
|
||||||
|
else:
|
||||||
|
choice_dialog = EditorChoiceDialog()
|
||||||
|
if choice_dialog.exec_() == QDialog.Accepted:
|
||||||
|
win_cls = choice_dialog.get_choice()
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
|
win = win_cls()
|
||||||
|
win.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLineEdit, QLabel, QSizePolicy, QComboBox, QHBoxLayout, QSpacerItem
|
||||||
|
from PyQt5.QtCore import Qt, pyqtSignal
|
||||||
|
from .cutscenewait import CutsceneWaitEditor
|
||||||
|
from .cutscenetext import CutsceneTextEditor
|
||||||
|
|
||||||
|
EDITOR_MAP = (
|
||||||
|
( "wait", "Wait", CutsceneWaitEditor ),
|
||||||
|
( "text", "Text", CutsceneTextEditor )
|
||||||
|
)
|
||||||
|
|
||||||
|
class CutsceneItemEditor(QWidget):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.layout = QVBoxLayout(self)
|
||||||
|
self.layout.setAlignment(Qt.AlignTop | Qt.AlignLeft)
|
||||||
|
self.layout.addWidget(QLabel("Item Properties:"))
|
||||||
|
|
||||||
|
rowLayout = QHBoxLayout()
|
||||||
|
rowLayout.setSpacing(8)
|
||||||
|
|
||||||
|
rowLayout.addWidget(QLabel("Name:"))
|
||||||
|
self.nameInput = QLineEdit()
|
||||||
|
rowLayout.addWidget(self.nameInput)
|
||||||
|
|
||||||
|
rowLayout.addWidget(QLabel("Type:"))
|
||||||
|
self.typeDropdown = QComboBox()
|
||||||
|
self.typeDropdown.addItems([typeName for typeKey, typeName, editorClass in EDITOR_MAP])
|
||||||
|
rowLayout.addWidget(self.typeDropdown)
|
||||||
|
self.layout.addLayout(rowLayout)
|
||||||
|
|
||||||
|
self.activeEditor = None
|
||||||
|
|
||||||
|
# Events
|
||||||
|
self.nameInput.textChanged.connect(self.onNameChanged)
|
||||||
|
self.typeDropdown.currentTextChanged.connect(self.onTypeChanged)
|
||||||
|
|
||||||
|
# First load
|
||||||
|
self.onNameChanged(self.nameInput.text())
|
||||||
|
self.onTypeChanged(self.typeDropdown.currentText())
|
||||||
|
|
||||||
|
def onNameChanged(self, nameText):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onTypeChanged(self, typeText):
|
||||||
|
typeKey = typeText.lower()
|
||||||
|
|
||||||
|
# Remove existing editor
|
||||||
|
if self.activeEditor:
|
||||||
|
self.layout.removeWidget(self.activeEditor)
|
||||||
|
self.activeEditor.deleteLater()
|
||||||
|
self.activeEditor = None
|
||||||
|
|
||||||
|
# Create new editor
|
||||||
|
for key, name, editorClass in EDITOR_MAP:
|
||||||
|
if key == typeKey:
|
||||||
|
self.activeEditor = editorClass()
|
||||||
|
self.layout.addWidget(self.activeEditor)
|
||||||
|
break
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
from PyQt5.QtWidgets import QMenuBar, QAction, QFileDialog, QMessageBox
|
||||||
|
from PyQt5.QtGui import QKeySequence
|
||||||
|
|
||||||
|
class CutsceneMenuBar(QMenuBar):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
fileMenu = self.addMenu("File")
|
||||||
|
|
||||||
|
self.newAction = QAction("New", self)
|
||||||
|
self.newAction.setShortcut(QKeySequence.New)
|
||||||
|
self.newAction.triggered.connect(self.newFile)
|
||||||
|
fileMenu.addAction(self.newAction)
|
||||||
|
|
||||||
|
self.openAction = QAction("Open", self)
|
||||||
|
self.openAction.setShortcut(QKeySequence.Open)
|
||||||
|
self.openAction.triggered.connect(self.openFile)
|
||||||
|
fileMenu.addAction(self.openAction)
|
||||||
|
|
||||||
|
self.saveAction = QAction("Save", self)
|
||||||
|
self.saveAction.setShortcut(QKeySequence.Save)
|
||||||
|
self.saveAction.triggered.connect(self.saveFile)
|
||||||
|
fileMenu.addAction(self.saveAction)
|
||||||
|
|
||||||
|
self.saveAsAction = QAction("Save As", self)
|
||||||
|
self.saveAsAction.setShortcut(QKeySequence.SaveAs)
|
||||||
|
self.saveAsAction.triggered.connect(self.saveFileAs)
|
||||||
|
fileMenu.addAction(self.saveAsAction)
|
||||||
|
|
||||||
|
def newFile(self):
|
||||||
|
self.parent.clearCutscene()
|
||||||
|
|
||||||
|
def openFile(self):
|
||||||
|
path, _ = QFileDialog.getOpenFileName(self.parent, "Open Cutscene File", "", "JSON Files (*.json);;All Files (*)")
|
||||||
|
if not path:
|
||||||
|
return
|
||||||
|
|
||||||
|
# TODO: Load file contents into timeline
|
||||||
|
self.parent.currentFile = path
|
||||||
|
pass
|
||||||
|
|
||||||
|
def saveFile(self):
|
||||||
|
if not self.parent.currentFile:
|
||||||
|
self.saveFileAs()
|
||||||
|
return
|
||||||
|
|
||||||
|
# TODO: Save timeline to self.parent.currentFile
|
||||||
|
pass
|
||||||
|
|
||||||
|
def saveFileAs(self):
|
||||||
|
path, _ = QFileDialog.getSaveFileName(self.parent, "Save Cutscene File As", "", "JSON Files (*.json);;All Files (*)")
|
||||||
|
if path:
|
||||||
|
self.parent.currentFile = path
|
||||||
|
self.saveFile()
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QTextEdit
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
|
class CutsceneTextEditor(QWidget):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
layout.setSpacing(0)
|
||||||
|
label = QLabel("Text:")
|
||||||
|
label.setSizePolicy(label.sizePolicy().Expanding, label.sizePolicy().Fixed)
|
||||||
|
layout.addWidget(label)
|
||||||
|
self.textInput = QTextEdit()
|
||||||
|
self.textInput.setSizePolicy(self.textInput.sizePolicy().Expanding, self.textInput.sizePolicy().Expanding)
|
||||||
|
layout.addWidget(self.textInput, stretch=1)
|
||||||
|
|
||||||
|
def setText(self, text):
|
||||||
|
self.textInput.setPlainText(text)
|
||||||
|
|
||||||
|
def getText(self):
|
||||||
|
return self.textInput.toPlainText()
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QFormLayout, QDoubleSpinBox, QLabel
|
||||||
|
|
||||||
|
class CutsceneWaitEditor(QWidget):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
layout = QFormLayout(self)
|
||||||
|
layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
layout.setSpacing(0)
|
||||||
|
self.waitTimeInput = QDoubleSpinBox()
|
||||||
|
self.waitTimeInput.setMinimum(0.0)
|
||||||
|
self.waitTimeInput.setMaximum(9999.0)
|
||||||
|
self.waitTimeInput.setDecimals(2)
|
||||||
|
self.waitTimeInput.setSingleStep(0.1)
|
||||||
|
layout.addRow(QLabel("Wait Time (seconds):"), self.waitTimeInput)
|
||||||
|
|
||||||
|
def setWaitTime(self, value):
|
||||||
|
self.waitTimeInput.setValue(value)
|
||||||
|
|
||||||
|
def getWaitTime(self):
|
||||||
|
return self.waitTimeInput.value()
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QListWidget, QListWidgetItem, QMenuBar, QAction, QFileDialog, QMessageBox
|
||||||
|
from PyQt5.QtGui import QKeySequence
|
||||||
|
from tools.editor.cutscene.cutsceneitemeditor import CutsceneItemEditor
|
||||||
|
from tools.editor.cutscene.cutscenemenubar import CutsceneMenuBar
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class CutsceneToolWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setWindowTitle("Dusk Cutscene Editor")
|
||||||
|
self.setGeometry(100, 100, 800, 600)
|
||||||
|
self.nextItemNumber = 1 # Track next available number
|
||||||
|
self.currentFile = None
|
||||||
|
self.dirty = False # Track unsaved changes
|
||||||
|
|
||||||
|
# File menu (handled by CutsceneMenuBar)
|
||||||
|
menubar = CutsceneMenuBar(self)
|
||||||
|
self.setMenuBar(menubar)
|
||||||
|
|
||||||
|
# Main layout: horizontal split
|
||||||
|
central = QWidget()
|
||||||
|
mainLayout = QHBoxLayout(central)
|
||||||
|
self.setCentralWidget(central)
|
||||||
|
|
||||||
|
# Timeline
|
||||||
|
leftPanel = QWidget()
|
||||||
|
leftLayout = QVBoxLayout(leftPanel)
|
||||||
|
|
||||||
|
self.timelineList = QListWidget()
|
||||||
|
self.timelineList.setSelectionMode(QListWidget.SingleSelection)
|
||||||
|
leftLayout.addWidget(QLabel("Cutscene Timeline"))
|
||||||
|
leftLayout.addWidget(self.timelineList)
|
||||||
|
|
||||||
|
btnLayout = QHBoxLayout()
|
||||||
|
self.addBtn = QPushButton("Add")
|
||||||
|
self.removeBtn = QPushButton("Remove")
|
||||||
|
btnLayout.addWidget(self.addBtn)
|
||||||
|
btnLayout.addWidget(self.removeBtn)
|
||||||
|
leftLayout.addLayout(btnLayout)
|
||||||
|
mainLayout.addWidget(leftPanel, 2)
|
||||||
|
|
||||||
|
# Property editor
|
||||||
|
self.editorPanel = QWidget()
|
||||||
|
self.editorLayout = QVBoxLayout(self.editorPanel)
|
||||||
|
self.itemEditor = None # Only create when needed
|
||||||
|
mainLayout.addWidget(self.editorPanel, 3)
|
||||||
|
|
||||||
|
# Events
|
||||||
|
self.timelineList.currentItemChanged.connect(self.onItemSelected)
|
||||||
|
self.addBtn.clicked.connect(self.addCutsceneItem)
|
||||||
|
self.removeBtn.clicked.connect(self.removeCutsceneItem)
|
||||||
|
|
||||||
|
def addCutsceneItem(self):
|
||||||
|
name = f"Cutscene item {self.nextItemNumber}"
|
||||||
|
timelineItem = QListWidgetItem(name)
|
||||||
|
self.timelineList.addItem(timelineItem)
|
||||||
|
self.timelineList.setCurrentItem(timelineItem)
|
||||||
|
self.nextItemNumber += 1
|
||||||
|
self.dirty = True
|
||||||
|
|
||||||
|
def removeCutsceneItem(self):
|
||||||
|
row = self.timelineList.currentRow()
|
||||||
|
if row < 0:
|
||||||
|
return
|
||||||
|
self.timelineList.takeItem(row)
|
||||||
|
self.dirty = True
|
||||||
|
|
||||||
|
# Remove editor if nothing selected
|
||||||
|
if self.timelineList.currentItem() is None or self.itemEditor is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.editorLayout.removeWidget(self.itemEditor)
|
||||||
|
self.itemEditor.deleteLater()
|
||||||
|
self.itemEditor = None
|
||||||
|
|
||||||
|
def clearCutscene(self):
|
||||||
|
self.timelineList.clear()
|
||||||
|
self.nextItemNumber = 1
|
||||||
|
self.currentFile = None
|
||||||
|
self.dirty = False
|
||||||
|
if self.itemEditor:
|
||||||
|
self.editorLayout.removeWidget(self.itemEditor)
|
||||||
|
|
||||||
|
def onItemSelected(self, current, previous):
|
||||||
|
if current:
|
||||||
|
if not self.itemEditor:
|
||||||
|
self.itemEditor = CutsceneItemEditor()
|
||||||
|
self.editorLayout.addWidget(self.itemEditor)
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.itemEditor:
|
||||||
|
return
|
||||||
|
self.editorLayout.removeWidget(self.itemEditor)
|
||||||
|
self.itemEditor.deleteLater()
|
||||||
|
self.itemEditor = None
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
window = CutsceneToolWindow()
|
||||||
|
window.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from PyQt5.QtWidgets import QMainWindow, QApplication, QAction, QMenuBar, QMessageBox, QFileDialog, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QTableWidget, QTableWidgetItem, QHeaderView, QPushButton, QTabWidget, QFormLayout
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import polib
|
||||||
|
|
||||||
|
class LangToolWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setWindowTitle("Dusk Language Editor")
|
||||||
|
self.setGeometry(100, 100, 800, 600)
|
||||||
|
self.current_file = None
|
||||||
|
self.dirty = False
|
||||||
|
self.init_menu()
|
||||||
|
self.init_ui()
|
||||||
|
|
||||||
|
def init_ui(self):
|
||||||
|
central = QWidget()
|
||||||
|
layout = QVBoxLayout(central)
|
||||||
|
|
||||||
|
tabs = QTabWidget()
|
||||||
|
# Header Tab
|
||||||
|
header_tab = QWidget()
|
||||||
|
header_layout = QFormLayout(header_tab)
|
||||||
|
self.language_edit = QLineEdit()
|
||||||
|
self.language_edit.setMaximumWidth(220)
|
||||||
|
header_layout.addRow(QLabel("Language:"), self.language_edit)
|
||||||
|
self.plural_edit = QLineEdit()
|
||||||
|
self.plural_edit.setMaximumWidth(320)
|
||||||
|
header_layout.addRow(QLabel("Plural-Forms:"), self.plural_edit)
|
||||||
|
self.content_type_edit = QLineEdit("text/plain; charset=UTF-8")
|
||||||
|
self.content_type_edit.setMaximumWidth(320)
|
||||||
|
header_layout.addRow(QLabel("Content-Type:"), self.content_type_edit)
|
||||||
|
tabs.addTab(header_tab, "Header")
|
||||||
|
|
||||||
|
# Strings Tab
|
||||||
|
strings_tab = QWidget()
|
||||||
|
strings_layout = QVBoxLayout(strings_tab)
|
||||||
|
self.po_table = QTableWidget()
|
||||||
|
self.po_table.setColumnCount(2)
|
||||||
|
self.po_table.setHorizontalHeaderLabels(["msgid", "msgstr"])
|
||||||
|
self.po_table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||||
|
self.po_table.verticalHeader().setMinimumWidth(22)
|
||||||
|
self.po_table.verticalHeader().setDefaultAlignment(Qt.AlignRight | Qt.AlignVCenter)
|
||||||
|
strings_layout.addWidget(self.po_table)
|
||||||
|
row_btn_layout = QHBoxLayout()
|
||||||
|
add_row_btn = QPushButton("Add Row")
|
||||||
|
remove_row_btn = QPushButton("Remove Row")
|
||||||
|
row_btn_layout.addWidget(add_row_btn)
|
||||||
|
row_btn_layout.addWidget(remove_row_btn)
|
||||||
|
strings_layout.addLayout(row_btn_layout)
|
||||||
|
tabs.addTab(strings_tab, "Strings")
|
||||||
|
|
||||||
|
layout.addWidget(tabs)
|
||||||
|
|
||||||
|
add_row_btn.clicked.connect(self.add_row)
|
||||||
|
remove_row_btn.clicked.connect(self.remove_row)
|
||||||
|
self.add_row_btn = add_row_btn
|
||||||
|
self.remove_row_btn = remove_row_btn
|
||||||
|
|
||||||
|
self.setCentralWidget(central)
|
||||||
|
|
||||||
|
# Connect edits to dirty flag
|
||||||
|
self.language_edit.textChanged.connect(self.set_dirty)
|
||||||
|
self.plural_edit.textChanged.connect(self.set_dirty)
|
||||||
|
self.content_type_edit.textChanged.connect(self.set_dirty)
|
||||||
|
self.po_table.itemChanged.connect(self.set_dirty)
|
||||||
|
|
||||||
|
def set_dirty(self):
|
||||||
|
self.dirty = True
|
||||||
|
self.update_save_action()
|
||||||
|
|
||||||
|
def init_menu(self):
|
||||||
|
menubar = self.menuBar()
|
||||||
|
file_menu = menubar.addMenu("File")
|
||||||
|
|
||||||
|
new_action = QAction("New", self)
|
||||||
|
open_action = QAction("Open", self)
|
||||||
|
save_action = QAction("Save", self)
|
||||||
|
save_as_action = QAction("Save As", self)
|
||||||
|
|
||||||
|
new_action.triggered.connect(lambda: self.handle_file_action("new"))
|
||||||
|
open_action.triggered.connect(lambda: self.handle_file_action("open"))
|
||||||
|
save_action.triggered.connect(self.handle_save)
|
||||||
|
save_as_action.triggered.connect(self.handle_save_as)
|
||||||
|
|
||||||
|
file_menu.addAction(new_action)
|
||||||
|
file_menu.addAction(open_action)
|
||||||
|
file_menu.addAction(save_action)
|
||||||
|
file_menu.addAction(save_as_action)
|
||||||
|
|
||||||
|
self.save_action = save_action # Store reference for enabling/disabling
|
||||||
|
self.update_save_action()
|
||||||
|
|
||||||
|
def update_save_action(self):
|
||||||
|
self.save_action.setEnabled(self.current_file is not None)
|
||||||
|
|
||||||
|
def handle_file_action(self, action):
|
||||||
|
if self.dirty:
|
||||||
|
reply = QMessageBox.question(self, "Save Changes?", "Do you want to save changes before proceeding?", QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
|
||||||
|
if reply == QMessageBox.Cancel:
|
||||||
|
return
|
||||||
|
elif reply == QMessageBox.Yes:
|
||||||
|
self.handle_save()
|
||||||
|
if action == "new":
|
||||||
|
self.new_file()
|
||||||
|
elif action == "open":
|
||||||
|
default_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../assets/locale"))
|
||||||
|
file_path, _ = QFileDialog.getOpenFileName(self, "Open Language File", default_dir, "PO Files (*.po)")
|
||||||
|
if file_path:
|
||||||
|
self.open_file(file_path)
|
||||||
|
|
||||||
|
def new_file(self):
|
||||||
|
self.current_file = None
|
||||||
|
self.dirty = False
|
||||||
|
self.language_edit.setText("")
|
||||||
|
self.plural_edit.setText("")
|
||||||
|
self.po_table.setRowCount(0)
|
||||||
|
self.update_save_action()
|
||||||
|
|
||||||
|
def open_file(self, file_path):
|
||||||
|
self.current_file = file_path
|
||||||
|
self.dirty = False
|
||||||
|
self.update_save_action()
|
||||||
|
self.load_po_file(file_path)
|
||||||
|
|
||||||
|
def load_po_file(self, file_path):
|
||||||
|
po = polib.pofile(file_path)
|
||||||
|
language = po.metadata.get('Language', '')
|
||||||
|
plural = po.metadata.get('Plural-Forms', '')
|
||||||
|
content_type = po.metadata.get('Content-Type', 'text/plain; charset=UTF-8')
|
||||||
|
self.language_edit.setText(language)
|
||||||
|
self.plural_edit.setText(plural)
|
||||||
|
self.content_type_edit.setText(content_type)
|
||||||
|
self.po_table.setRowCount(len(po))
|
||||||
|
for row, entry in enumerate(po):
|
||||||
|
self.po_table.setItem(row, 0, QTableWidgetItem(entry.msgid))
|
||||||
|
self.po_table.setItem(row, 1, QTableWidgetItem(entry.msgstr))
|
||||||
|
|
||||||
|
def save_file(self, file_path):
|
||||||
|
po = polib.POFile()
|
||||||
|
po.metadata = {
|
||||||
|
'Language': self.language_edit.text(),
|
||||||
|
'Content-Type': self.content_type_edit.text(),
|
||||||
|
'Plural-Forms': self.plural_edit.text(),
|
||||||
|
}
|
||||||
|
for row in range(self.po_table.rowCount()):
|
||||||
|
msgid_item = self.po_table.item(row, 0)
|
||||||
|
msgstr_item = self.po_table.item(row, 1)
|
||||||
|
msgid = msgid_item.text() if msgid_item else ''
|
||||||
|
msgstr = msgstr_item.text() if msgstr_item else ''
|
||||||
|
if msgid or msgstr:
|
||||||
|
entry = polib.POEntry(msgid=msgid, msgstr=msgstr)
|
||||||
|
po.append(entry)
|
||||||
|
po.save(file_path)
|
||||||
|
self.dirty = False
|
||||||
|
self.update_save_action()
|
||||||
|
|
||||||
|
def handle_save(self):
|
||||||
|
if self.current_file:
|
||||||
|
self.save_file(self.current_file)
|
||||||
|
else:
|
||||||
|
self.handle_save_as()
|
||||||
|
|
||||||
|
def handle_save_as(self):
|
||||||
|
default_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../assets/locale"))
|
||||||
|
file_path, _ = QFileDialog.getSaveFileName(self, "Save Language File As", default_dir, "PO Files (*.po)")
|
||||||
|
if file_path:
|
||||||
|
self.current_file = file_path
|
||||||
|
self.update_save_action()
|
||||||
|
self.save_file(file_path)
|
||||||
|
|
||||||
|
def add_row(self):
|
||||||
|
row = self.po_table.rowCount()
|
||||||
|
self.po_table.insertRow(row)
|
||||||
|
self.po_table.setItem(row, 0, QTableWidgetItem(""))
|
||||||
|
self.po_table.setItem(row, 1, QTableWidgetItem(""))
|
||||||
|
self.po_table.setCurrentCell(row, 0)
|
||||||
|
self.set_dirty()
|
||||||
|
|
||||||
|
def remove_row(self):
|
||||||
|
row = self.po_table.currentRow()
|
||||||
|
if row >= 0:
|
||||||
|
self.po_table.removeRow(row)
|
||||||
|
self.set_dirty()
|
||||||
|
|
||||||
|
def closeEvent(self, event):
|
||||||
|
if self.dirty:
|
||||||
|
reply = QMessageBox.question(self, "Save Changes?", "Do you want to save changes before exiting?", QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
|
||||||
|
if reply == QMessageBox.Cancel:
|
||||||
|
event.ignore()
|
||||||
|
return
|
||||||
|
elif reply == QMessageBox.Yes:
|
||||||
|
self.handle_save()
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
window = LangToolWindow()
|
||||||
|
window.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import math
|
||||||
|
import time
|
||||||
|
from OpenGL.GL import *
|
||||||
|
from OpenGL.GLU import *
|
||||||
|
from tools.dusk.defs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH, RPG_CAMERA_PIXELS_PER_UNIT, RPG_CAMERA_Z_OFFSET, RPG_CAMERA_FOV
|
||||||
|
|
||||||
|
class Camera:
|
||||||
|
def __init__(self, parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.pixelsPerUnit = RPG_CAMERA_PIXELS_PER_UNIT
|
||||||
|
self.yOffset = RPG_CAMERA_Z_OFFSET
|
||||||
|
self.fov = RPG_CAMERA_FOV
|
||||||
|
self.scale = 8.0
|
||||||
|
self.lastTime = time.time()
|
||||||
|
self.lookAtTarget = [0.0, 0.0, 0.0]
|
||||||
|
|
||||||
|
def setup(self, vw, vh, duration=0.1):
|
||||||
|
now = time.time()
|
||||||
|
delta = now - self.lastTime
|
||||||
|
self.lastTime = now
|
||||||
|
# Calculate ease factor for exponential smoothing over 'duration' seconds
|
||||||
|
ease = 1 - math.exp(-delta / duration)
|
||||||
|
|
||||||
|
z = (vh / 2.0) / (
|
||||||
|
(self.pixelsPerUnit * self.scale) * math.tan(math.radians(self.fov / 2.0))
|
||||||
|
)
|
||||||
|
lookAt = [
|
||||||
|
self.parent.map.position[0] * TILE_WIDTH,
|
||||||
|
self.parent.map.position[1] * TILE_HEIGHT,
|
||||||
|
self.parent.map.position[2] * TILE_DEPTH,
|
||||||
|
]
|
||||||
|
aspectRatio = vw / vh
|
||||||
|
|
||||||
|
# Ease the lookAt target
|
||||||
|
for i in range(3):
|
||||||
|
self.lookAtTarget[i] += (lookAt[i] - self.lookAtTarget[i]) * ease
|
||||||
|
|
||||||
|
# Camera position is now based on the eased lookAtTarget
|
||||||
|
cameraPosition = (
|
||||||
|
self.lookAtTarget[0],
|
||||||
|
self.lookAtTarget[1] + self.yOffset,
|
||||||
|
self.lookAtTarget[2] + z
|
||||||
|
)
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION)
|
||||||
|
glLoadIdentity()
|
||||||
|
gluPerspective(self.fov, aspectRatio, 0.1, 1000.0)
|
||||||
|
glScalef(1.0, -1.0, 1.0) # Flip the projection matrix upside down
|
||||||
|
glMatrixMode(GL_MODELVIEW)
|
||||||
|
glLoadIdentity()
|
||||||
|
gluLookAt(
|
||||||
|
cameraPosition[0], cameraPosition[1], cameraPosition[2],
|
||||||
|
self.lookAtTarget[0], self.lookAtTarget[1], self.lookAtTarget[2],
|
||||||
|
0.0, 1.0, 0.0
|
||||||
|
)
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QGridLayout, QTreeWidget, QTreeWidgetItem, QComboBox
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, TILE_SHAPES
|
||||||
|
|
||||||
|
class ChunkPanel(QWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
|
||||||
|
# Tile shape dropdown
|
||||||
|
self.tileShapeDropdown = QComboBox()
|
||||||
|
self.tileShapeDropdown.addItems(TILE_SHAPES.keys())
|
||||||
|
self.tileShapeDropdown.setToolTip("Tile Shape")
|
||||||
|
layout.addWidget(self.tileShapeDropdown)
|
||||||
|
|
||||||
|
# Add expandable tree list
|
||||||
|
self.tree = QTreeWidget()
|
||||||
|
self.tree.setHeaderLabel("Chunks")
|
||||||
|
self.tree.expandAll() # Expand by default, remove if you want collapsed
|
||||||
|
layout.addWidget(self.tree) # Removed invalid stretch factor
|
||||||
|
|
||||||
|
# Add stretch so tree expands
|
||||||
|
layout.setStretchFactor(self.tree, 1)
|
||||||
|
|
||||||
|
# Event subscriptions
|
||||||
|
self.parent.map.onMapData.sub(self.onMapData)
|
||||||
|
self.parent.map.onPositionChange.sub(self.onPositionChange)
|
||||||
|
self.tileShapeDropdown.currentTextChanged.connect(self.onTileShapeChanged)
|
||||||
|
|
||||||
|
# For each chunk
|
||||||
|
for chunk in self.parent.map.chunks.values():
|
||||||
|
# Create tree element
|
||||||
|
item = QTreeWidgetItem(self.tree, ["Chunk ({}, {}, {})".format(chunk.x, chunk.y, chunk.z)])
|
||||||
|
chunk.chunkPanelTree = item
|
||||||
|
chunk.chunkPanelTree.setExpanded(True)
|
||||||
|
item.setData(0, 0, chunk) # Store chunk reference
|
||||||
|
|
||||||
|
chunk.onChunkData.sub(self.onChunkData)
|
||||||
|
|
||||||
|
def onMapData(self, data):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onPositionChange(self, pos):
|
||||||
|
self.updateChunkList()
|
||||||
|
|
||||||
|
tile = self.parent.map.getTileAtWorldPos(*self.parent.map.position)
|
||||||
|
if tile is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
key = "TILE_SHAPE_NULL"
|
||||||
|
for k, v in TILE_SHAPES.items():
|
||||||
|
if v != tile.shape:
|
||||||
|
continue
|
||||||
|
key = k
|
||||||
|
break
|
||||||
|
self.tileShapeDropdown.setCurrentText(key)
|
||||||
|
|
||||||
|
def onTileShapeChanged(self, shape_key):
|
||||||
|
tile = self.parent.map.getTileAtWorldPos(*self.parent.map.position)
|
||||||
|
|
||||||
|
if tile is None or shape_key not in TILE_SHAPES:
|
||||||
|
return
|
||||||
|
tile.setShape(TILE_SHAPES[shape_key])
|
||||||
|
|
||||||
|
def updateChunkList(self):
|
||||||
|
# Clear existing items
|
||||||
|
currentChunk = self.parent.map.getChunkAtWorldPos(*self.parent.map.position)
|
||||||
|
|
||||||
|
# Example tree items
|
||||||
|
for chunk in self.parent.map.chunks.values():
|
||||||
|
title = "Chunk ({}, {}, {})".format(chunk.x, chunk.y, chunk.z)
|
||||||
|
if chunk == currentChunk:
|
||||||
|
title += " [C]"
|
||||||
|
if chunk.isDirty():
|
||||||
|
title += " *"
|
||||||
|
item = chunk.chunkPanelTree
|
||||||
|
item.setText(0, title)
|
||||||
|
|
||||||
|
def onChunkData(self, chunk):
|
||||||
|
self.updateChunkList()
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QComboBox, QHBoxLayout, QPushButton, QLineEdit, QListWidget, QListWidgetItem
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from tools.dusk.entity import Entity
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, ENTITY_TYPES, ENTITY_TYPE_NULL
|
||||||
|
|
||||||
|
class EntityPanel(QWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
# Top panel placeholder
|
||||||
|
topWidget = QLabel("Entity Editor")
|
||||||
|
layout.addWidget(topWidget)
|
||||||
|
|
||||||
|
# Name input
|
||||||
|
nameLayout = QHBoxLayout()
|
||||||
|
nameLabel = QLabel("Name:")
|
||||||
|
self.nameInput = QLineEdit()
|
||||||
|
nameLayout.addWidget(nameLabel)
|
||||||
|
nameLayout.addWidget(self.nameInput)
|
||||||
|
layout.addLayout(nameLayout)
|
||||||
|
|
||||||
|
# Entity Type dropdown (single selection)
|
||||||
|
typeLayout = QHBoxLayout()
|
||||||
|
typeLabel = QLabel("Type:")
|
||||||
|
self.typeDropdown = QComboBox()
|
||||||
|
self.typeDropdown.addItems(ENTITY_TYPES)
|
||||||
|
typeLayout.addWidget(typeLabel)
|
||||||
|
typeLayout.addWidget(self.typeDropdown)
|
||||||
|
layout.addLayout(typeLayout)
|
||||||
|
|
||||||
|
# Entity list and buttons
|
||||||
|
self.entityList = QListWidget()
|
||||||
|
self.entityList.addItems([])
|
||||||
|
layout.addWidget(self.entityList, stretch=1)
|
||||||
|
|
||||||
|
btnLayout = QHBoxLayout()
|
||||||
|
self.btnAdd = QPushButton("Add")
|
||||||
|
self.btnRemove = QPushButton("Remove")
|
||||||
|
btnLayout.addWidget(self.btnAdd)
|
||||||
|
btnLayout.addWidget(self.btnRemove)
|
||||||
|
layout.addLayout(btnLayout)
|
||||||
|
|
||||||
|
# Events
|
||||||
|
self.btnAdd.clicked.connect(self.onAddEntity)
|
||||||
|
self.btnRemove.clicked.connect(self.onRemoveEntity)
|
||||||
|
self.parent.map.onEntityData.sub(self.onEntityData)
|
||||||
|
self.parent.map.onPositionChange.sub(self.onPositionChange)
|
||||||
|
self.entityList.itemClicked.connect(self.onEntityClicked)
|
||||||
|
self.entityList.itemDoubleClicked.connect(self.onEntityDoubleClicked)
|
||||||
|
self.typeDropdown.currentIndexChanged.connect(self.onTypeSelected)
|
||||||
|
self.nameInput.textChanged.connect(self.onNameChanged)
|
||||||
|
|
||||||
|
# Call once to populate
|
||||||
|
self.onEntityData()
|
||||||
|
self.onEntityUnselect()
|
||||||
|
|
||||||
|
def onEntityUnselect(self):
|
||||||
|
self.entityList.setCurrentItem(None)
|
||||||
|
self.nameInput.setText("")
|
||||||
|
self.typeDropdown.setCurrentIndex(ENTITY_TYPE_NULL)
|
||||||
|
|
||||||
|
def onEntitySelect(self, entity):
|
||||||
|
self.entityList.setCurrentItem(entity.item)
|
||||||
|
self.nameInput.setText(entity.name)
|
||||||
|
self.typeDropdown.setCurrentIndex(entity.type)
|
||||||
|
|
||||||
|
def onEntityDoubleClicked(self, item):
|
||||||
|
entity = item.data(Qt.UserRole)
|
||||||
|
chunk = entity.chunk
|
||||||
|
worldX = (chunk.x * CHUNK_WIDTH) + entity.localX
|
||||||
|
worldY = (chunk.y * CHUNK_HEIGHT) + entity.localY
|
||||||
|
worldZ = (chunk.z * CHUNK_DEPTH) + entity.localZ
|
||||||
|
self.parent.map.moveTo(worldX, worldY, worldZ)
|
||||||
|
|
||||||
|
def onEntityClicked(self, item):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onAddEntity(self):
|
||||||
|
chunk = self.parent.map.getChunkAtWorldPos(*self.parent.map.position)
|
||||||
|
if chunk is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
localX = (self.parent.map.position[0] - (chunk.x * CHUNK_WIDTH)) % CHUNK_WIDTH
|
||||||
|
localY = (self.parent.map.position[1] - (chunk.y * CHUNK_HEIGHT)) % CHUNK_HEIGHT
|
||||||
|
localZ = (self.parent.map.position[2] - (chunk.z * CHUNK_DEPTH)) % CHUNK_DEPTH
|
||||||
|
|
||||||
|
# Make sure there's not already an entity here
|
||||||
|
for ent in chunk.entities.values():
|
||||||
|
if ent.localX == localX and ent.localY == localY and ent.localZ == localZ:
|
||||||
|
print("Entity already exists at this location")
|
||||||
|
return
|
||||||
|
|
||||||
|
ent = chunk.addEntity(localX, localY, localZ)
|
||||||
|
|
||||||
|
def onRemoveEntity(self):
|
||||||
|
item = self.entityList.currentItem()
|
||||||
|
if item is None:
|
||||||
|
return
|
||||||
|
entity = item.data(Qt.UserRole)
|
||||||
|
if entity:
|
||||||
|
chunk = entity.chunk
|
||||||
|
chunk.removeEntity(entity)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onEntityData(self):
|
||||||
|
self.onEntityUnselect()
|
||||||
|
self.entityList.clear()
|
||||||
|
for chunk in self.parent.map.chunks.values():
|
||||||
|
for id, entity in chunk.entities.items():
|
||||||
|
item = QListWidgetItem(entity.name)
|
||||||
|
item.setData(Qt.UserRole, entity) # Store the entity object
|
||||||
|
entity.item = item
|
||||||
|
self.entityList.addItem(item)
|
||||||
|
|
||||||
|
# Select if there is something at current position
|
||||||
|
self.onPositionChange(self.parent.map.position)
|
||||||
|
|
||||||
|
def onPositionChange(self, position):
|
||||||
|
self.onEntityUnselect()
|
||||||
|
|
||||||
|
# Get Entity at..
|
||||||
|
chunk = self.parent.map.getChunkAtWorldPos(*position)
|
||||||
|
if chunk is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
localX = (position[0] - (chunk.x * CHUNK_WIDTH)) % CHUNK_WIDTH
|
||||||
|
localY = (position[1] - (chunk.y * CHUNK_HEIGHT)) % CHUNK_HEIGHT
|
||||||
|
localZ = (position[2] - (chunk.z * CHUNK_DEPTH)) % CHUNK_DEPTH
|
||||||
|
|
||||||
|
for ent in chunk.entities.values():
|
||||||
|
if ent.localX != localX or ent.localY != localY or ent.localZ != localZ:
|
||||||
|
continue
|
||||||
|
self.onEntitySelect(ent)
|
||||||
|
self.entityList.setCurrentItem(ent.item)
|
||||||
|
break
|
||||||
|
|
||||||
|
def onTypeSelected(self, index):
|
||||||
|
item = self.entityList.currentItem()
|
||||||
|
if item is None:
|
||||||
|
return
|
||||||
|
entity = item.data(Qt.UserRole)
|
||||||
|
if entity:
|
||||||
|
entity.setType(index)
|
||||||
|
|
||||||
|
def onNameChanged(self, text):
|
||||||
|
item = self.entityList.currentItem()
|
||||||
|
if item is None:
|
||||||
|
return
|
||||||
|
entity = item.data(Qt.UserRole)
|
||||||
|
if entity:
|
||||||
|
entity.setName(text)
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
from PyQt5.QtCore import QTimer
|
||||||
|
from PyQt5.QtWidgets import QOpenGLWidget
|
||||||
|
from OpenGL.GL import *
|
||||||
|
from OpenGL.GLU import *
|
||||||
|
|
||||||
|
class GLWidget(QOpenGLWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.timer = QTimer(self)
|
||||||
|
self.timer.timeout.connect(self.update)
|
||||||
|
self.timer.start(16) # ~60 FPS
|
||||||
|
|
||||||
|
def initializeGL(self):
|
||||||
|
glClearColor(0.392, 0.584, 0.929, 1.0)
|
||||||
|
glEnable(GL_DEPTH_TEST)
|
||||||
|
glEnable(GL_BLEND)
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
||||||
|
glEnable(GL_POLYGON_OFFSET_FILL)
|
||||||
|
glPolygonOffset(1.0, 1.0)
|
||||||
|
glDisable(GL_POLYGON_OFFSET_FILL)
|
||||||
|
|
||||||
|
def resizeGL(self, w, h):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def paintGL(self):
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
||||||
|
glLoadIdentity()
|
||||||
|
|
||||||
|
w = self.width()
|
||||||
|
h = self.height()
|
||||||
|
if h <= 0:
|
||||||
|
h = 1
|
||||||
|
if w <= 0:
|
||||||
|
w = 1
|
||||||
|
|
||||||
|
glViewport(0, 0, w, h)
|
||||||
|
self.parent.camera.setup(w, h)
|
||||||
|
self.parent.grid.draw()
|
||||||
|
self.parent.map.draw()
|
||||||
|
self.parent.selectBox.draw()
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
from OpenGL.GL import *
|
||||||
|
from tools.dusk.defs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
|
||||||
|
|
||||||
|
class Grid:
|
||||||
|
def __init__(self, lines=1000):
|
||||||
|
self.cellWidth = TILE_WIDTH
|
||||||
|
self.cellHeight = TILE_HEIGHT
|
||||||
|
self.lines = lines
|
||||||
|
self.enabled = True
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
if not self.enabled:
|
||||||
|
return
|
||||||
|
center = [0.01,0.01,0.01]
|
||||||
|
halfWidth = self.cellWidth * self.lines // 2
|
||||||
|
halfHeight = self.cellHeight * self.lines // 2
|
||||||
|
# Draw origin axes
|
||||||
|
glBegin(GL_LINES)
|
||||||
|
|
||||||
|
# X axis - RED
|
||||||
|
glColor3f(1.0, 0.0, 0.0)
|
||||||
|
glVertex3f(center[0] - halfWidth, center[1], center[2])
|
||||||
|
glVertex3f(center[0] + halfWidth, center[1], center[2])
|
||||||
|
|
||||||
|
# Y axis - GREEN
|
||||||
|
glColor3f(0.0, 1.0, 0.0)
|
||||||
|
glVertex3f(center[0], center[1] - halfHeight, center[2])
|
||||||
|
glVertex3f(center[0], center[1] + halfHeight, center[2])
|
||||||
|
|
||||||
|
# Z axis - BLUE
|
||||||
|
glColor3f(0.0, 0.0, 1.0)
|
||||||
|
glVertex3f(center[0], center[1], center[2] - halfWidth)
|
||||||
|
glVertex3f(center[0], center[1], center[2] + halfWidth)
|
||||||
|
glEnd()
|
||||||
|
|
||||||
|
# Draw grid
|
||||||
|
glColor3f(0.8, 0.8, 0.8)
|
||||||
|
glBegin(GL_LINES)
|
||||||
|
for i in range(-self.lines // 2, self.lines // 2 + 1):
|
||||||
|
# Vertical lines
|
||||||
|
glVertex3f(center[0] + i * self.cellWidth, center[1] - halfHeight, center[2])
|
||||||
|
glVertex3f(center[0] + i * self.cellWidth, center[1] + halfHeight, center[2])
|
||||||
|
# Horizontal lines
|
||||||
|
glVertex3f(center[0] - halfWidth, center[1] + i * self.cellHeight, center[2])
|
||||||
|
glVertex3f(center[0] + halfWidth, center[1] + i * self.cellHeight, center[2])
|
||||||
|
glEnd()
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton, QHBoxLayout, QMessageBox
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH
|
||||||
|
|
||||||
|
class MapInfoPanel(QWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
|
# Components
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
mapTitleLabel = QLabel("Map Title")
|
||||||
|
self.mapTitleInput = QLineEdit()
|
||||||
|
layout.addWidget(mapTitleLabel)
|
||||||
|
layout.addWidget(self.mapTitleInput)
|
||||||
|
|
||||||
|
tilePositionLabel = QLabel("Tile Position")
|
||||||
|
layout.addWidget(tilePositionLabel)
|
||||||
|
tilePositionRow = QHBoxLayout()
|
||||||
|
self.tileXInput = QLineEdit()
|
||||||
|
self.tileXInput.setPlaceholderText("X")
|
||||||
|
tilePositionRow.addWidget(self.tileXInput)
|
||||||
|
self.tileYInput = QLineEdit()
|
||||||
|
self.tileYInput.setPlaceholderText("Y")
|
||||||
|
tilePositionRow.addWidget(self.tileYInput)
|
||||||
|
self.tileZInput = QLineEdit()
|
||||||
|
self.tileZInput.setPlaceholderText("Z")
|
||||||
|
tilePositionRow.addWidget(self.tileZInput)
|
||||||
|
self.tileGo = QPushButton("Go")
|
||||||
|
tilePositionRow.addWidget(self.tileGo)
|
||||||
|
layout.addLayout(tilePositionRow)
|
||||||
|
|
||||||
|
self.chunkPosLabel = QLabel()
|
||||||
|
layout.addWidget(self.chunkPosLabel)
|
||||||
|
self.chunkLabel = QLabel()
|
||||||
|
layout.addWidget(self.chunkLabel)
|
||||||
|
|
||||||
|
layout.addStretch()
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
# Events
|
||||||
|
self.tileGo.clicked.connect(self.goToPosition)
|
||||||
|
self.tileXInput.returnPressed.connect(self.goToPosition)
|
||||||
|
self.tileYInput.returnPressed.connect(self.goToPosition)
|
||||||
|
self.tileZInput.returnPressed.connect(self.goToPosition)
|
||||||
|
self.parent.map.onPositionChange.sub(self.updatePositionLabels)
|
||||||
|
self.parent.map.onMapData.sub(self.onMapData)
|
||||||
|
self.mapTitleInput.textChanged.connect(self.onMapNameChange)
|
||||||
|
|
||||||
|
# Initial label setting
|
||||||
|
self.updatePositionLabels(self.parent.map.position)
|
||||||
|
|
||||||
|
def goToPosition(self):
|
||||||
|
try:
|
||||||
|
x = int(self.tileXInput.text())
|
||||||
|
y = int(self.tileYInput.text())
|
||||||
|
z = int(self.tileZInput.text())
|
||||||
|
self.parent.map.moveTo(x, y, z)
|
||||||
|
except ValueError:
|
||||||
|
QMessageBox.warning(self, "Invalid Input", "Please enter valid integer coordinates.")
|
||||||
|
|
||||||
|
def updatePositionLabels(self, pos):
|
||||||
|
self.tileXInput.setText(str(pos[0]))
|
||||||
|
self.tileYInput.setText(str(pos[1]))
|
||||||
|
self.tileZInput.setText(str(pos[2]))
|
||||||
|
|
||||||
|
chunkTileX = pos[0] % CHUNK_WIDTH
|
||||||
|
chunkTileY = pos[1] % CHUNK_HEIGHT
|
||||||
|
chunkTileZ = pos[2] % CHUNK_DEPTH
|
||||||
|
chunkTileIndex = chunkTileX + chunkTileY * CHUNK_WIDTH + chunkTileZ * CHUNK_WIDTH * CHUNK_HEIGHT
|
||||||
|
self.chunkPosLabel.setText(f"Chunk Position: {chunkTileX}, {chunkTileY}, {chunkTileZ} ({chunkTileIndex})")
|
||||||
|
|
||||||
|
chunkX = pos[0] // CHUNK_WIDTH
|
||||||
|
chunkY = pos[1] // CHUNK_HEIGHT
|
||||||
|
chunkZ = pos[2] // CHUNK_DEPTH
|
||||||
|
self.chunkLabel.setText(f"Chunk: {chunkX}, {chunkY}, {chunkZ}")
|
||||||
|
|
||||||
|
def onMapData(self, data):
|
||||||
|
self.updatePositionLabels(self.parent.map.position)
|
||||||
|
self.mapTitleInput.setText(data.get("mapName", ""))
|
||||||
|
|
||||||
|
def onMapNameChange(self, text):
|
||||||
|
self.parent.map.data['mapName'] = text
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QGridLayout, QPushButton, QTabWidget, QLabel
|
||||||
|
from tools.editor.map.chunkpanel import ChunkPanel
|
||||||
|
from tools.editor.map.entitypanel import EntityPanel
|
||||||
|
from tools.editor.map.regionpanel import RegionPanel
|
||||||
|
|
||||||
|
class MapLeftPanel(QWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
# Nav buttons
|
||||||
|
self.chunkInfoLabel = QLabel("Tile Information")
|
||||||
|
layout.addWidget(self.chunkInfoLabel)
|
||||||
|
grid = QGridLayout()
|
||||||
|
self.btnUp = QPushButton("U")
|
||||||
|
self.btnN = QPushButton("N")
|
||||||
|
self.btnDown = QPushButton("D")
|
||||||
|
self.btnW = QPushButton("W")
|
||||||
|
self.btnS = QPushButton("S")
|
||||||
|
self.btnE = QPushButton("E")
|
||||||
|
|
||||||
|
grid.addWidget(self.btnUp, 0, 0)
|
||||||
|
grid.addWidget(self.btnN, 0, 1)
|
||||||
|
grid.addWidget(self.btnDown, 0, 2)
|
||||||
|
grid.addWidget(self.btnW, 1, 0)
|
||||||
|
grid.addWidget(self.btnS, 1, 1)
|
||||||
|
grid.addWidget(self.btnE, 1, 2)
|
||||||
|
layout.addLayout(grid)
|
||||||
|
|
||||||
|
# Panels
|
||||||
|
self.chunkPanel = ChunkPanel(self.parent)
|
||||||
|
self.entityPanel = EntityPanel(self.parent)
|
||||||
|
self.regionPanel = RegionPanel(self.parent)
|
||||||
|
|
||||||
|
# Tabs
|
||||||
|
self.tabs = QTabWidget()
|
||||||
|
self.tabs.addTab(self.chunkPanel, "Tiles")
|
||||||
|
self.tabs.addTab(self.entityPanel, "Entities")
|
||||||
|
self.tabs.addTab(self.regionPanel, "Regions")
|
||||||
|
self.tabs.addTab(None, "Triggers")
|
||||||
|
layout.addWidget(self.tabs)
|
||||||
|
|
||||||
|
# Event subscriptions
|
||||||
|
self.btnN.clicked.connect(lambda: self.parent.map.moveRelative(0, -1, 0))
|
||||||
|
self.btnS.clicked.connect(lambda: self.parent.map.moveRelative(0, 1, 0))
|
||||||
|
self.btnE.clicked.connect(lambda: self.parent.map.moveRelative(1, 0, 0))
|
||||||
|
self.btnW.clicked.connect(lambda: self.parent.map.moveRelative(-1, 0, 0))
|
||||||
|
self.btnUp.clicked.connect(lambda: self.parent.map.moveRelative(0, 0, 1))
|
||||||
|
self.btnDown.clicked.connect(lambda: self.parent.map.moveRelative(0, 0, -1))
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import os
|
||||||
|
from PyQt5.QtWidgets import QAction, QMenuBar, QFileDialog
|
||||||
|
from PyQt5.QtGui import QKeySequence
|
||||||
|
from tools.dusk.map import MAP_DEFAULT_PATH
|
||||||
|
|
||||||
|
class MapMenubar:
|
||||||
|
def __init__(self, parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.menubar = QMenuBar(parent)
|
||||||
|
parent.setMenuBar(self.menubar)
|
||||||
|
|
||||||
|
self.fileMenu = self.menubar.addMenu("File")
|
||||||
|
self.actionNew = QAction("New", parent)
|
||||||
|
self.actionOpen = QAction("Open", parent)
|
||||||
|
self.actionSave = QAction("Save", parent)
|
||||||
|
self.actionSaveAs = QAction("Save As", parent)
|
||||||
|
|
||||||
|
self.actionNew.setShortcut(QKeySequence("Ctrl+N"))
|
||||||
|
self.actionOpen.setShortcut(QKeySequence("Ctrl+O"))
|
||||||
|
self.actionSave.setShortcut(QKeySequence("Ctrl+S"))
|
||||||
|
self.actionSaveAs.setShortcut(QKeySequence("Ctrl+Shift+S"))
|
||||||
|
|
||||||
|
self.actionNew.triggered.connect(self.newFile)
|
||||||
|
self.actionOpen.triggered.connect(self.openFile)
|
||||||
|
self.actionSave.triggered.connect(self.saveFile)
|
||||||
|
self.actionSaveAs.triggered.connect(self.saveAsFile)
|
||||||
|
self.fileMenu.addAction(self.actionNew)
|
||||||
|
self.fileMenu.addAction(self.actionOpen)
|
||||||
|
self.fileMenu.addAction(self.actionSave)
|
||||||
|
self.fileMenu.addAction(self.actionSaveAs)
|
||||||
|
|
||||||
|
def newFile(self):
|
||||||
|
self.parent.map.newFile()
|
||||||
|
|
||||||
|
def openFile(self):
|
||||||
|
filePath, _ = QFileDialog.getOpenFileName(self.menubar, "Open Map File", MAP_DEFAULT_PATH, "Map Files (*.json)")
|
||||||
|
if filePath:
|
||||||
|
self.parent.map.load(filePath)
|
||||||
|
|
||||||
|
def saveFile(self):
|
||||||
|
self.parent.map.save()
|
||||||
|
|
||||||
|
def saveAsFile(self):
|
||||||
|
filePath, _ = QFileDialog.getSaveFileName(self.menubar, "Save Map File As", MAP_DEFAULT_PATH, "Map Files (*.json)")
|
||||||
|
if filePath:
|
||||||
|
self.parent.map.save(filePath)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QComboBox, QHBoxLayout, QPushButton, QLineEdit, QListWidget, QListWidgetItem
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from tools.dusk.entity import Entity
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, ENTITY_TYPES, ENTITY_TYPE_NULL
|
||||||
|
|
||||||
|
class RegionPanel(QWidget):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
layout = QVBoxLayout(self)
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
# Top panel placeholder
|
||||||
|
topWidget = QLabel("Region Editor")
|
||||||
|
layout.addWidget(topWidget)
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import OpenGL.GL as gl
|
||||||
|
from tools.dusk.defs import defs
|
||||||
|
import colorsys
|
||||||
|
from tools.dusk.defs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
|
||||||
|
|
||||||
|
class SelectBox:
|
||||||
|
def __init__(self, parent):
|
||||||
|
self.parent = parent
|
||||||
|
self.hue = 0.0
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
position = [
|
||||||
|
self.parent.map.position[0] * TILE_WIDTH - (TILE_WIDTH / 2.0),
|
||||||
|
self.parent.map.position[1] * TILE_HEIGHT - (TILE_HEIGHT / 2.0),
|
||||||
|
self.parent.map.position[2] * TILE_DEPTH - (TILE_DEPTH / 2.0)
|
||||||
|
]
|
||||||
|
|
||||||
|
vertices = [
|
||||||
|
(position[0], position[1], position[2]),
|
||||||
|
(position[0]+TILE_WIDTH, position[1], position[2]),
|
||||||
|
(position[0]+TILE_WIDTH, position[1]+TILE_HEIGHT, position[2]),
|
||||||
|
(position[0], position[1]+TILE_HEIGHT, position[2]),
|
||||||
|
(position[0], position[1], position[2]+TILE_DEPTH),
|
||||||
|
(position[0]+TILE_WIDTH, position[1], position[2]+TILE_DEPTH),
|
||||||
|
(position[0]+TILE_WIDTH, position[1]+TILE_HEIGHT, position[2]+TILE_DEPTH),
|
||||||
|
(position[0], position[1]+TILE_HEIGHT, position[2]+TILE_DEPTH)
|
||||||
|
]
|
||||||
|
edges = [
|
||||||
|
(0, 1), (1, 2), (2, 3), (3, 0), # bottom face
|
||||||
|
(4, 5), (5, 6), (6, 7), (7, 4), # top face
|
||||||
|
(4, 5), (5, 6), (6, 7), (7, 4), # top face
|
||||||
|
(0, 4), (1, 5), (2, 6), (3, 7) # vertical edges
|
||||||
|
]
|
||||||
|
|
||||||
|
# Cycle hue
|
||||||
|
self.hue = (self.hue + 0.01) % 1.0
|
||||||
|
r, g, b = colorsys.hsv_to_rgb(self.hue, 1.0, 1.0)
|
||||||
|
gl.glColor3f(r, g, b)
|
||||||
|
gl.glLineWidth(2.0)
|
||||||
|
gl.glBegin(gl.GL_LINES)
|
||||||
|
for edge in edges:
|
||||||
|
for vertex in edge:
|
||||||
|
gl.glVertex3f(*vertices[vertex])
|
||||||
|
gl.glEnd()
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
from PyQt5.QtWidgets import QStatusBar, QLabel
|
||||||
|
|
||||||
|
class StatusBar(QStatusBar):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.leftLabel = QLabel("")
|
||||||
|
self.rightLabel = QLabel("")
|
||||||
|
self.addWidget(self.leftLabel, 1)
|
||||||
|
self.addPermanentWidget(self.rightLabel)
|
||||||
|
|
||||||
|
parent.map.onMapData.sub(self.onMapData)
|
||||||
|
|
||||||
|
def setStatus(self, message):
|
||||||
|
self.leftLabel.setText(message)
|
||||||
|
|
||||||
|
def onMapData(self, data):
|
||||||
|
self.rightLabel.setText(self.parent.map.mapFileName if self.parent.map.mapFileName else "Untitled.json")
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
from OpenGL.GL import *
|
||||||
|
import array
|
||||||
|
|
||||||
|
class VertexBuffer:
|
||||||
|
def __init__(self, componentsPerVertex=3):
|
||||||
|
self.componentsPerVertex = componentsPerVertex
|
||||||
|
self.vertices = []
|
||||||
|
self.colors = []
|
||||||
|
self.uvs = []
|
||||||
|
self.data = None
|
||||||
|
self.colorData = None
|
||||||
|
self.uvData = None
|
||||||
|
|
||||||
|
def buildData(self):
|
||||||
|
hasColors = len(self.colors) > 0
|
||||||
|
hasUvs = len(self.uvs) > 0
|
||||||
|
|
||||||
|
vertexCount = len(self.vertices) // self.componentsPerVertex
|
||||||
|
|
||||||
|
dataList = []
|
||||||
|
colorList = []
|
||||||
|
uvList = []
|
||||||
|
|
||||||
|
for i in range(vertexCount):
|
||||||
|
vStart = i * self.componentsPerVertex
|
||||||
|
dataList.extend(self.vertices[vStart:vStart+self.componentsPerVertex])
|
||||||
|
|
||||||
|
if hasColors:
|
||||||
|
cStart = i * 4 # Assuming RGBA
|
||||||
|
colorList.extend(self.colors[cStart:cStart+4])
|
||||||
|
|
||||||
|
if hasUvs:
|
||||||
|
uStart = i * 2 # Assuming UV
|
||||||
|
uvList.extend(self.uvs[uStart:uStart+2])
|
||||||
|
|
||||||
|
self.data = array.array('f', dataList)
|
||||||
|
|
||||||
|
if hasColors:
|
||||||
|
self.colorData = array.array('f', colorList)
|
||||||
|
else:
|
||||||
|
self.colorData = None
|
||||||
|
|
||||||
|
if hasUvs:
|
||||||
|
self.uvData = array.array('f', uvList)
|
||||||
|
else:
|
||||||
|
self.uvData = None
|
||||||
|
|
||||||
|
def draw(self, mode=GL_TRIANGLES, count=-1):
|
||||||
|
if count == -1:
|
||||||
|
count = len(self.data) // self.componentsPerVertex
|
||||||
|
|
||||||
|
if count == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY)
|
||||||
|
glVertexPointer(self.componentsPerVertex, GL_FLOAT, 0, self.data.tobytes())
|
||||||
|
|
||||||
|
if self.colorData:
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY)
|
||||||
|
glColorPointer(4, GL_FLOAT, 0, self.colorData.tobytes())
|
||||||
|
|
||||||
|
if self.uvData:
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, 0, self.uvData.tobytes())
|
||||||
|
|
||||||
|
glDrawArrays(mode, 0, count)
|
||||||
|
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY)
|
||||||
|
if self.colorData:
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY)
|
||||||
|
if self.uvData:
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.vertices = []
|
||||||
|
self.colors = []
|
||||||
|
self.uvs = []
|
||||||
|
self.data = array.array('f')
|
||||||
|
self.colorData = None
|
||||||
|
self.uvData = None
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import os
|
||||||
|
from PyQt5.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QMessageBox
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
from tools.editor.map.glwidget import GLWidget
|
||||||
|
from tools.editor.map.mapleftpanel import MapLeftPanel
|
||||||
|
from tools.editor.map.mapinfopanel import MapInfoPanel
|
||||||
|
from tools.editor.map.menubar import MapMenubar
|
||||||
|
from tools.editor.map.statusbar import StatusBar
|
||||||
|
from tools.dusk.map import Map
|
||||||
|
from tools.dusk.defs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, TILE_SHAPE_NULL, TILE_SHAPE_FLOOR
|
||||||
|
from tools.editor.map.selectbox import SelectBox
|
||||||
|
from tools.editor.map.camera import Camera
|
||||||
|
from tools.editor.map.grid import Grid
|
||||||
|
|
||||||
|
class MapWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.insertPressed = False
|
||||||
|
self.deletePressed = False
|
||||||
|
|
||||||
|
# Subclasses
|
||||||
|
self.map = Map(self)
|
||||||
|
self.camera = Camera(self)
|
||||||
|
self.grid = Grid()
|
||||||
|
self.selectBox = SelectBox(self)
|
||||||
|
|
||||||
|
# Window setup
|
||||||
|
self.setWindowTitle("Dusk Map Editor")
|
||||||
|
self.resize(1600, 900)
|
||||||
|
|
||||||
|
# Menubar (TESTING)
|
||||||
|
self.menubar = MapMenubar(self)
|
||||||
|
|
||||||
|
central = QWidget()
|
||||||
|
self.setCentralWidget(central)
|
||||||
|
mainLayout = QHBoxLayout(central)
|
||||||
|
|
||||||
|
# Left panel (tabs + nav buttons)
|
||||||
|
self.leftPanel = MapLeftPanel(self)
|
||||||
|
self.leftPanel.setFixedWidth(350)
|
||||||
|
mainLayout.addWidget(self.leftPanel)
|
||||||
|
|
||||||
|
# Center panel (GLWidget + controls)
|
||||||
|
self.glWidget = GLWidget(self)
|
||||||
|
mainLayout.addWidget(self.glWidget, stretch=3)
|
||||||
|
|
||||||
|
# Right panel (MapInfoPanel)
|
||||||
|
self.mapInfoPanel = MapInfoPanel(self)
|
||||||
|
rightWidget = self.mapInfoPanel
|
||||||
|
rightWidget.setFixedWidth(250)
|
||||||
|
mainLayout.addWidget(rightWidget)
|
||||||
|
|
||||||
|
# Status bar
|
||||||
|
self.statusBar = StatusBar(self)
|
||||||
|
self.setStatusBar(self.statusBar)
|
||||||
|
|
||||||
|
self.installEventFilter(self)
|
||||||
|
self.installEventFilterRecursively(self)
|
||||||
|
|
||||||
|
def installEventFilterRecursively(self, widget):
|
||||||
|
for child in widget.findChildren(QWidget):
|
||||||
|
child.installEventFilter(self)
|
||||||
|
self.installEventFilterRecursively(child)
|
||||||
|
|
||||||
|
def closeEvent(self, event):
|
||||||
|
if not self.map.isDirty():
|
||||||
|
event.accept()
|
||||||
|
return
|
||||||
|
|
||||||
|
reply = QMessageBox.question(
|
||||||
|
self,
|
||||||
|
"Unsaved Changes",
|
||||||
|
"You have unsaved changes. Do you want to save before closing?",
|
||||||
|
QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel,
|
||||||
|
QMessageBox.Save
|
||||||
|
)
|
||||||
|
if reply == QMessageBox.Save:
|
||||||
|
self.map.save()
|
||||||
|
elif reply == QMessageBox.Cancel:
|
||||||
|
event.ignore()
|
||||||
|
return
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
def eventFilter(self, obj, event):
|
||||||
|
if event.type() == event.KeyPress:
|
||||||
|
amtX, amtY, amtZ = 0, 0, 0
|
||||||
|
|
||||||
|
key = event.key()
|
||||||
|
if key == Qt.Key_Left:
|
||||||
|
amtX = -1
|
||||||
|
elif key == Qt.Key_Right:
|
||||||
|
amtX = 1
|
||||||
|
elif key == Qt.Key_Up:
|
||||||
|
amtY = -1
|
||||||
|
elif key == Qt.Key_Down:
|
||||||
|
amtY = 1
|
||||||
|
elif key == Qt.Key_PageUp:
|
||||||
|
amtZ = 1
|
||||||
|
elif key == Qt.Key_PageDown:
|
||||||
|
amtZ = -1
|
||||||
|
|
||||||
|
if event.modifiers() & Qt.ShiftModifier:
|
||||||
|
amtX *= CHUNK_WIDTH
|
||||||
|
amtY *= CHUNK_HEIGHT
|
||||||
|
amtZ *= CHUNK_DEPTH
|
||||||
|
|
||||||
|
if amtX != 0 or amtY != 0 or amtZ != 0:
|
||||||
|
self.map.moveRelative(amtX, amtY, amtZ)
|
||||||
|
if self.insertPressed:
|
||||||
|
tile = self.map.getTileAtWorldPos(*self.map.position)
|
||||||
|
if tile is not None and tile.shape == TILE_SHAPE_NULL:
|
||||||
|
tile.setShape(TILE_SHAPE_FLOOR)
|
||||||
|
if self.deletePressed:
|
||||||
|
tile = self.map.getTileAtWorldPos(*self.map.position)
|
||||||
|
if tile is not None:
|
||||||
|
tile.setShape(TILE_SHAPE_NULL)
|
||||||
|
event.accept()
|
||||||
|
return True
|
||||||
|
|
||||||
|
if key == Qt.Key_Delete:
|
||||||
|
tile = self.map.getTileAtWorldPos(*self.map.position)
|
||||||
|
self.deletePressed = True
|
||||||
|
if tile is not None:
|
||||||
|
tile.setShape(TILE_SHAPE_NULL)
|
||||||
|
event.accept()
|
||||||
|
return True
|
||||||
|
if key == Qt.Key_Insert:
|
||||||
|
tile = self.map.getTileAtWorldPos(*self.map.position)
|
||||||
|
self.insertPressed = True
|
||||||
|
if tile is not None and tile.shape == TILE_SHAPE_NULL:
|
||||||
|
tile.setShape(TILE_SHAPE_FLOOR)
|
||||||
|
event.accept()
|
||||||
|
elif event.type() == event.KeyRelease:
|
||||||
|
key = event.key()
|
||||||
|
if key == Qt.Key_Delete:
|
||||||
|
self.deletePressed = False
|
||||||
|
event.accept()
|
||||||
|
return True
|
||||||
|
if key == Qt.Key_Insert:
|
||||||
|
self.insertPressed = False
|
||||||
|
event.accept()
|
||||||
|
return super().eventFilter(obj, event)
|
||||||
@@ -4,11 +4,10 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
assetalphaimage.c
|
assettexture.c
|
||||||
assetpaletteimage.c
|
assettileset.c
|
||||||
assetlanguage.c
|
assetlanguage.c
|
||||||
assetmap.c
|
assetscript.c
|
||||||
assetchunk.c
|
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "asset/asset.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
#include "locale/localemanager.h"
|
||||||
|
|
||||||
|
errorret_t assetLanguageHandler(assetcustom_t custom) {
|
||||||
|
assertNotNull(custom.zipFile, "Custom asset zip file cannot be NULL");
|
||||||
|
assertNotNull(custom.output, "Custom asset output cannot be NULL");
|
||||||
|
|
||||||
|
assetlanguage_t *lang = (assetlanguage_t *)custom.output;
|
||||||
|
errorChain(assetLanguageInit(lang, custom.zipFile));
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
errorret_t assetLanguageInit(
|
||||||
|
assetlanguage_t *lang,
|
||||||
|
zip_file_t *zipFile
|
||||||
|
) {
|
||||||
|
errorThrow("Language asset initialization is not yet implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
errorret_t assetLanguageRead(
|
||||||
|
assetlanguage_t *lang,
|
||||||
|
const uint32_t key,
|
||||||
|
char_t *buffer,
|
||||||
|
const uint32_t bufferSize,
|
||||||
|
uint32_t *outLength
|
||||||
|
) {
|
||||||
|
errorThrow("Language string reading is not yet implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void assetLanguageDispose(assetlanguage_t *lang) {
|
||||||
|
assertNotNull(lang, "Language asset cannot be NULL");
|
||||||
|
|
||||||
|
if(lang->zip) {
|
||||||
|
zip_fclose(lang->zip);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,39 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "locale/language/keys.h"
|
|
||||||
#include "error/error.h"
|
#include "error/error.h"
|
||||||
|
#include "duskdefs.h"
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
|
|
||||||
#define ASSET_LANG_CHUNK_CHAR_COUNT 6 * 1024 // 6 KB per chunk
|
|
||||||
#define ASSET_LANG_CHUNK_CACHE 4 // Number of chunks to cache in memory
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
typedef char assetlanguagechunk_t[ASSET_LANG_CHUNK_CHAR_COUNT];
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
typedef struct {
|
|
||||||
uint32_t chunk;
|
|
||||||
uint32_t offset;
|
|
||||||
uint32_t length;
|
|
||||||
} assetlanguagestring_t;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
typedef struct {
|
|
||||||
assetlanguagestring_t strings[LANG_KEY_COUNT];
|
|
||||||
} assetlanguageheader_t;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
zip_file_t *zip;
|
zip_file_t *zip;
|
||||||
assetlanguageheader_t header;
|
|
||||||
zip_int64_t chunksOffset;
|
zip_int64_t chunksOffset;
|
||||||
|
|
||||||
// Chunk cache
|
|
||||||
assetlanguagechunk_t chunks[ASSET_LANG_CHUNK_CACHE];
|
|
||||||
uint32_t chunkIndices[ASSET_LANG_CHUNK_CACHE];
|
|
||||||
} assetlanguage_t;
|
} assetlanguage_t;
|
||||||
|
|
||||||
typedef struct assetcustom_s assetcustom_t;
|
typedef struct assetcustom_s assetcustom_t;
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "asset/asset.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
|
||||||
|
errorret_t assetScriptHandler(assetcustom_t custom) {
|
||||||
|
assertNotNull(custom.zipFile, "Custom asset zip file cannot be NULL");
|
||||||
|
assertNotNull(custom.output, "Custom asset output cannot be NULL");
|
||||||
|
|
||||||
|
assetscript_t *script = (assetscript_t *)custom.output;
|
||||||
|
errorChain(assetScriptInit(script, custom.zipFile));
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
errorret_t assetScriptInit(
|
||||||
|
assetscript_t *script,
|
||||||
|
zip_file_t *zipFile
|
||||||
|
) {
|
||||||
|
assertNotNull(script, "Script asset cannot be NULL");
|
||||||
|
assertNotNull(zipFile, "Zip file cannot be NULL");
|
||||||
|
|
||||||
|
// We now own the zip file handle.
|
||||||
|
script->zip = zipFile;
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char_t * assetScriptReader(lua_State* lState, void* data, size_t* size) {
|
||||||
|
assetscript_t *script = (assetscript_t *)data;
|
||||||
|
zip_int64_t bytesRead = zip_fread(
|
||||||
|
script->zip, script->buffer, sizeof(script->buffer)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(bytesRead < 0) {
|
||||||
|
*size = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*size = (size_t)bytesRead;
|
||||||
|
return script->buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorret_t assetScriptDispose(assetscript_t *script) {
|
||||||
|
assertNotNull(script, "Script asset cannot be NULL");
|
||||||
|
|
||||||
|
if(script->zip != NULL) {
|
||||||
|
zip_fclose(script->zip);
|
||||||
|
script->zip = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
|
#include "duskdefs.h"
|
||||||
|
#include <zip.h>
|
||||||
|
#include "script/scriptcontext.h"
|
||||||
|
|
||||||
|
#define ASSET_SCRIPT_BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
typedef struct assetscript_s {
|
||||||
|
zip_file_t *zip;
|
||||||
|
char_t buffer[ASSET_SCRIPT_BUFFER_SIZE];
|
||||||
|
} assetscript_t;
|
||||||
|
|
||||||
|
typedef struct assetcustom_s assetcustom_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receiving function from the asset manager to handle script assets.
|
||||||
|
*
|
||||||
|
* @param custom Custom asset loading data.
|
||||||
|
* @return Error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetScriptHandler(assetcustom_t custom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a script asset.
|
||||||
|
*
|
||||||
|
* @param script Script asset to initialize.
|
||||||
|
* @param zipFile Zip file handle for the script asset.
|
||||||
|
* @return Error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetScriptInit(assetscript_t *script, zip_file_t *zipFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reader function for Lua to read script data from the asset.
|
||||||
|
*
|
||||||
|
* @param L Lua state.
|
||||||
|
* @param data Pointer to the assetscript_t structure.
|
||||||
|
* @param size Pointer to store the size of the read data.
|
||||||
|
* @return Pointer to the read data buffer.
|
||||||
|
*/
|
||||||
|
const char_t * assetScriptReader(lua_State* L, void* data, size_t* size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disposes of a script asset, freeing any allocated resources.
|
||||||
|
*
|
||||||
|
* @param script Script asset to dispose of.
|
||||||
|
* @return Error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetScriptDispose(assetscript_t *script);
|
||||||
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "assettexture.h"
|
||||||
|
#include "asset/assettype.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
#include "display/texture/texture.h"
|
||||||
|
#include "util/endian.h"
|
||||||
|
|
||||||
|
errorret_t assetTextureLoad(assetentire_t entire) {
|
||||||
|
assertNotNull(entire.data, "Data pointer cannot be NULL.");
|
||||||
|
assertNotNull(entire.output, "Output pointer cannot be NULL.");
|
||||||
|
|
||||||
|
assettexture_t *assetData = (assettexture_t *)entire.data;
|
||||||
|
texture_t *texture = (texture_t *)entire.output;
|
||||||
|
|
||||||
|
// Read header and version (first 4 bytes)
|
||||||
|
if(
|
||||||
|
assetData->header[0] != 'D' ||
|
||||||
|
assetData->header[1] != 'T' ||
|
||||||
|
assetData->header[2] != 'X'
|
||||||
|
) {
|
||||||
|
errorThrow("Invalid texture header");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version (can only be 1 atm)
|
||||||
|
if(assetData->version != 0x01) {
|
||||||
|
errorThrow("Unsupported texture version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix endian
|
||||||
|
assetData->width = endianLittleToHost32(assetData->width);
|
||||||
|
assetData->height = endianLittleToHost32(assetData->height);
|
||||||
|
|
||||||
|
// Check dimensions.
|
||||||
|
if(
|
||||||
|
assetData->width == 0 || assetData->width > ASSET_TEXTURE_WIDTH_MAX ||
|
||||||
|
assetData->height == 0 || assetData->height > ASSET_TEXTURE_HEIGHT_MAX
|
||||||
|
) {
|
||||||
|
errorThrow("Invalid texture dimensions");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate format
|
||||||
|
textureformat_t format;
|
||||||
|
texturedata_t data;
|
||||||
|
|
||||||
|
switch(assetData->type) {
|
||||||
|
case 0x00: // RGBA8888
|
||||||
|
format = TEXTURE_FORMAT_RGBA;
|
||||||
|
data.rgbaColors = (color_t *)assetData->data;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// case 0x01:
|
||||||
|
// format = TEXTURE_FORMAT_RGB;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case 0x02:
|
||||||
|
// format = TEXTURE_FORMAT_RGB565;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case 0x03:
|
||||||
|
// format = TEXTURE_FORMAT_RGB5A3;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
errorThrow("Unsupported texture format");
|
||||||
|
}
|
||||||
|
|
||||||
|
errorChain(textureInit(
|
||||||
|
texture, assetData->width, assetData->height, format, data
|
||||||
|
));
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
|
#include "display/color.h"
|
||||||
|
|
||||||
|
#define ASSET_TEXTURE_WIDTH_MAX 2048
|
||||||
|
#define ASSET_TEXTURE_HEIGHT_MAX 2048
|
||||||
|
#define ASSET_TEXTURE_SIZE_MAX ( \
|
||||||
|
ASSET_TEXTURE_WIDTH_MAX * ASSET_TEXTURE_HEIGHT_MAX \
|
||||||
|
)
|
||||||
|
|
||||||
|
typedef struct assetentire_s assetentire_t;
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct {
|
||||||
|
char_t header[3];
|
||||||
|
uint8_t version;
|
||||||
|
uint8_t type;
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint8_t data[ASSET_TEXTURE_SIZE_MAX * sizeof(color4b_t)];
|
||||||
|
} assettexture_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a palettized texture from the given data pointer into the output
|
||||||
|
* texture.
|
||||||
|
*
|
||||||
|
* @param data Pointer to the raw assettexture_t data.
|
||||||
|
* @param output Pointer to the texture_t to load the image into.
|
||||||
|
* @return An error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetTextureLoad(assetentire_t entire);
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "asset/asset.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
#include "display/texture/tileset.h"
|
||||||
|
#include "util/memory.h"
|
||||||
|
#include "util/endian.h"
|
||||||
|
|
||||||
|
errorret_t assetTilesetLoad(assetentire_t entire) {
|
||||||
|
assertNotNull(entire.data, "Asset data cannot be null");
|
||||||
|
assertNotNull(entire.output, "Asset output cannot be null");
|
||||||
|
|
||||||
|
assettileset_t *tilesetData = (assettileset_t *)entire.data;
|
||||||
|
tileset_t *tileset = (tileset_t *)entire.output;
|
||||||
|
|
||||||
|
if(
|
||||||
|
tilesetData->header[0] != 'D' ||
|
||||||
|
tilesetData->header[1] != 'T' ||
|
||||||
|
tilesetData->header[2] != 'F'
|
||||||
|
) {
|
||||||
|
errorThrow("Invalid tileset header");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tilesetData->version != 0x00) {
|
||||||
|
errorThrow("Unsupported tileset version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix endianness
|
||||||
|
tilesetData->tileWidth = endianLittleToHost16(tilesetData->tileWidth);
|
||||||
|
tilesetData->tileHeight = endianLittleToHost16(tilesetData->tileHeight);
|
||||||
|
tilesetData->columnCount = endianLittleToHost16(tilesetData->columnCount);
|
||||||
|
tilesetData->rowCount = endianLittleToHost16(tilesetData->rowCount);
|
||||||
|
tilesetData->right = endianLittleToHost16(tilesetData->right);
|
||||||
|
tilesetData->bottom = endianLittleToHost16(tilesetData->bottom);
|
||||||
|
|
||||||
|
if(tilesetData->tileWidth == 0) {
|
||||||
|
errorThrow("Tile width cannot be 0");
|
||||||
|
}
|
||||||
|
if(tilesetData->tileHeight == 0) {
|
||||||
|
errorThrow("Tile height cannot be 0");
|
||||||
|
}
|
||||||
|
if(tilesetData->columnCount == 0) {
|
||||||
|
errorThrow("Column count cannot be 0");
|
||||||
|
}
|
||||||
|
if(tilesetData->rowCount == 0) {
|
||||||
|
errorThrow("Row count cannot be 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
tilesetData->u0 = endianLittleToHostFloat(tilesetData->u0);
|
||||||
|
tilesetData->v0 = endianLittleToHostFloat(tilesetData->v0);
|
||||||
|
|
||||||
|
if(tilesetData->v0 < 0.0f || tilesetData->v0 > 1.0f) {
|
||||||
|
errorThrow("Invalid v0 value in tileset");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup tileset
|
||||||
|
tileset->tileWidth = tilesetData->tileWidth;
|
||||||
|
tileset->tileHeight = tilesetData->tileHeight;
|
||||||
|
tileset->tileCount = tilesetData->columnCount * tilesetData->rowCount;
|
||||||
|
tileset->columns = tilesetData->columnCount;
|
||||||
|
tileset->rows = tilesetData->rowCount;
|
||||||
|
tileset->uv[0] = tilesetData->u0;
|
||||||
|
tileset->uv[1] = tilesetData->v0;
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct {
|
||||||
|
char_t header[3];
|
||||||
|
uint8_t version;
|
||||||
|
uint16_t tileWidth;
|
||||||
|
uint16_t tileHeight;
|
||||||
|
uint16_t columnCount;
|
||||||
|
uint16_t rowCount;
|
||||||
|
uint16_t right;
|
||||||
|
uint16_t bottom;
|
||||||
|
float_t u0;
|
||||||
|
float_t v0;
|
||||||
|
} assettileset_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a tileset from the given data pointer into the output tileset.
|
||||||
|
*
|
||||||
|
* @param entire Data received from the asset loader system.
|
||||||
|
* @return An error code.
|
||||||
|
*/
|
||||||
|
errorret_t assetTilesetLoad(assetentire_t entire);
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
add_asset(MAP map)
|
add_subdirectory(testmap)
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
add_asset(LANGUAGE en_US.po)
|
add_asset(MAP testmap.json)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"shapes": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"name": "Test"
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "script/scriptcontext.h"
|
||||||
|
#include "debug/debug.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
#include "rpg/overworld/map.h"
|
||||||
|
|
||||||
|
int moduleMapLoad(lua_State *L) {
|
||||||
|
assertNotNull(L, "Lua state cannot be NULL");
|
||||||
|
|
||||||
|
if(!lua_isstring(L, 1)) {
|
||||||
|
luaL_error(L, "Expected string map filename");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Potentially provide up to 3 params
|
||||||
|
chunkpos_t initial = { .x = 0, .y = 0, .z = 0 };
|
||||||
|
if(lua_isnumber(L, 2)) {
|
||||||
|
initial.x = (chunkunit_t)lua_tonumber(L, 2);
|
||||||
|
}
|
||||||
|
if(lua_isnumber(L, 3)) {
|
||||||
|
initial.y = (chunkunit_t)lua_tonumber(L, 3);
|
||||||
|
}
|
||||||
|
if(lua_isnumber(L, 4)) {
|
||||||
|
initial.z = (chunkunit_t)lua_tonumber(L, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the map.
|
||||||
|
errorret_t ret = mapLoad(luaL_checkstring(L, 1), initial);
|
||||||
|
if(ret.code != ERROR_OK) {
|
||||||
|
luaL_error(L, "Failed to load map");
|
||||||
|
errorCatch(errorPrint(ret));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void moduleMapSystem(scriptcontext_t *context) {
|
||||||
|
assertNotNull(context, "Script context cannot be NULL");
|
||||||
|
|
||||||
|
lua_register(context->luaState, "mapLoad", moduleMapLoad);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) 2025 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
sdl2.c
|
||||||
|
psp.c
|
||||||
|
dolphin.c
|
||||||
|
)
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dolphin.h"
|
||||||
|
|
||||||
|
void displayInitDolphin(void) {
|
||||||
|
VIDEO_Init();
|
||||||
|
DISPLAY.screenMode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
DISPLAY.frameBuffer[0] = MEM_K0_TO_K1(
|
||||||
|
SYS_AllocateFramebuffer(DISPLAY.screenMode)
|
||||||
|
);
|
||||||
|
DISPLAY.frameBuffer[1] = MEM_K0_TO_K1(
|
||||||
|
SYS_AllocateFramebuffer(DISPLAY.screenMode)
|
||||||
|
);
|
||||||
|
VIDEO_Configure(DISPLAY.screenMode);
|
||||||
|
|
||||||
|
VIDEO_SetNextFramebuffer(DISPLAY.frameBuffer[DISPLAY.whichFrameBuffer]);
|
||||||
|
// VIDEO_SetPostRetraceCallback(copy_buffers);
|
||||||
|
VIDEO_SetBlack(FALSE);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if(DISPLAY.screenMode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
DISPLAY.fifoBuffer = memalign(32, DISPLAY_FIFO_SIZE);
|
||||||
|
memoryZero(DISPLAY.fifoBuffer, DISPLAY_FIFO_SIZE);
|
||||||
|
|
||||||
|
GX_Init(DISPLAY.fifoBuffer, DISPLAY_FIFO_SIZE);
|
||||||
|
|
||||||
|
// This seems to be mostly related to interlacing vs progressive
|
||||||
|
GX_SetViewport(
|
||||||
|
0, 0,
|
||||||
|
DISPLAY.screenMode->fbWidth, DISPLAY.screenMode->efbHeight,
|
||||||
|
0, 1
|
||||||
|
);
|
||||||
|
float_t yscale = GX_GetYScaleFactor(
|
||||||
|
DISPLAY.screenMode->efbHeight, DISPLAY.screenMode->xfbHeight
|
||||||
|
);
|
||||||
|
uint32_t xfbHeight = GX_SetDispCopyYScale(yscale);
|
||||||
|
GX_SetScissor(
|
||||||
|
0, 0,
|
||||||
|
DISPLAY.screenMode->fbWidth, DISPLAY.screenMode->efbHeight
|
||||||
|
);
|
||||||
|
GX_SetDispCopySrc(
|
||||||
|
0, 0,
|
||||||
|
DISPLAY.screenMode->fbWidth, DISPLAY.screenMode->efbHeight
|
||||||
|
);
|
||||||
|
GX_SetDispCopyDst(DISPLAY.screenMode->fbWidth, xfbHeight);
|
||||||
|
GX_SetCopyFilter(
|
||||||
|
DISPLAY.screenMode->aa,
|
||||||
|
DISPLAY.screenMode->sample_pattern,
|
||||||
|
GX_TRUE,
|
||||||
|
DISPLAY.screenMode->vfilter
|
||||||
|
);
|
||||||
|
GX_SetFieldMode(
|
||||||
|
DISPLAY.screenMode->field_rendering,
|
||||||
|
(
|
||||||
|
(DISPLAY.screenMode->viHeight == 2 * DISPLAY.screenMode->xfbHeight) ?
|
||||||
|
GX_ENABLE :
|
||||||
|
GX_DISABLE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Setup cull modes
|
||||||
|
GX_SetCullMode(GX_CULL_NONE);
|
||||||
|
GX_SetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE);
|
||||||
|
GX_CopyDisp(DISPLAY.frameBuffer[DISPLAY.whichFrameBuffer], GX_TRUE);
|
||||||
|
GX_SetDispCopyGamma(GX_GM_1_0);
|
||||||
|
|
||||||
|
GX_ClearVtxDesc();
|
||||||
|
GX_SetVtxDesc(GX_VA_POS, GX_INDEX16);
|
||||||
|
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX16);
|
||||||
|
GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX16);
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_U8, 0);
|
||||||
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayDolphinSwap(void) {
|
||||||
|
GX_DrawDone();
|
||||||
|
|
||||||
|
DISPLAY.whichFrameBuffer ^= 1;
|
||||||
|
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||||
|
GX_SetColorUpdate(GX_TRUE);
|
||||||
|
GX_CopyDisp(DISPLAY.frameBuffer[DISPLAY.whichFrameBuffer], GX_TRUE);
|
||||||
|
VIDEO_SetNextFramebuffer(DISPLAY.frameBuffer[DISPLAY.whichFrameBuffer]);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "dusk.h"
|
||||||
|
#include "display/displaydefs.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void *frameBuffer[2];// Double-Bufferred
|
||||||
|
int whichFrameBuffer;
|
||||||
|
GXRModeObj *screenMode;
|
||||||
|
void *fifoBuffer;
|
||||||
|
} displaydolphin_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the display for Dolphin.
|
||||||
|
*/
|
||||||
|
void displayDolphinInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swaps the back buffer to the front for Dolphin.
|
||||||
|
*/
|
||||||
|
void displayDolphinSwap(void);
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "psp.h"
|
||||||
|
|
||||||
|
void displayInitPSP(void) {
|
||||||
|
DISPLAY.usingShaderedPalettes = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the display for PSP.
|
||||||
|
*/
|
||||||
|
void displayInitPSP(void);
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdl2.h"
|
||||||
|
|
||||||
|
void displaySDL2Update(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void displaySDL2Swap(void) {
|
||||||
|
SDL_GL_SwapWindow(DISPLAY.window);
|
||||||
|
|
||||||
|
GLenum err;
|
||||||
|
while((err = glGetError()) != GL_NO_ERROR) {
|
||||||
|
debugPrint("GL Error: %d\n", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void displaySDL2Dispose(void) {
|
||||||
|
if(DISPLAY.glContext) {
|
||||||
|
SDL_GL_DeleteContext(DISPLAY.glContext);
|
||||||
|
DISPLAY.glContext = NULL;
|
||||||
|
}
|
||||||
|
if(DISPLAY.window) {
|
||||||
|
SDL_DestroyWindow(DISPLAY.window);
|
||||||
|
DISPLAY.window = NULL;
|
||||||
|
}
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "dusk.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SDL_Window *window;
|
||||||
|
SDL_GLContext glContext;
|
||||||
|
bool_t usingShaderedPalettes;
|
||||||
|
} displaysdl2_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the display for SDL2.
|
||||||
|
*/
|
||||||
|
void displaySDL2Init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the display for SDL2.
|
||||||
|
*/
|
||||||
|
void displaySDL2Update(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swaps the display buffers for SDL2.
|
||||||
|
*/
|
||||||
|
void displaySDL2Swap(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disposes of the display for SDL2.
|
||||||
|
*/
|
||||||
|
void displaySDL2Dispose(void);
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
rpg.c
|
rpg.c
|
||||||
rpgcamera.c
|
rpgcamera.c
|
||||||
rpgtextbox.c
|
rpgtextbox.c
|
||||||
@@ -14,4 +14,4 @@ target_sources(${DUSK_TARGET_NAME}
|
|||||||
# Subdirs
|
# Subdirs
|
||||||
add_subdirectory(cutscene)
|
add_subdirectory(cutscene)
|
||||||
add_subdirectory(entity)
|
add_subdirectory(entity)
|
||||||
add_subdirectory(world)
|
add_subdirectory(overworld)
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
cutscenesystem.c
|
cutscenesystem.c
|
||||||
cutscenemode.c
|
cutscenemode.c
|
||||||
)
|
)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
cutsceneitem.c
|
cutsceneitem.c
|
||||||
)
|
)
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
#include "cutscenewait.h"
|
#include "cutscenewait.h"
|
||||||
#include "cutscenecallback.h"
|
#include "cutscenecallback.h"
|
||||||
#include "cutscenetext.h"
|
#include "cutscenetext.h"
|
||||||
#include "cutscenecutscene.h"
|
|
||||||
|
typedef struct cutscene_s cutscene_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CUTSCENE_ITEM_TYPE_NULL,
|
CUTSCENE_ITEM_TYPE_NULL,
|
||||||
@@ -27,7 +28,7 @@ typedef struct cutsceneitem_s {
|
|||||||
cutscenetext_t text;
|
cutscenetext_t text;
|
||||||
cutscenecallback_t callback;
|
cutscenecallback_t callback;
|
||||||
cutscenewait_t wait;
|
cutscenewait_t wait;
|
||||||
const cutscenecutscene_t cutscene;
|
const cutscene_t *cutscene;
|
||||||
};
|
};
|
||||||
} cutsceneitem_t;
|
} cutsceneitem_t;
|
||||||
|
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
entity.c
|
entity.c
|
||||||
entityanim.c
|
entityanim.c
|
||||||
npc.c
|
npc.c
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "time/time.h"
|
#include "time/time.h"
|
||||||
#include "util/math.h"
|
#include "util/math.h"
|
||||||
#include "rpg/cutscene/cutscenemode.h"
|
#include "rpg/cutscene/cutscenemode.h"
|
||||||
#include "rpg/world/map.h"
|
#include "rpg/overworld/map.h"
|
||||||
|
|
||||||
entity_t ENTITIES[ENTITY_COUNT];
|
entity_t ENTITIES[ENTITY_COUNT];
|
||||||
|
|
||||||
@@ -81,30 +81,74 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
|
|||||||
bool_t fall = false;
|
bool_t fall = false;
|
||||||
bool_t raise = false;
|
bool_t raise = false;
|
||||||
|
|
||||||
// Are we walking up stairs?
|
// Are we walking up a ramp?
|
||||||
if(
|
if(
|
||||||
tileIsStairs(tileCurrent) &&
|
tileIsRamp(tileCurrent) &&
|
||||||
(direction+TILE_STAIRS_SOUTH) == tileCurrent &&
|
(
|
||||||
newPos.z < (MAP_CHUNK_DEPTH - 1)
|
// Can only walk UP the direction the ramp faces.
|
||||||
|
(direction+TILE_SHAPE_RAMP_SOUTH) == tileCurrent ||
|
||||||
|
// If diagonal ramp, can go up one of two ways only.
|
||||||
|
(
|
||||||
|
(
|
||||||
|
tileCurrent == TILE_SHAPE_RAMP_SOUTHEAST &&
|
||||||
|
(direction == ENTITY_DIR_SOUTH || direction == ENTITY_DIR_EAST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileCurrent == TILE_SHAPE_RAMP_SOUTHWEST &&
|
||||||
|
(direction == ENTITY_DIR_SOUTH || direction == ENTITY_DIR_WEST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileCurrent == TILE_SHAPE_RAMP_NORTHEAST &&
|
||||||
|
(direction == ENTITY_DIR_NORTH || direction == ENTITY_DIR_EAST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileCurrent == TILE_SHAPE_RAMP_NORTHWEST &&
|
||||||
|
(direction == ENTITY_DIR_NORTH || direction == ENTITY_DIR_WEST)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
// Must be able to walk up.
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
tileNew = TILE_NULL;// Force check for stairs above.
|
tileNew = TILE_SHAPE_NULL;// Force check for ramp above.
|
||||||
worldpos_t abovePos = newPos;
|
worldpos_t abovePos = newPos;
|
||||||
abovePos.z += 1;
|
abovePos.z += 1;
|
||||||
tile_t tileAbove = mapGetTile(abovePos);
|
tile_t tileAbove = mapGetTile(abovePos);
|
||||||
|
|
||||||
if(tileAbove != TILE_NULL && tileIsWalkable(tileAbove)) {
|
if(tileAbove != TILE_SHAPE_NULL && tileIsWalkable(tileAbove)) {
|
||||||
// We can go up the stairs.
|
// We can go up the ramp.
|
||||||
raise = true;
|
raise = true;
|
||||||
}
|
}
|
||||||
} else if(tileNew == TILE_NULL && newPos.z > 0) {
|
} else if(tileNew == TILE_SHAPE_NULL && newPos.z > 0) {
|
||||||
// Falling down?
|
// Falling down?
|
||||||
worldpos_t belowPos = newPos;
|
worldpos_t belowPos = newPos;
|
||||||
belowPos.z -= 1;
|
belowPos.z -= 1;
|
||||||
tile_t tileBelow = mapGetTile(belowPos);
|
tile_t tileBelow = mapGetTile(belowPos);
|
||||||
if(
|
if(
|
||||||
tileBelow != TILE_NULL &&
|
tileBelow != TILE_SHAPE_NULL &&
|
||||||
tileIsStairs(tileBelow) &&
|
tileIsRamp(tileBelow) &&
|
||||||
(entityDirGetOpposite(direction)+TILE_STAIRS_SOUTH) == tileBelow
|
(
|
||||||
|
// This handles regular cardinal ramps
|
||||||
|
(entityDirGetOpposite(direction)+TILE_SHAPE_RAMP_SOUTH) == tileBelow ||
|
||||||
|
// This handles diagonal ramps
|
||||||
|
(
|
||||||
|
(
|
||||||
|
tileBelow == TILE_SHAPE_RAMP_SOUTHEAST &&
|
||||||
|
(direction == ENTITY_DIR_NORTH || direction == ENTITY_DIR_WEST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileBelow == TILE_SHAPE_RAMP_SOUTHWEST &&
|
||||||
|
(direction == ENTITY_DIR_NORTH || direction == ENTITY_DIR_EAST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileBelow == TILE_SHAPE_RAMP_NORTHEAST &&
|
||||||
|
(direction == ENTITY_DIR_SOUTH || direction == ENTITY_DIR_WEST)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
tileBelow == TILE_SHAPE_RAMP_NORTHWEST &&
|
||||||
|
(direction == ENTITY_DIR_SOUTH || direction == ENTITY_DIR_EAST)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
// We will fall to this tile.
|
// We will fall to this tile.
|
||||||
fall = true;
|
fall = true;
|
||||||
@@ -144,4 +188,13 @@ entity_t * entityGetAt(const worldpos_t position) {
|
|||||||
} while(++ent, ent < &ENTITIES[ENTITY_COUNT]);
|
} while(++ent, ent < &ENTITIES[ENTITY_COUNT]);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t entityGetAvailable() {
|
||||||
|
entity_t *ent = ENTITIES;
|
||||||
|
do {
|
||||||
|
if(ent->type == ENTITY_TYPE_NULL) return ent - ENTITIES;
|
||||||
|
} while(++ent, ent < &ENTITIES[ENTITY_COUNT]);
|
||||||
|
|
||||||
|
return 0xFF;
|
||||||
}
|
}
|
||||||
@@ -11,14 +11,12 @@
|
|||||||
#include "entitytype.h"
|
#include "entitytype.h"
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
|
|
||||||
#define ENTITY_COUNT 256
|
|
||||||
|
|
||||||
typedef struct map_s map_t;
|
typedef struct map_s map_t;
|
||||||
|
|
||||||
typedef struct entity_s {
|
typedef struct entity_s {
|
||||||
uint8_t id;
|
uint8_t id;
|
||||||
entitytype_t type;
|
entitytype_t type;
|
||||||
entitytypedata_t;
|
entitytypedata_t data;
|
||||||
|
|
||||||
// Movement
|
// Movement
|
||||||
entitydir_t direction;
|
entitydir_t direction;
|
||||||
@@ -69,4 +67,11 @@ void entityWalk(entity_t *entity, const entitydir_t direction);
|
|||||||
* @param pos The world position to check.
|
* @param pos The world position to check.
|
||||||
* @return Pointer to the entity at the position, or NULL if none.
|
* @return Pointer to the entity at the position, or NULL if none.
|
||||||
*/
|
*/
|
||||||
entity_t *entityGetAt(const worldpos_t pos);
|
entity_t *entityGetAt(const worldpos_t pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an available entity index.
|
||||||
|
*
|
||||||
|
* @return The index of an available entity, or 0xFF if none are available.
|
||||||
|
*/
|
||||||
|
uint8_t entityGetAvailable();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user