Compare commits
506 Commits
ttm_fglrx_
...
master
Author | SHA1 | Date |
---|---|---|
Amaryllis Kulla | 6a875b30d2 | |
Amaryllis Kulla | 998aa9f846 | |
Amaryllis Kulla | b4c439c6eb | |
Amaryllis Kulla | 380b676777 | |
Amaryllis Kulla | a962c158db | |
Jaiden | cf6403ae65 | |
Ancurio | f138731f7c | |
mara | ac8f4b1594 | |
Jari Vetoniemi | 990843a50b | |
Jari Vetoniemi | 66dc9309db | |
Jonas Kulla | 5c117a55bf | |
Jonas Kulla | cb09036c55 | |
Jonas Kulla | 6903f2ab43 | |
Jonas Kulla | 9dc42914de | |
Jonas Kulla | 86194118a3 | |
Jonas Kulla | 98bdfcf758 | |
Jonas Kulla | 6fa5b8c856 | |
Jonas Kulla | d6b477b887 | |
Jonas Kulla | 9dcfb66e86 | |
Jonas Kulla | d4b9adc1d1 | |
Luis Caceres | 43cb318862 | |
Eliza Velasquez | bab22d87be | |
Jonas Kulla | ae59fcd112 | |
ReinUsesLisp | b5e5a26d8b | |
Jonas Kulla | 9f44ee5068 | |
Jonas Kulla | 183ebbed65 | |
Jonas Kulla | 7902d0942d | |
Jonas Kulla | 947974cac6 | |
Jonas Kulla | 2f81fbbf4b | |
Jonas Kulla | 7d9a85dbbd | |
Carsten Teibes | d427df0c2b | |
Carsten Teibes | b1bdf1e445 | |
Carsten Teibes | fde6a92197 | |
Marty Plummer | 01e17ed5c6 | |
Jonas Kulla | f172f58c74 | |
Jonas Kulla | fba20e6294 | |
Marty Plummer | f5c30affaa | |
Jonas Kulla | bd694f9f99 | |
Jonas Kulla | cab453ac3a | |
Jonas Kulla | 006f701fec | |
Jonas Kulla | 1478e1e0f9 | |
Jonas Kulla | 06feafe9ef | |
Jonas Kulla | e4079d5738 | |
Jonas Kulla | 0481f920b0 | |
Jonas Kulla | 3ea24bd757 | |
Marty Plummer | 60e967e3b7 | |
Jonas Kulla | 0f9b5f274a | |
Jonas Kulla | 6349146e01 | |
Jonas Kulla | c4dd3ffaf6 | |
Jonas Kulla | 55cec53911 | |
Jonas Kulla | 541e24f678 | |
Jonas Kulla | 0ec1fce4ac | |
Jonas Kulla | d4e09f55bd | |
Jonas Kulla | e98c2e0535 | |
Jonas Kulla | fdaf6c3611 | |
Jonas Kulla | 47ef36ca19 | |
Jonas Kulla | de74fc1bc3 | |
Jonas Kulla | 5d776319b5 | |
Jonas Kulla | 53b5b923d4 | |
Mook | 8e411cbcfe | |
Jonas Kulla | 7bf6eca362 | |
Jonas Kulla | 4d97a17c44 | |
Jonas Kulla | 7017ca1c53 | |
Jonas Kulla | 30465691ae | |
Jonas Kulla | dd7545fcf2 | |
Jonas Kulla | 5aaeb0206c | |
Jonas Kulla | 9a3dd2d554 | |
Jonas Kulla | 384249c31a | |
Jonas Kulla | d1ee507ec4 | |
Jonas Kulla | 21247b18b5 | |
cremno | 861d261af2 | |
Jonas Kulla | fe6799d00b | |
Jonas Kulla | fe709b6010 | |
Jonas Kulla | 54c1107f19 | |
Jonas Kulla | 533e69275a | |
Jonas Kulla | e4558c9dfb | |
Jonas Kulla | 5382cc11a3 | |
Jonas Kulla | 1e9e24e45c | |
Jonas Kulla | 9acdd206f6 | |
Jonas Kulla | 6e176a454c | |
Jonas Kulla | afab51279e | |
Jonas Kulla | 61849a9158 | |
Jonas Kulla | 2d31d08fa6 | |
Jonas Kulla | e778dc17c5 | |
Jonas Kulla | 6380a93cec | |
Jonas Kulla | 064b7ac80d | |
Jonas Kulla | d5bacf50f5 | |
Jonas Kulla | e4bc08e972 | |
Jonas Kulla | 88eca58268 | |
Jonas Kulla | e72bced0f7 | |
Jonas Kulla | 794e86d0ab | |
Jonas Kulla | 7260c467b8 | |
Jonas Kulla | 8d7166f3d2 | |
Jonas Kulla | 5379511d95 | |
Jonas Kulla | 91c9bfd0f4 | |
Jonas Kulla | 7393f7e951 | |
Jonas Kulla | 531441d4e3 | |
Jonas Kulla | 0f91bdefea | |
Jonas Kulla | 44eaaf5985 | |
Jonas Kulla | 87462fd7b0 | |
Jonas Kulla | a4b1be1da5 | |
Jonas Kulla | c328ebee04 | |
Jonas Kulla | 713ea07558 | |
Jonas Kulla | b2631d4c23 | |
Jonas Kulla | 4864f63c6c | |
Jonas Kulla | e339964076 | |
Jonas Kulla | 64a3ac3769 | |
Jonas Kulla | fa0459ad93 | |
Jonas Kulla | 74f8c91bf4 | |
Jonas Kulla | 7cbe1eef94 | |
Jonas Kulla | f6604a88b8 | |
Jonas Kulla | c92df0ce3a | |
Jonas Kulla | 7c6a2b2c62 | |
Jonas Kulla | 012d87d05a | |
Jonas Kulla | f1da585f33 | |
Jonas Kulla | a05a3deff6 | |
Jonas Kulla | 6f88ddc51c | |
Jonas Kulla | 7003039e56 | |
Jonas Kulla | 146e0294b4 | |
Jonas Kulla | 4fb94aaf10 | |
Jonas Kulla | 3411435138 | |
Jonas Kulla | c63a8947ce | |
Jonas Kulla | b42725ea20 | |
Jonas Kulla | 9122446b23 | |
Jonas Kulla | 7cbf81c83a | |
Jonas Kulla | b4bca7ea3b | |
Jonas Kulla | 725af97e7b | |
Jonas Kulla | 35077793a0 | |
Jonas Kulla | 5974d05380 | |
Jonas Kulla | 3596fc568d | |
Jonas Kulla | 69795be30b | |
Jonas Kulla | 0a484c8a31 | |
Jonas Kulla | 4560589e25 | |
Jonas Kulla | 4b08d82ea4 | |
Jonas Kulla | 88c41bcc62 | |
Jonas Kulla | a112529f53 | |
Jonas Kulla | b963c67339 | |
Jonas Kulla | ee17bb2137 | |
Jonas Kulla | 3fb4108306 | |
Jonas Kulla | fcfa079e7b | |
Jonas Kulla | 03a6c657c4 | |
Jonas Kulla | b39964a49a | |
Jonas Kulla | 2f95c0613a | |
Jonas Kulla | 373b90af00 | |
Jonas Kulla | 3c0a530eba | |
Jonas Kulla | a53163660f | |
Jonas Kulla | a501e4f22f | |
Jonas Kulla | 02f19c03c9 | |
David Salvisberg | 90e1c09711 | |
Jonas Kulla | d18e3e6a53 | |
David Salvisberg | 8240f3333f | |
Jonas Kulla | 150abff1c0 | |
Jonas Kulla | 78e246c11d | |
David Salvisberg | b1e1d28879 | |
David Salvisberg | 6829ddc09f | |
David Salvisberg | 7413c3d994 | |
Jonas Kulla | 11cfe887c2 | |
Jonas Kulla | 685f8b63b3 | |
Jonas Kulla | 6c92101e05 | |
Jonas Kulla | 3faaed89d0 | |
Jonas Kulla | 98b0b71359 | |
Jonas Kulla | 60f101f2e6 | |
Jonas Kulla | faef0e8503 | |
Jonas Kulla | f00cb60707 | |
Jonas Kulla | c1aab96454 | |
Jonas Kulla | bc31922c33 | |
Jonas Kulla | 5979c5f778 | |
Jonas Kulla | cfd9345e87 | |
Jonas Kulla | c2f8b6b749 | |
Jonas Kulla | 276160f0d5 | |
Jonas Kulla | f236e34e2d | |
Jonas Kulla | 33c571e691 | |
Jonas Kulla | 9ac14800da | |
Jonas Kulla | 5c3f4b905a | |
Jonas Kulla | f7a3e3c5d2 | |
Jonas Kulla | a98ad3134b | |
Jonas Kulla | 577f606dac | |
Jonas Kulla | 05b32d76ca | |
Jonas Kulla | c9d5059238 | |
Jonas Kulla | 5549ff78f0 | |
Jonas Kulla | 1a489aafaf | |
Jonas Kulla | 8b31f97bb4 | |
Jonas Kulla | ecf9b065c8 | |
Jonas Kulla | af8f3a36d2 | |
Jonas Kulla | 8e1852a281 | |
Jonas Kulla | 4a8b0f30c8 | |
Jonas Kulla | e44a1e32fa | |
Jonas Kulla | 6145c59305 | |
Jonas Kulla | 1c1d72b03e | |
Jonas Kulla | e1a45c29e2 | |
Jonas Kulla | 5094f5c7c1 | |
Jonas Kulla | 47851718eb | |
Jonas Kulla | 2cd70b9edd | |
Jonas Kulla | 19b1c3d7c2 | |
Jonas Kulla | 64a26b4911 | |
Jonas Kulla | dd73db2e9d | |
Jonas Kulla | af145c3a01 | |
Jonas Kulla | 520162f36a | |
Jonas Kulla | 1b7ed5ed78 | |
Jonas Kulla | 0c08fc2d16 | |
Jonas Kulla | 18076c9ae4 | |
Jonas Kulla | c1d89e4f8d | |
Jonas Kulla | 55a2cf562e | |
Jonas Kulla | df73045d81 | |
Jonas Kulla | db78e55371 | |
Jonas Kulla | 95cda4035e | |
Jonas Kulla | 7b65977eb9 | |
Jonas Kulla | fa911b8018 | |
Jonas Kulla | 5ea964eee8 | |
Jonas Kulla | 51a0f3903c | |
Jonas Kulla | 46497eae01 | |
Jonas Kulla | 3dd703f732 | |
Jonas Kulla | 4a015c6397 | |
Jonas Kulla | 9e64dff01c | |
Jonas Kulla | 9758e660c4 | |
Jonas Kulla | e9d0d0566b | |
Jonas Kulla | d223d83cbf | |
Jonas Kulla | 3a2e560139 | |
Jonas Kulla | 2550fd8ccc | |
Jonas Kulla | 81ac0780f8 | |
Jonas Kulla | 3983fe66e9 | |
Jonas Kulla | 17efcbbbbd | |
Jonas Kulla | 8d67b7c91d | |
Jonas Kulla | 5c3c73ee94 | |
Jonas Kulla | 3a29385df0 | |
Jonas Kulla | 05041fdb03 | |
Jonas Kulla | 61b77c2027 | |
Jonas Kulla | f49cd4391a | |
cremno | 6abc207f1e | |
cremno | 29dfda0011 | |
Jonas Kulla | a365a7a754 | |
Jonas Kulla | 0c318ee0b2 | |
Jonas Kulla | 757a1d5e39 | |
Jonas Kulla | 673a25f811 | |
Jonas Kulla | ac9b98157e | |
Jonas Kulla | 6bc3460294 | |
Jonas Kulla | bca95adc0e | |
Jonas Kulla | 9461449cc9 | |
Jonas Kulla | 7f41b9cc45 | |
Jonas Kulla | 4d54fce8ee | |
Jonas Kulla | 0131ed09f0 | |
Jonas Kulla | f8c26fc515 | |
Jonas Kulla | f665d8b41c | |
Jonas Kulla | 10186e8dcc | |
Jonas Kulla | d2d86e7002 | |
Jonas Kulla | 8c1cf27b7c | |
Jonas Kulla | 8975255ecf | |
cremno | fd4f7c66d1 | |
cremno | 7acbb06fbd | |
Jonas Kulla | 48b1af1e43 | |
cremno | a366862076 | |
cremno | 4b08eee81f | |
Jonas Kulla | 3b7b8657ea | |
Jonas Kulla | 7bc07301db | |
Jonas Kulla | 360cf240f6 | |
Jonas Kulla | 91209fa4bb | |
cremno | 53cd5e1fbc | |
cremno | b8fc8cf9b6 | |
cremno | 95c53899be | |
cremno | acf826eb7a | |
Jonas Kulla | d8bb6aa2fc | |
Jonas Kulla | 1a98760b31 | |
Jonas Kulla | 3da785b293 | |
Jonas Kulla | 2ba9f6589b | |
Jonas Kulla | f7d7b16eaf | |
Jonas Kulla | 3cdbf2b035 | |
cremno | 173ee07959 | |
cremno | 4920931d33 | |
cremno | 0203e28436 | |
cremno | 70c40fe530 | |
Jonas Kulla | 6d414c0777 | |
Jonas Kulla | 55f1542c76 | |
Jonas Kulla | b1981055e1 | |
Jonas Kulla | 28421a0ce5 | |
Jonas Kulla | c88b4b03d6 | |
Jonas Kulla | 20081cb07e | |
Jonas Kulla | 7bcc31fb53 | |
Jonas Kulla | 18c74e0f24 | |
Jonas Kulla | b1ebc655f9 | |
Jonas Kulla | 5ee62ba0fd | |
Jonas Kulla | ce72e6d0ee | |
Jonas Kulla | 117ddeee5c | |
Jonas Kulla | d2fd692041 | |
Jonas Kulla | dbb2249ff3 | |
Jonas Kulla | 3968ebb538 | |
Jonas Kulla | 4baf7b5a5a | |
Jonas Kulla | b380a0ebdd | |
Jonas Kulla | f76ecfdba8 | |
Jonas Kulla | b751858b16 | |
Jonas Kulla | 24ad0990da | |
Jonas Kulla | 50e393fe6e | |
Jonas Kulla | c5c58fa9cd | |
Jonas Kulla | ee8a3ca402 | |
Jonas Kulla | 10bfcb57b7 | |
Jonas Kulla | 622845a404 | |
Jonas Kulla | fb2b2b7260 | |
Jonas Kulla | 0c72659025 | |
Jonas Kulla | 9c3d40de5e | |
Mathew | f89216368d | |
Jonas Kulla | 7452331e04 | |
Jonas Kulla | b0eeb6d1bd | |
Jonas Kulla | 724d52f61e | |
Jonas Kulla | 9311aff017 | |
Jonas Kulla | 858c40591b | |
Jonas Kulla | 52e2f2304a | |
Jonas Kulla | d075bd255c | |
Jonas Kulla | 169f9e9285 | |
Jonas Kulla | f0e045d057 | |
Jonas Kulla | 4daff93e29 | |
Jonas Kulla | cbdd19e525 | |
Jonas Kulla | 8042289291 | |
Jonas Kulla | e7882c0d3e | |
Jonas Kulla | 9c421aed45 | |
Jonas Kulla | e208bc49e8 | |
Jonas Kulla | 3887342439 | |
Jonas Kulla | b32d6c69cb | |
Jonas Kulla | 840ecee084 | |
Jonas Kulla | f58e4ab00d | |
Jonas Kulla | 1195dc15bd | |
Jonas Kulla | 7f69786c47 | |
Jonas Kulla | ded18f9a02 | |
Jonas Kulla | d439b1d833 | |
Jonas Kulla | f036e83a2d | |
Jonas Kulla | 3277663944 | |
Jonas Kulla | bce4eb2bee | |
Jonas Kulla | 062c7267d7 | |
Jonas Kulla | 9003f9a435 | |
Jonas Kulla | 36eea09c7e | |
Jonas Kulla | de8773fb5c | |
Jonas Kulla | 931755cb64 | |
Jonas Kulla | bdd60291a7 | |
Jonas Kulla | 8d375b5cac | |
Jonas Kulla | 150c280c1e | |
Jonas Kulla | deb5696ddb | |
Jonas Kulla | 7a655528e4 | |
Jonas Kulla | 5bc6f6f32c | |
Jonas Kulla | 0c5e84eb4b | |
Jonas Kulla | 5b319020ea | |
Jonas Kulla | 3224950a1c | |
Jonas Kulla | 29995bee7f | |
Jonas Kulla | 7790bd6c2c | |
Jonas Kulla | 3717609142 | |
Jonas Kulla | 4742226e7c | |
Jonas Kulla | 91d19d0a73 | |
Jonas Kulla | d654fb7dd6 | |
Jonas Kulla | d95e90db34 | |
Jonas Kulla | 3550cc0ff5 | |
Jonas Kulla | d128375d62 | |
Jonas Kulla | 194f70c48c | |
Jonas Kulla | 18022bf809 | |
Jonas Kulla | 7d30ce1a00 | |
Jonas Kulla | 0af5e9d66c | |
Jonas Kulla | 1767b200c7 | |
Jonas Kulla | 9967ae022d | |
Jonas Kulla | 3b35fb219c | |
Jonas Kulla | 1cc1541377 | |
Jonas Kulla | e858bbdcf5 | |
Jonas Kulla | b7af8cc92f | |
Jonas Kulla | cc0ab35f10 | |
Jonas Kulla | 6c9fbc1465 | |
Jonas Kulla | 0ab543fd75 | |
Jonas Kulla | bdcf1503bd | |
Jonas Kulla | 88bb92aadc | |
Jonas Kulla | 656c5099ea | |
Jonas Kulla | 24759fb97b | |
Jonas Kulla | 151a1f0d1b | |
Jonas Kulla | 59aed37d3e | |
Jonas Kulla | 5eb5b0dc83 | |
Jonas Kulla | dc43af3b6a | |
Jonas Kulla | 3bcf995832 | |
Jonas Kulla | cc7218c19d | |
Jonas Kulla | 751fdc599e | |
Jonas Kulla | 818ca18ebb | |
Jonas Kulla | 80937d0d06 | |
Jonas Kulla | d7e0429ea6 | |
Jonas Kulla | 0a94b518dc | |
Jonas Kulla | 0d96207b39 | |
Jonas Kulla | e38ec7be98 | |
Jonas Kulla | 262023b088 | |
Jonas Kulla | ec16210f8a | |
Jonas Kulla | 393a283d99 | |
Jonas Kulla | 2f831aea60 | |
Jonas Kulla | 6726493ee7 | |
Jonas Kulla | 1ecdd9f980 | |
Jonas Kulla | 7b947a50c9 | |
Jonas Kulla | f73b0ba4b5 | |
Jonas Kulla | e341dca579 | |
Jonas Kulla | 492be508da | |
Jonas Kulla | ca9f83c6de | |
Jonas Kulla | c1d627e0ae | |
Jonas Kulla | 27b7815f52 | |
Jonas Kulla | 7ce747d34d | |
Jonas Kulla | c44f4d7d28 | |
Jonas Kulla | 6f17b6ff46 | |
Jonas Kulla | a310318c65 | |
Jonas Kulla | 83ceed5592 | |
Jonas Kulla | a56d446664 | |
Jonas Kulla | 86b207e389 | |
Jonas Kulla | 5640c3d04b | |
Jonas Kulla | 813130fbf6 | |
Jonas Kulla | 48db6fbeda | |
Jonas Kulla | ccba946973 | |
Jonas Kulla | 20e46a98dd | |
Jonas Kulla | a17043f785 | |
Jonas Kulla | 3a3ccf590e | |
Jonas Kulla | b878149f5c | |
Jonas Kulla | b8d861b4cd | |
Jonas Kulla | bae977d4ab | |
Jonas Kulla | a26c73930d | |
Jonas Kulla | 7ad6b7b5df | |
Jonas Kulla | 4a3a769b15 | |
Jonas Kulla | 97f18beb91 | |
Jonas Kulla | c5f18ee535 | |
Jonas Kulla | 35dbaab0c3 | |
Jonas Kulla | f7d63bafd0 | |
Thomas Schneider | 20db1a7b39 | |
Jonas Kulla | 97708d25b6 | |
Jonas Kulla | efb2fd2695 | |
Jonas Kulla | dac1407120 | |
Jonas Kulla | b73461721c | |
Jonas Kulla | a541cb1205 | |
Jonas Kulla | 91aefdc17a | |
Jonas Kulla | d1bad9b45f | |
Jonas Kulla | caae9c5689 | |
Jonas Kulla | 295e0e5b15 | |
Jonas Kulla | 300e61c64b | |
Jonas Kulla | c0f25548bd | |
Jonas Kulla | 6bbdf7e183 | |
Jonas Kulla | 527a372bd3 | |
Jonas Kulla | 56226c40c6 | |
Jonas Kulla | 033d46a293 | |
Jonas Kulla | 4a0084801e | |
Jonas Kulla | 843a7bf571 | |
Jonas Kulla | 902a5e8c76 | |
Jonas Kulla | a4615fb8cc | |
Jonas Kulla | 6808b9a6dd | |
Jonas Kulla | 282d547ad4 | |
Jonas Kulla | 6c481e5eb8 | |
Jonas Kulla | 640b01e518 | |
Jonas Kulla | 3ac8f1e8aa | |
Jonas Kulla | aed7ba6672 | |
Jonas Kulla | 06b218d5d7 | |
Jonas Kulla | 013437074b | |
Jonas Kulla | 2cc2ebca31 | |
Jonas Kulla | 7b1f599dd6 | |
Jonas Kulla | 5ba40369cc | |
Jonas Kulla | ad63c962c6 | |
cremno | e6a116f43f | |
Jonas Kulla | 0ef68a2eb7 | |
Jonas Kulla | ce0fee0641 | |
Jonas Kulla | 70279f0fdc | |
Jonas Kulla | ea20154978 | |
Jonas Kulla | 66fe932a8e | |
Jonas Kulla | 2d30301aef | |
Jonas Kulla | 32bb18d93f | |
Jonas Kulla | d09f4a1bae | |
Jonas Kulla | e74f889bc5 | |
Jonas Kulla | 8dd7c1b48c | |
Jonas Kulla | 72fc659a4c | |
Jonas Kulla | 1bdcfa7b04 | |
Jonas Kulla | c6a3c5aa59 | |
Jonas Kulla | 627ff66e7a | |
Jonas Kulla | 80b2768e73 | |
Jonas Kulla | 58d86039d5 | |
Jonas Kulla | 4cb1c10c3a | |
Jonas Kulla | 4e346cac27 | |
cremno | bd6764450f | |
Jonas Kulla | f11cc182df | |
Jonas Kulla | 1ef6e04520 | |
Jonas Kulla | 31626c9acc | |
Jonas Kulla | 51c5ca1410 | |
Jonas Kulla | f25d2db63c | |
Jonas Kulla | 711060db8f | |
cremno | 4ca9e82a14 | |
Jonas Kulla | ab9464006b | |
cremno | 95c112bbe4 | |
cremno | 8bc17a9a98 | |
Jonas Kulla | 6dfa4f6b7d | |
Jonas Kulla | 8203e32900 | |
cremno | f6ec364632 | |
cremno | 06b877a78c | |
cremno | 4e0262d2a7 | |
cremno | f8b87eb188 | |
cremno | 804a697c03 | |
Jonas Kulla | 4219b91bbb | |
Jonas Kulla | af9039f58d | |
Jonas Kulla | 42b10fd2ee | |
Jonas Kulla | 64f1e32fdc | |
Jonas Kulla | 5a6c0c14ed | |
Jonas Kulla | bb8f2351cc | |
Jonas Kulla | e0a4dfe372 | |
Jonas Kulla | 1b0eb2797d | |
Jonas Kulla | b6a299541f | |
Jonas Kulla | 96d2707edb | |
Jonas Kulla | f956f21ce1 | |
Jonas Kulla | b28863d8eb | |
Jonas Kulla | 53718d0428 | |
Jonas Kulla | 87c1e376b9 | |
Jonas Kulla | b729da249b | |
Jonas Kulla | e93e1fd292 | |
Jonas Kulla | f3572f5ba4 | |
Jonas Kulla | f39d1239bb | |
Jonas Kulla | b0a41a23e0 | |
Jonas Kulla | 316457b988 | |
Jonas Kulla | 91efcfa06d | |
Jonas Kulla | 9b92a7bc14 |
|
@ -0,0 +1,5 @@
|
||||||
|
root=true
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
|
@ -10,4 +10,9 @@ Makefile
|
||||||
mkxp
|
mkxp
|
||||||
xxd+
|
xxd+
|
||||||
|
|
||||||
/build
|
/build
|
||||||
|
|
||||||
|
# Codeblocks
|
||||||
|
mkxp.layout
|
||||||
|
mkxp.cbp
|
||||||
|
|
||||||
|
|
100
CMakeLists.txt
100
CMakeLists.txt
|
@ -3,7 +3,8 @@ Project(mkxp)
|
||||||
|
|
||||||
## Setup options ##
|
## Setup options ##
|
||||||
|
|
||||||
option(RGSS2 "Enable RGSS2" ON)
|
option(SHARED_FLUID "Dynamically link fluidsynth at build time" OFF)
|
||||||
|
option(WORKDIR_CURRENT "Keep current directory on startup" OFF)
|
||||||
option(FORCE32 "Force 32bit compile on 64bit OS" OFF)
|
option(FORCE32 "Force 32bit compile on 64bit OS" OFF)
|
||||||
set(BINDING "MRI" CACHE STRING "The Binding Type (MRI, MRUBY, NULL)")
|
set(BINDING "MRI" CACHE STRING "The Binding Type (MRI, MRUBY, NULL)")
|
||||||
set(EXTERNAL_LIB_PATH "" CACHE PATH "External precompiled lib prefix")
|
set(EXTERNAL_LIB_PATH "" CACHE PATH "External precompiled lib prefix")
|
||||||
|
@ -18,6 +19,12 @@ IF("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||||
SET(LINUX ON)
|
SET(LINUX ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(WORKDIR_CURRENT)
|
||||||
|
list(APPEND DEFINES
|
||||||
|
WORKDIR_CURRENT
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(FORCE32)
|
IF(FORCE32)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386")
|
SET(CMAKE_OSX_ARCHITECTURES "i386")
|
||||||
|
@ -79,15 +86,14 @@ endif()
|
||||||
pkg_check_modules(SIGCXX REQUIRED sigc++-2.0)
|
pkg_check_modules(SIGCXX REQUIRED sigc++-2.0)
|
||||||
pkg_check_modules(PIXMAN REQUIRED pixman-1)
|
pkg_check_modules(PIXMAN REQUIRED pixman-1)
|
||||||
pkg_check_modules(PHYSFS REQUIRED physfs>=2.1)
|
pkg_check_modules(PHYSFS REQUIRED physfs>=2.1)
|
||||||
|
pkg_check_modules(VORBISFILE REQUIRED vorbisfile)
|
||||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||||
pkg_check_modules(SDL2_TTF REQUIRED SDL2_ttf)
|
pkg_check_modules(SDL2_TTF REQUIRED SDL2_ttf)
|
||||||
pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image)
|
pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image)
|
||||||
pkg_check_modules(SDL_SOUND REQUIRED SDL_sound)
|
pkg_check_modules(SDL_SOUND REQUIRED SDL_sound)
|
||||||
|
|
||||||
find_package(GLEW 1.9.0 REQUIRED)
|
|
||||||
find_package(Boost 1.49 COMPONENTS program_options REQUIRED)
|
find_package(Boost 1.49 COMPONENTS program_options REQUIRED)
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
## Setup main source ##
|
## Setup main source ##
|
||||||
|
@ -104,6 +110,7 @@ set(MAIN_HEADERS
|
||||||
src/flashable.h
|
src/flashable.h
|
||||||
src/font.h
|
src/font.h
|
||||||
src/input.h
|
src/input.h
|
||||||
|
src/iniconfig.h
|
||||||
src/plane.h
|
src/plane.h
|
||||||
src/scene.h
|
src/scene.h
|
||||||
src/sprite.h
|
src/sprite.h
|
||||||
|
@ -118,8 +125,9 @@ set(MAIN_HEADERS
|
||||||
src/glstate.h
|
src/glstate.h
|
||||||
src/quad.h
|
src/quad.h
|
||||||
src/tilemap.h
|
src/tilemap.h
|
||||||
|
src/tilemap-common.h
|
||||||
src/graphics.h
|
src/graphics.h
|
||||||
src/debuglogger.h
|
src/gl-debug.h
|
||||||
src/global-ibo.h
|
src/global-ibo.h
|
||||||
src/exception.h
|
src/exception.h
|
||||||
src/filesystem.h
|
src/filesystem.h
|
||||||
|
@ -129,12 +137,27 @@ set(MAIN_HEADERS
|
||||||
src/gl-util.h
|
src/gl-util.h
|
||||||
src/util.h
|
src/util.h
|
||||||
src/config.h
|
src/config.h
|
||||||
|
src/settingsmenu.h
|
||||||
|
src/keybindings.h
|
||||||
src/tileatlas.h
|
src/tileatlas.h
|
||||||
src/perftimer.h
|
|
||||||
src/sharedstate.h
|
src/sharedstate.h
|
||||||
src/al-util.h
|
src/al-util.h
|
||||||
src/boost-hash.h
|
src/boost-hash.h
|
||||||
src/debugwriter.h
|
src/debugwriter.h
|
||||||
|
src/gl-fun.h
|
||||||
|
src/gl-meta.h
|
||||||
|
src/vertex.h
|
||||||
|
src/soundemitter.h
|
||||||
|
src/aldatasource.h
|
||||||
|
src/alstream.h
|
||||||
|
src/audiostream.h
|
||||||
|
src/rgssad.h
|
||||||
|
src/windowvx.h
|
||||||
|
src/tilemapvx.h
|
||||||
|
src/tileatlasvx.h
|
||||||
|
src/sharedmidistate.h
|
||||||
|
src/fluid-fun.h
|
||||||
|
src/sdl-util.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(MAIN_SOURCE
|
set(MAIN_SOURCE
|
||||||
|
@ -145,6 +168,7 @@ set(MAIN_SOURCE
|
||||||
src/filesystem.cpp
|
src/filesystem.cpp
|
||||||
src/font.cpp
|
src/font.cpp
|
||||||
src/input.cpp
|
src/input.cpp
|
||||||
|
src/iniconfig.cpp
|
||||||
src/plane.cpp
|
src/plane.cpp
|
||||||
src/scene.cpp
|
src/scene.cpp
|
||||||
src/sprite.cpp
|
src/sprite.cpp
|
||||||
|
@ -158,41 +182,79 @@ set(MAIN_SOURCE
|
||||||
src/tilemap.cpp
|
src/tilemap.cpp
|
||||||
src/autotiles.cpp
|
src/autotiles.cpp
|
||||||
src/graphics.cpp
|
src/graphics.cpp
|
||||||
src/debuglogger.cpp
|
src/gl-debug.cpp
|
||||||
src/etc.cpp
|
src/etc.cpp
|
||||||
src/config.cpp
|
src/config.cpp
|
||||||
|
src/settingsmenu.cpp
|
||||||
|
src/keybindings.cpp
|
||||||
src/tileatlas.cpp
|
src/tileatlas.cpp
|
||||||
src/perftimer.cpp
|
|
||||||
src/sharedstate.cpp
|
src/sharedstate.cpp
|
||||||
|
src/gl-fun.cpp
|
||||||
|
src/gl-meta.cpp
|
||||||
|
src/vertex.cpp
|
||||||
|
src/soundemitter.cpp
|
||||||
|
src/sdlsoundsource.cpp
|
||||||
|
src/alstream.cpp
|
||||||
|
src/audiostream.cpp
|
||||||
|
src/rgssad.cpp
|
||||||
|
src/bundledfont.cpp
|
||||||
|
src/vorbissource.cpp
|
||||||
|
src/windowvx.cpp
|
||||||
|
src/tilemapvx.cpp
|
||||||
|
src/tileatlasvx.cpp
|
||||||
|
src/autotilesvx.cpp
|
||||||
|
src/midisource.cpp
|
||||||
|
src/fluid-fun.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND MAIN_HEADERS windows/resource.h)
|
||||||
|
list(APPEND MAIN_SOURCE windows/resource.rc)
|
||||||
|
endif()
|
||||||
|
|
||||||
source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS})
|
source_group("MKXP Source" FILES ${MAIN_SOURCE} ${MAIN_HEADERS})
|
||||||
|
|
||||||
## Setup embedded source ##
|
## Setup embedded source ##
|
||||||
|
|
||||||
set(EMBEDDED_INPUT
|
set(EMBEDDED_INPUT
|
||||||
|
shader/common.h
|
||||||
shader/transSimple.frag
|
shader/transSimple.frag
|
||||||
shader/trans.frag
|
shader/trans.frag
|
||||||
shader/hue.frag
|
shader/hue.frag
|
||||||
shader/sprite.frag
|
shader/sprite.frag
|
||||||
shader/plane.frag
|
shader/plane.frag
|
||||||
|
shader/gray.frag
|
||||||
shader/bitmapBlit.frag
|
shader/bitmapBlit.frag
|
||||||
|
shader/flatColor.frag
|
||||||
shader/simple.frag
|
shader/simple.frag
|
||||||
shader/simpleColor.frag
|
shader/simpleColor.frag
|
||||||
shader/simpleAlpha.frag
|
shader/simpleAlpha.frag
|
||||||
|
shader/simpleAlphaUni.frag
|
||||||
shader/flashMap.frag
|
shader/flashMap.frag
|
||||||
|
shader/minimal.vert
|
||||||
shader/simple.vert
|
shader/simple.vert
|
||||||
shader/simpleColor.vert
|
shader/simpleColor.vert
|
||||||
shader/sprite.vert
|
shader/sprite.vert
|
||||||
|
shader/tilemap.vert
|
||||||
|
shader/tilemapvx.vert
|
||||||
|
shader/blur.frag
|
||||||
|
shader/blurH.vert
|
||||||
|
shader/blurV.vert
|
||||||
|
shader/simpleMatrix.vert
|
||||||
assets/liberation.ttf
|
assets/liberation.ttf
|
||||||
|
assets/icon.png
|
||||||
)
|
)
|
||||||
|
|
||||||
if (RGSS2)
|
if (RGSS2)
|
||||||
list(APPEND EMBEDDED_INPUT
|
list(APPEND DEFINES
|
||||||
shader/blur.frag
|
RGSS2
|
||||||
shader/blurH.vert
|
)
|
||||||
shader/blurV.vert
|
endif()
|
||||||
shader/simpleMatrix.vert
|
|
||||||
|
if (SHARED_FLUID)
|
||||||
|
pkg_check_modules(FLUID REQUIRED fluidsynth)
|
||||||
|
list(APPEND DEFINES
|
||||||
|
SHARED_FLUID
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -232,7 +294,7 @@ source_group("Embedded Source" FILES ${EMBEDDED_INPUT} ${EMBEDDED_SOURCE})
|
||||||
## Setup binding source ##
|
## Setup binding source ##
|
||||||
|
|
||||||
if (BINDING STREQUAL "MRI")
|
if (BINDING STREQUAL "MRI")
|
||||||
set(MRIVERSION "2.0" CACHE STRING "Version of MRI to link with")
|
set(MRIVERSION "2.1" CACHE STRING "Version of MRI to link with")
|
||||||
pkg_check_modules(MRI REQUIRED ruby-${MRIVERSION})
|
pkg_check_modules(MRI REQUIRED ruby-${MRIVERSION})
|
||||||
list(APPEND DEFINES
|
list(APPEND DEFINES
|
||||||
BINDING_MRI
|
BINDING_MRI
|
||||||
|
@ -263,6 +325,8 @@ if (BINDING STREQUAL "MRI")
|
||||||
binding-mri/audio-binding.cpp
|
binding-mri/audio-binding.cpp
|
||||||
binding-mri/module_rpg.cpp
|
binding-mri/module_rpg.cpp
|
||||||
binding-mri/filesystem-binding.cpp
|
binding-mri/filesystem-binding.cpp
|
||||||
|
binding-mri/windowvx-binding.cpp
|
||||||
|
binding-mri/tilemapvx-binding.cpp
|
||||||
)
|
)
|
||||||
elseif(BINDING STREQUAL "MRUBY")
|
elseif(BINDING STREQUAL "MRUBY")
|
||||||
message(FATAL_ERROR "Mruby support in CMake needs to be finished")
|
message(FATAL_ERROR "Mruby support in CMake needs to be finished")
|
||||||
|
@ -322,6 +386,7 @@ if(APPLE)
|
||||||
list(APPEND PLATFORM_LIBRARIES
|
list(APPEND PLATFORM_LIBRARIES
|
||||||
${CARBON_LIBRARY}
|
${CARBON_LIBRARY}
|
||||||
${IOKIT_LIBRARY}
|
${IOKIT_LIBRARY}
|
||||||
|
"-liconv"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -347,13 +412,16 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
src
|
src
|
||||||
|
windows
|
||||||
${SIGCXX_INCLUDE_DIRS}
|
${SIGCXX_INCLUDE_DIRS}
|
||||||
${PIXMAN_INCLUDE_DIRS}
|
${PIXMAN_INCLUDE_DIRS}
|
||||||
${PHYSFS_INCLUDE_DIRS}
|
${PHYSFS_INCLUDE_DIRS}
|
||||||
${SDL2_INCLUDE_DIRS} # Blindly assume other SDL bits are in same directory
|
${SDL2_INCLUDE_DIRS} # Blindly assume other SDL bits are in same directory
|
||||||
|
${SDL_SOUND_INCLUDE_DIRS}
|
||||||
${Boost_INCLUDE_DIR}
|
${Boost_INCLUDE_DIR}
|
||||||
${GLEW_INCLUDE_DIR}/GL
|
|
||||||
${MRI_INCLUDE_DIRS}
|
${MRI_INCLUDE_DIRS}
|
||||||
|
${VORBISFILE_INCLUDE_DIRS}
|
||||||
|
${FLUID_INCLUDE_DIRS}
|
||||||
${OPENAL_INCLUDE_DIR}
|
${OPENAL_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -367,9 +435,9 @@ target_link_libraries(${PROJECT_NAME}
|
||||||
${PIXMAN_LIBRARIES}
|
${PIXMAN_LIBRARIES}
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
${MRI_LIBRARIES}
|
${MRI_LIBRARIES}
|
||||||
|
${VORBISFILE_LIBRARIES}
|
||||||
|
${FLUID_LIBRARIES}
|
||||||
${OPENAL_LIBRARY}
|
${OPENAL_LIBRARY}
|
||||||
${OPENGL_gl_LIBRARY}
|
|
||||||
${GLEW_LIBRARY}
|
|
||||||
${ZLIB_LIBRARY}
|
${ZLIB_LIBRARY}
|
||||||
|
|
||||||
${PLATFORM_LIBRARIES}
|
${PLATFORM_LIBRARIES}
|
||||||
|
|
66
README.md
66
README.md
|
@ -1,9 +1,20 @@
|
||||||
# mkxp
|
# mkxp
|
||||||
|
|
||||||
mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
|
Discord community: https://discord.gg/A8xHE8P
|
||||||
|
Matrix space: https://matrix.to/#/#rpgmaker:mapleshrine.eu
|
||||||
|
Further links: https://mapleshrine.eu
|
||||||
|
|
||||||
|
mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
|
||||||
|
|
||||||
It is licensed under the GNU General Public License v2+.
|
It is licensed under the GNU General Public License v2+.
|
||||||
|
|
||||||
|
## Prebuilt binaries
|
||||||
|
[**Linux / Windows**](https://www.mapleshrine.eu/releases/)
|
||||||
|
[**OSX**](https://app.box.com/mkxpmacbuilds) by Ali
|
||||||
|
|
||||||
|
## Should I use mkxp
|
||||||
|
mkxp primarily targets technically versed users that are comfortable with Ruby / RGSS, and ideally know how to compile the project themselves. The reason for this is that for most games, due to Win32-API usage, mkxp is simply not a plug-and-play solution, but a building block with which a fully cross-platform version can be created in time.
|
||||||
|
|
||||||
## Bindings
|
## Bindings
|
||||||
Bindings provide the glue code for an interpreted language environment to run game scripts in. Currently there are three bindings:
|
Bindings provide the glue code for an interpreted language environment to run game scripts in. Currently there are three bindings:
|
||||||
|
|
||||||
|
@ -15,6 +26,8 @@ Matz's Ruby Interpreter, also called CRuby, is the most widely deployed version
|
||||||
For a list of differences, see:
|
For a list of differences, see:
|
||||||
http://stackoverflow.com/questions/21574/what-is-the-difference-between-ruby-1-8-and-ruby-1-9
|
http://stackoverflow.com/questions/21574/what-is-the-difference-between-ruby-1-8-and-ruby-1-9
|
||||||
|
|
||||||
|
This binding supports RGSS1, RGSS2 and RGSS3.
|
||||||
|
|
||||||
### mruby (Lightweight Ruby)
|
### mruby (Lightweight Ruby)
|
||||||
Website: https://github.com/mruby/mruby
|
Website: https://github.com/mruby/mruby
|
||||||
|
|
||||||
|
@ -24,6 +37,8 @@ Due to heavy differences between mruby and MRI as well as lacking modules, runni
|
||||||
|
|
||||||
Some extensions to the standard classes/modules are provided, taking the RPG Maker XP helpfile as a quasi "reference". These include Marshal, File, FileTest and Time.
|
Some extensions to the standard classes/modules are provided, taking the RPG Maker XP helpfile as a quasi "reference". These include Marshal, File, FileTest and Time.
|
||||||
|
|
||||||
|
This binding only supports RGSS1.
|
||||||
|
|
||||||
**Important:** If you decide to use [mattn's oniguruma regexp gem](https://github.com/mattn/mruby-onig-regexp), don't forget to add `-lonig` to the linker flags to avoid ugly symbol overlaps with libc.
|
**Important:** If you decide to use [mattn's oniguruma regexp gem](https://github.com/mattn/mruby-onig-regexp), don't forget to add `-lonig` to the linker flags to avoid ugly symbol overlaps with libc.
|
||||||
|
|
||||||
### null
|
### null
|
||||||
|
@ -35,22 +50,33 @@ This binding only exists for testing purposes and does nothing (the engine quits
|
||||||
* Boost.Program_options
|
* Boost.Program_options
|
||||||
* libsigc++ 2.0
|
* libsigc++ 2.0
|
||||||
* PhysFS (latest hg)
|
* PhysFS (latest hg)
|
||||||
* GLEW >= 1.7
|
|
||||||
* OpenAL
|
* OpenAL
|
||||||
* SDL2
|
* SDL2*
|
||||||
* SDL2_image
|
* SDL2_image
|
||||||
* SDL2_ttf
|
* SDL2_ttf
|
||||||
* SDL_sound (apply provided patches!)
|
* [my SDL_sound fork](https://github.com/Ancurio/SDL_sound)
|
||||||
|
* vorbisfile
|
||||||
* pixman
|
* pixman
|
||||||
* zlib (only ruby bindings)
|
* zlib (only ruby bindings)
|
||||||
|
* OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`)
|
||||||
|
* libiconv (on Windows, optional with INI_ENCODING)
|
||||||
|
* libguess (optional with INI_ENCODING)
|
||||||
|
|
||||||
mkxp employs Qt's qmake build system, so you'll need to install that beforehand.
|
(* For the F1 menu to work correctly under Linux/X11, you need latest hg + [this patch](https://bugzilla.libsdl.org/show_bug.cgi?id=2745))
|
||||||
|
|
||||||
|
mkxp employs Qt's qmake build system, so you'll need to install that beforehand. Alternatively, you can build with cmake (FIXME: add cmake instructions).
|
||||||
|
|
||||||
qmake will use pkg-config to locate the respective include/library paths. If you installed any dependencies into non-standard prefixes, make sure to adjust your `PKG_CONFIG_PATH` variable accordingly.
|
qmake will use pkg-config to locate the respective include/library paths. If you installed any dependencies into non-standard prefixes, make sure to adjust your `PKG_CONFIG_PATH` variable accordingly.
|
||||||
|
|
||||||
The exception is boost, which is weird in that it still hasn't managed to pull off pkg-config support (seriously?). *If you installed boost in a non-standard prefix*, you will need to pass its include path via `BOOST_I` and library path via `BOOST_L`, either as direct arguments to qmake (`qmake BOOST_I="/usr/include" ...`) or via environment variables.
|
The exception is boost, which is weird in that it still hasn't managed to pull off pkg-config support (seriously?). *If you installed boost in a non-standard prefix*, you will need to pass its include path via `BOOST_I` and library path via `BOOST_L`, either as direct arguments to qmake (`qmake BOOST_I="/usr/include" ...`) or via environment variables. You can specify a library suffix (eg. "-mt") via `BOOST_LIB_SUFFIX` if needed.
|
||||||
|
|
||||||
**MRI-Binding**: pkg-config will look for `ruby-2.1.pc`, but you can modify mkxp.pro to use 2.0 instead. This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit).
|
Midi support is enabled by default and requires fluidsynth to be present at runtime (not needed for building); if mkxp can't find it at runtime, midi playback is disabled. It looks for `libfluidsynth.so.1` on Linux, `libfluidsynth.dylib.1` on OSX and `fluidsynth.dll` on Windows, so make sure to have one of these in your link path. If you still need fluidsynth to be hard linked at buildtime, use `CONFIG+=SHARED_FLUID`. When building fluidsynth yourself, you can disable almost all options (audio drivers etc.) as they are not used. Note that upstream fluidsynth has support for sharing soundfont data between synthesizers (mkxp uses multiple synths), so if your memory usage is very high, you might want to try compiling fluidsynth from git master.
|
||||||
|
|
||||||
|
By default, mkxp switches into the directory where its binary is contained and then starts reading the configuration and resolving relative paths. In case this is undesired (eg. when the binary is to be installed to a system global, read-only location), it can be turned off by adding `DEFINES+=WORKDIR_CURRENT` to qmake's arguments.
|
||||||
|
|
||||||
|
To auto detect the encoding of the game title in `Game.ini` and auto convert it to UTF-8, build with `CONFIG+=INI_ENCODING`. Requires iconv implementation and libguess. If the encoding is wrongly detected, you can set the "titleLanguage" hint in mkxp.conf.
|
||||||
|
|
||||||
|
**MRI-Binding**: pkg-config will look for `ruby-2.1.pc`, but you can override the version with `MRIVERSION=2.2` ('2.2' being an example). This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit).
|
||||||
|
|
||||||
**MRuby-Binding**: place the "mruby" folder into the project folder and build it first. Add `BINDING=MRUBY` to qmake's arguments.
|
**MRuby-Binding**: place the "mruby" folder into the project folder and build it first. Add `BINDING=MRUBY` to qmake's arguments.
|
||||||
|
|
||||||
|
@ -59,15 +85,27 @@ The exception is boost, which is weird in that it still hasn't managed to pull o
|
||||||
### Supported image/audio formats
|
### Supported image/audio formats
|
||||||
These depend on the SDL auxiliary libraries. For maximum RGSS compliance, build SDL2_image with png/jpg support, and SDL_sound with oggvorbis/wav/mp3 support.
|
These depend on the SDL auxiliary libraries. For maximum RGSS compliance, build SDL2_image with png/jpg support, and SDL_sound with oggvorbis/wav/mp3 support.
|
||||||
|
|
||||||
To run mkxp, you should have a graphics card capable of at least **OpenGL 2.0** with an up-to-date driver installed.
|
To run mkxp, you should have a graphics card capable of at least **OpenGL (ES) 2.0** with an up-to-date driver installed.
|
||||||
|
|
||||||
|
## Dependency kit
|
||||||
|
|
||||||
|
To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://mapleshrine.eu/depkits/linux64.tar.xz). Read the "README" for instructions.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
mkxp reads configuration data from the file "mkxp.conf" contained in the current directory. The format is ini-style. Do *not* use quotes around file paths (spaces won't break). Lines starting with '#' are comments. See 'mkxp.conf.sample' for a list of accepted entries.
|
mkxp reads configuration data from the file "mkxp.conf". The format is ini-style. Do *not* use quotes around file paths (spaces won't break). Lines starting with '#' are comments. See 'mkxp.conf.sample' for a list of accepted entries.
|
||||||
|
|
||||||
## RTPs
|
All option entries can alternatively be specified as command line options. Any options that are not arrays (eg. RTP paths) specified as command line options will override entries in mkxp.conf. Note that you will have to wrap values containing spaces in quotes (unlike in mkxp.conf).
|
||||||
|
|
||||||
As of right now, mkxp doesn't support midi files, so to use the default RTPs provided by Enterbrain you will have to convert all midi tracks (those in BGM and ME) to ogg or wav. Make sure that the file names match up, ie. "foobar.mid" should be converted to "foobar.ogg".
|
The syntax is: `--<option>=<value>`
|
||||||
|
|
||||||
|
Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
|
||||||
|
|
||||||
|
## Midi music
|
||||||
|
|
||||||
|
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
|
||||||
|
|
||||||
|
You can use this public domain soundfont: [GMGSx.sf2](https://mapleshrine.eu/unsorted/GMGSx.sf2)
|
||||||
|
|
||||||
## Fonts
|
## Fonts
|
||||||
|
|
||||||
|
@ -77,9 +115,9 @@ If a requested font is not found, no error is generated. Instead, a built-in fon
|
||||||
|
|
||||||
## What doesn't work (yet)
|
## What doesn't work (yet)
|
||||||
|
|
||||||
* midi and wma audio files
|
* Movie playback
|
||||||
|
* wma audio files
|
||||||
* The Win32API ruby class (for obvious reasons)
|
* The Win32API ruby class (for obvious reasons)
|
||||||
* Restarting the game with F12
|
|
||||||
* Creating Bitmaps with sizes greater than the OpenGL texture size limit (around 8192 on modern cards)*
|
* Creating Bitmaps with sizes greater than the OpenGL texture size limit (around 8192 on modern cards)*
|
||||||
|
|
||||||
\* There is an exception to this, called *mega surface*. When a Bitmap bigger than the texture limit is created from a file, it is not stored in VRAM, but regular RAM. Its sole purpose is to be used as a tileset bitmap. Any other operation to it (besides blitting to a regular Bitmap) will result in an error.
|
\* There is an exception to this, called *mega surface*. When a Bitmap bigger than the texture limit is created from a file, it is not stored in VRAM, but regular RAM. Its sole purpose is to be used as a tileset bitmap. Any other operation to it (besides blitting to a regular Bitmap) will result in an error.
|
||||||
|
@ -89,5 +127,5 @@ If a requested font is not found, no error is generated. Instead, a built-in fon
|
||||||
To alleviate possible porting of heavily Win32API reliant scripts, I have added certain functionality that you won't find in the RGSS spec. Currently this amounts to the following:
|
To alleviate possible porting of heavily Win32API reliant scripts, I have added certain functionality that you won't find in the RGSS spec. Currently this amounts to the following:
|
||||||
|
|
||||||
* The `Input.press?` family of functions accepts three additional button constants: `::MOUSELEFT`, `::MOUSEMIDDLE` and `::MOUSERIGHT` for the respective mouse buttons.
|
* The `Input.press?` family of functions accepts three additional button constants: `::MOUSELEFT`, `::MOUSEMIDDLE` and `::MOUSERIGHT` for the respective mouse buttons.
|
||||||
* The `Input` module has two additional functions, `#mouse_x` and `#mouse_y` to query the mouse pointer position relative to the game window.
|
* The `Input` module has two additional functions, `#mouse_x` and `#mouse_y` to query the mouse pointer position relative to the game screen.
|
||||||
* The `Graphics` module has two additional properties: `fullscreen` represents the current fullscreen mode (`true` = fullscreen, `false` = windowed), `show_cursor` hides the system cursor inside the game window when `false`.
|
* The `Graphics` module has two additional properties: `fullscreen` represents the current fullscreen mode (`true` = fullscreen, `false` = windowed), `show_cursor` hides the system cursor inside the game window when `false`.
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
width="100"
|
||||||
|
height="100"
|
||||||
|
id="svg2">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3821">
|
||||||
|
<stop
|
||||||
|
id="stop3823"
|
||||||
|
style="stop-color:#00ff88;stop-opacity:1"
|
||||||
|
offset="0" />
|
||||||
|
<stop
|
||||||
|
id="stop3825"
|
||||||
|
style="stop-color:#00ff86;stop-opacity:1"
|
||||||
|
offset="1" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
transform="translate(-323.76562,-436.67187)"
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
d="m 373.76195,439.49229 c -26.05643,0 -47.17591,21.12683 -47.17591,47.18326 0,26.05643 21.11948,47.17591 47.17591,47.17591 26.05643,0 47.18326,-21.11948 47.18326,-47.17591 0,-26.05643 -21.12683,-47.18326 -47.18326,-47.18326 z m 0,26.80867 c 11.25095,0 20.37459,9.12364 20.37459,20.37459 0,11.25094 -9.12364,20.36724 -20.37459,20.36724 -11.25094,0 -20.36724,-9.1163 -20.36724,-20.36724 0,-11.25095 9.1163,-20.37459 20.36724,-20.37459 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path2985"
|
||||||
|
style="fill:#00ff87;fill-opacity:1;stroke:#000000;stroke-width:5.64083672;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,6 +24,33 @@
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
|
#define DEF_PLAY_STOP_POS(entity) \
|
||||||
|
RB_METHOD(audio_##entity##Play) \
|
||||||
|
{ \
|
||||||
|
RB_UNUSED_PARAM; \
|
||||||
|
const char *filename; \
|
||||||
|
int volume = 100; \
|
||||||
|
int pitch = 100; \
|
||||||
|
double pos = 0.0; \
|
||||||
|
if (rgssVer >= 3) \
|
||||||
|
rb_get_args(argc, argv, "z|iif", &filename, &volume, &pitch, &pos RB_ARG_END); \
|
||||||
|
else \
|
||||||
|
rb_get_args(argc, argv, "z|ii", &filename, &volume, &pitch RB_ARG_END); \
|
||||||
|
GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch, pos); ) \
|
||||||
|
return Qnil; \
|
||||||
|
} \
|
||||||
|
RB_METHOD(audio_##entity##Stop) \
|
||||||
|
{ \
|
||||||
|
RB_UNUSED_PARAM; \
|
||||||
|
shState->audio().entity##Stop(); \
|
||||||
|
return Qnil; \
|
||||||
|
} \
|
||||||
|
RB_METHOD(audio_##entity##Pos) \
|
||||||
|
{ \
|
||||||
|
RB_UNUSED_PARAM; \
|
||||||
|
return rb_float_new(shState->audio().entity##Pos()); \
|
||||||
|
}
|
||||||
|
|
||||||
#define DEF_PLAY_STOP(entity) \
|
#define DEF_PLAY_STOP(entity) \
|
||||||
RB_METHOD(audio_##entity##Play) \
|
RB_METHOD(audio_##entity##Play) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -52,15 +79,41 @@ RB_METHOD(audio_##entity##Fade) \
|
||||||
return Qnil; \
|
return Qnil; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_PLAY_STOP_FADE(entity) \
|
#define DEF_POS(entity) \
|
||||||
DEF_PLAY_STOP(entity) \
|
RB_METHOD(audio_##entity##Pos) \
|
||||||
DEF_FADE(entity)
|
{ \
|
||||||
|
RB_UNUSED_PARAM; \
|
||||||
|
return rb_float_new(shState->audio().entity##Pos()); \
|
||||||
|
}
|
||||||
|
|
||||||
DEF_PLAY_STOP_FADE( bgm )
|
DEF_PLAY_STOP_POS( bgm )
|
||||||
DEF_PLAY_STOP_FADE( bgs )
|
DEF_PLAY_STOP_POS( bgs )
|
||||||
DEF_PLAY_STOP_FADE( me )
|
|
||||||
|
|
||||||
DEF_PLAY_STOP( se )
|
DEF_PLAY_STOP( me )
|
||||||
|
|
||||||
|
DEF_FADE( bgm )
|
||||||
|
DEF_FADE( bgs )
|
||||||
|
DEF_FADE( me )
|
||||||
|
|
||||||
|
DEF_PLAY_STOP( se )
|
||||||
|
|
||||||
|
RB_METHOD(audioSetupMidi)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
shState->audio().setupMidi();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(audioReset)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
shState->audio().reset();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define BIND_PLAY_STOP(entity) \
|
#define BIND_PLAY_STOP(entity) \
|
||||||
|
@ -74,15 +127,28 @@ DEF_PLAY_STOP( se )
|
||||||
BIND_PLAY_STOP(entity) \
|
BIND_PLAY_STOP(entity) \
|
||||||
BIND_FADE(entity)
|
BIND_FADE(entity)
|
||||||
|
|
||||||
|
#define BIND_POS(entity) \
|
||||||
|
_rb_define_module_function(module, #entity "_pos", audio_##entity##Pos);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
audioBindingInit()
|
audioBindingInit()
|
||||||
{
|
{
|
||||||
VALUE module = rb_define_module("Audio");
|
VALUE module = rb_define_module("Audio");
|
||||||
|
|
||||||
BIND_PLAY_STOP_FADE( bgm )
|
BIND_PLAY_STOP_FADE( bgm );
|
||||||
BIND_PLAY_STOP_FADE( bgs )
|
BIND_PLAY_STOP_FADE( bgs );
|
||||||
BIND_PLAY_STOP_FADE( me )
|
BIND_PLAY_STOP_FADE( me );
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
BIND_POS( bgm );
|
||||||
|
BIND_POS( bgs );
|
||||||
|
|
||||||
|
_rb_define_module_function(module, "setup_midi", audioSetupMidi);
|
||||||
|
}
|
||||||
|
|
||||||
BIND_PLAY_STOP( se )
|
BIND_PLAY_STOP( se )
|
||||||
|
|
||||||
|
_rb_define_module_function(module, "__reset__", audioReset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -25,26 +25,34 @@
|
||||||
#include "eventthread.h"
|
#include "eventthread.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "sdl-util.h"
|
||||||
#include "debugwriter.h"
|
#include "debugwriter.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "audio.h"
|
||||||
|
#include "boost-hash.h"
|
||||||
|
|
||||||
#include <ruby.h>
|
#include <ruby.h>
|
||||||
#include <ruby/encoding.h>
|
#include <ruby/encoding.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include <SDL_filesystem.h>
|
#include <SDL_filesystem.h>
|
||||||
|
|
||||||
extern const char module_rpg[];
|
extern const char module_rpg1[];
|
||||||
|
extern const char module_rpg2[];
|
||||||
|
extern const char module_rpg3[];
|
||||||
|
|
||||||
static void mriBindingExecute();
|
static void mriBindingExecute();
|
||||||
static void mriBindingTerminate();
|
static void mriBindingTerminate();
|
||||||
|
static void mriBindingReset();
|
||||||
|
|
||||||
ScriptBinding scriptBindingImpl =
|
ScriptBinding scriptBindingImpl =
|
||||||
{
|
{
|
||||||
mriBindingExecute,
|
mriBindingExecute,
|
||||||
mriBindingTerminate
|
mriBindingTerminate,
|
||||||
|
mriBindingReset
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
||||||
|
@ -58,6 +66,8 @@ void viewportBindingInit();
|
||||||
void planeBindingInit();
|
void planeBindingInit();
|
||||||
void windowBindingInit();
|
void windowBindingInit();
|
||||||
void tilemapBindingInit();
|
void tilemapBindingInit();
|
||||||
|
void windowVXBindingInit();
|
||||||
|
void tilemapVXBindingInit();
|
||||||
|
|
||||||
void inputBindingInit();
|
void inputBindingInit();
|
||||||
void audioBindingInit();
|
void audioBindingInit();
|
||||||
|
@ -67,8 +77,14 @@ void fileIntBindingInit();
|
||||||
|
|
||||||
RB_METHOD(mriPrint);
|
RB_METHOD(mriPrint);
|
||||||
RB_METHOD(mriP);
|
RB_METHOD(mriP);
|
||||||
RB_METHOD(mriDataDirectory);
|
RB_METHOD(mkxpDataDirectory);
|
||||||
RB_METHOD(mkxpPuts);
|
RB_METHOD(mkxpPuts);
|
||||||
|
RB_METHOD(mkxpRawKeyStates);
|
||||||
|
RB_METHOD(mkxpMouseInWindow);
|
||||||
|
|
||||||
|
RB_METHOD(mriRgssMain);
|
||||||
|
RB_METHOD(mriRgssStop);
|
||||||
|
RB_METHOD(_kernelCaller);
|
||||||
|
|
||||||
static void mriBindingInit()
|
static void mriBindingInit()
|
||||||
{
|
{
|
||||||
|
@ -79,8 +95,17 @@ static void mriBindingInit()
|
||||||
spriteBindingInit();
|
spriteBindingInit();
|
||||||
viewportBindingInit();
|
viewportBindingInit();
|
||||||
planeBindingInit();
|
planeBindingInit();
|
||||||
windowBindingInit();
|
|
||||||
tilemapBindingInit();
|
if (rgssVer == 1)
|
||||||
|
{
|
||||||
|
windowBindingInit();
|
||||||
|
tilemapBindingInit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
windowVXBindingInit();
|
||||||
|
tilemapVXBindingInit();
|
||||||
|
}
|
||||||
|
|
||||||
inputBindingInit();
|
inputBindingInit();
|
||||||
audioBindingInit();
|
audioBindingInit();
|
||||||
|
@ -88,16 +113,50 @@ static void mriBindingInit()
|
||||||
|
|
||||||
fileIntBindingInit();
|
fileIntBindingInit();
|
||||||
|
|
||||||
_rb_define_module_function(rb_mKernel, "print", mriPrint);
|
if (rgssVer >= 3)
|
||||||
_rb_define_module_function(rb_mKernel, "p", mriP);
|
{
|
||||||
|
_rb_define_module_function(rb_mKernel, "rgss_main", mriRgssMain);
|
||||||
|
_rb_define_module_function(rb_mKernel, "rgss_stop", mriRgssStop);
|
||||||
|
|
||||||
rb_eval_string(module_rpg);
|
_rb_define_module_function(rb_mKernel, "msgbox", mriPrint);
|
||||||
|
_rb_define_module_function(rb_mKernel, "msgbox_p", mriP);
|
||||||
|
|
||||||
VALUE mod = rb_define_module("System");
|
rb_define_global_const("RGSS_VERSION", rb_str_new_cstr("3.0.1"));
|
||||||
_rb_define_module_function(mod, "data_directory", mriDataDirectory);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_rb_define_module_function(rb_mKernel, "print", mriPrint);
|
||||||
|
_rb_define_module_function(rb_mKernel, "p", mriP);
|
||||||
|
|
||||||
|
rb_define_alias(rb_singleton_class(rb_mKernel), "_mkxp_kernel_caller_alias", "caller");
|
||||||
|
_rb_define_module_function(rb_mKernel, "caller", _kernelCaller);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
rb_eval_string(module_rpg1);
|
||||||
|
else if (rgssVer == 2)
|
||||||
|
rb_eval_string(module_rpg2);
|
||||||
|
else if (rgssVer == 3)
|
||||||
|
rb_eval_string(module_rpg3);
|
||||||
|
else
|
||||||
|
assert(!"unreachable");
|
||||||
|
|
||||||
|
VALUE mod = rb_define_module("MKXP");
|
||||||
|
_rb_define_module_function(mod, "data_directory", mkxpDataDirectory);
|
||||||
_rb_define_module_function(mod, "puts", mkxpPuts);
|
_rb_define_module_function(mod, "puts", mkxpPuts);
|
||||||
|
_rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates);
|
||||||
|
_rb_define_module_function(mod, "mouse_in_window", mkxpMouseInWindow);
|
||||||
|
|
||||||
rb_define_global_const("MKXP", Qtrue);
|
/* Load global constants */
|
||||||
|
rb_gv_set("MKXP", Qtrue);
|
||||||
|
|
||||||
|
VALUE debug = rb_bool_new(shState->config().editor.debug);
|
||||||
|
if (rgssVer == 1)
|
||||||
|
rb_gv_set("DEBUG", debug);
|
||||||
|
else if (rgssVer >= 2)
|
||||||
|
rb_gv_set("TEST", debug);
|
||||||
|
|
||||||
|
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -106,18 +165,6 @@ showMsg(const std::string &msg)
|
||||||
shState->eThread().showMessageBox(msg.c_str());
|
shState->eThread().showMessageBox(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(mkxpPuts)
|
|
||||||
{
|
|
||||||
RB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *str;
|
|
||||||
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
|
||||||
|
|
||||||
Debug() << str;
|
|
||||||
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printP(int argc, VALUE *argv,
|
static void printP(int argc, VALUE *argv,
|
||||||
const char *convMethod, const char *sep)
|
const char *convMethod, const char *sep)
|
||||||
{
|
{
|
||||||
|
@ -154,41 +201,187 @@ RB_METHOD(mriP)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(mriDataDirectory)
|
RB_METHOD(mkxpDataDirectory)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
const std::string &path = shState->config().customDataPath;
|
||||||
|
const char *s = path.empty() ? "." : path.c_str();
|
||||||
|
|
||||||
|
return rb_str_new_cstr(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(mkxpPuts)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
const char *org, *app;
|
const char *str;
|
||||||
|
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
||||||
|
|
||||||
rb_get_args(argc, argv, "zz", &org, &app RB_ARG_END);
|
Debug() << str;
|
||||||
|
|
||||||
char *path = SDL_GetPrefPath(org, app);
|
return Qnil;
|
||||||
|
|
||||||
VALUE pathStr = rb_str_new_cstr(path);
|
|
||||||
|
|
||||||
SDL_free(path);
|
|
||||||
|
|
||||||
return pathStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void runCustomScript(const char *filename)
|
RB_METHOD(mkxpRawKeyStates)
|
||||||
{
|
{
|
||||||
std::string scriptData("#encoding:utf-8\n");
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
if (!readFile(filename, scriptData))
|
VALUE str = rb_str_new(0, sizeof(EventThread::keyStates));
|
||||||
|
memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates));
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(mkxpMouseInWindow)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
return rb_bool_new(EventThread::mouseState.inWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE rgssMainCb(VALUE block)
|
||||||
|
{
|
||||||
|
rb_funcall2(block, rb_intern("call"), 0, 0);
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE rgssMainRescue(VALUE arg, VALUE exc)
|
||||||
|
{
|
||||||
|
VALUE *excRet = (VALUE*) arg;
|
||||||
|
|
||||||
|
*excRet = exc;
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void processReset()
|
||||||
|
{
|
||||||
|
shState->graphics().reset();
|
||||||
|
shState->audio().reset();
|
||||||
|
|
||||||
|
shState->rtData().rqReset.clear();
|
||||||
|
shState->graphics().repaintWait(shState->rtData().rqResetFinish,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(mriRgssMain)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
VALUE exc = Qnil;
|
||||||
|
|
||||||
|
rb_rescue2((VALUE(*)(ANYARGS)) rgssMainCb, rb_block_proc(),
|
||||||
|
(VALUE(*)(ANYARGS)) rgssMainRescue, (VALUE) &exc,
|
||||||
|
rb_eException, (VALUE) 0);
|
||||||
|
|
||||||
|
if (NIL_P(exc))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (rb_obj_class(exc) == getRbData()->exc[Reset])
|
||||||
|
processReset();
|
||||||
|
else
|
||||||
|
rb_exc_raise(exc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(mriRgssStop)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
shState->graphics().update();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(_kernelCaller)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
VALUE trace = rb_funcall2(rb_mKernel, rb_intern("_mkxp_kernel_caller_alias"), 0, 0);
|
||||||
|
|
||||||
|
if (!RB_TYPE_P(trace, RUBY_T_ARRAY))
|
||||||
|
return trace;
|
||||||
|
|
||||||
|
long len = RARRAY_LEN(trace);
|
||||||
|
|
||||||
|
if (len < 2)
|
||||||
|
return trace;
|
||||||
|
|
||||||
|
/* Remove useless "ruby:1:in 'eval'" */
|
||||||
|
rb_ary_pop(trace);
|
||||||
|
|
||||||
|
/* Also remove trace of this helper function */
|
||||||
|
rb_ary_shift(trace);
|
||||||
|
|
||||||
|
len -= 2;
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
return trace;
|
||||||
|
|
||||||
|
/* RMXP does this, not sure if specific or 1.8 related */
|
||||||
|
VALUE args[] = { rb_str_new_cstr(":in `<main>'"), rb_str_new_cstr("") };
|
||||||
|
rb_funcall2(rb_ary_entry(trace, len-1), rb_intern("gsub!"), 2, args);
|
||||||
|
|
||||||
|
return trace;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE newStringUTF8(const char *string, long length)
|
||||||
|
{
|
||||||
|
return rb_enc_str_new(string, length, rb_utf8_encoding());
|
||||||
|
}
|
||||||
|
|
||||||
|
struct evalArg
|
||||||
|
{
|
||||||
|
VALUE string;
|
||||||
|
VALUE filename;
|
||||||
|
};
|
||||||
|
|
||||||
|
static VALUE evalHelper(evalArg *arg)
|
||||||
|
{
|
||||||
|
VALUE argv[] = { arg->string, Qnil, arg->filename };
|
||||||
|
return rb_funcall2(Qnil, rb_intern("eval"), ARRAY_SIZE(argv), argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE evalString(VALUE string, VALUE filename, int *state)
|
||||||
|
{
|
||||||
|
evalArg arg = { string, filename };
|
||||||
|
return rb_protect((VALUE (*)(VALUE))evalHelper, (VALUE)&arg, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void runCustomScript(const std::string &filename)
|
||||||
|
{
|
||||||
|
std::string scriptData;
|
||||||
|
|
||||||
|
if (!readFileSDL(filename.c_str(), scriptData))
|
||||||
{
|
{
|
||||||
showMsg(std::string("Unable to open '") + filename + "'");
|
showMsg(std::string("Unable to open '") + filename + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_eval_string_protect(scriptData.c_str(), 0);
|
evalString(newStringUTF8(scriptData.c_str(), scriptData.size()),
|
||||||
|
newStringUTF8(filename.c_str(), filename.size()), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE kernelLoadDataInt(const char *filename);
|
VALUE kernelLoadDataInt(const char *filename, bool rubyExc);
|
||||||
|
|
||||||
static void runRMXPScripts()
|
struct BacktraceData
|
||||||
{
|
{
|
||||||
const std::string &scriptPack = shState->rtData().config.game.scripts;
|
/* Maps: Ruby visible filename, To: Actual script name */
|
||||||
|
BoostHash<std::string, std::string> scriptNames;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SCRIPT_SECTION_FMT (rgssVer >= 3 ? "{%04ld}" : "Section%03ld")
|
||||||
|
|
||||||
|
static void runRMXPScripts(BacktraceData &btData)
|
||||||
|
{
|
||||||
|
const Config &conf = shState->rtData().config;
|
||||||
|
const std::string &scriptPack = conf.game.scripts;
|
||||||
|
|
||||||
if (scriptPack.empty())
|
if (scriptPack.empty())
|
||||||
{
|
{
|
||||||
|
@ -202,14 +395,28 @@ static void runRMXPScripts()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE scriptArray = kernelLoadDataInt(scriptPack.c_str());
|
VALUE scriptArray;
|
||||||
|
|
||||||
if (rb_type(scriptArray) != RUBY_T_ARRAY)
|
/* We checked if Scripts.rxdata exists, but something might
|
||||||
|
* still go wrong */
|
||||||
|
try
|
||||||
|
{
|
||||||
|
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||||
|
}
|
||||||
|
catch (const Exception &e)
|
||||||
|
{
|
||||||
|
showMsg(std::string("Failed to read script data: ") + e.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY))
|
||||||
{
|
{
|
||||||
showMsg("Failed to read script data");
|
showMsg("Failed to read script data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rb_gv_set("$RGSS_SCRIPTS", scriptArray);
|
||||||
|
|
||||||
long scriptCount = RARRAY_LEN(scriptArray);
|
long scriptCount = RARRAY_LEN(scriptArray);
|
||||||
|
|
||||||
std::string decodeBuffer;
|
std::string decodeBuffer;
|
||||||
|
@ -219,7 +426,7 @@ static void runRMXPScripts()
|
||||||
{
|
{
|
||||||
VALUE script = rb_ary_entry(scriptArray, i);
|
VALUE script = rb_ary_entry(scriptArray, i);
|
||||||
|
|
||||||
if (rb_type(script) != RUBY_T_ARRAY)
|
if (!RB_TYPE_P(script, RUBY_T_ARRAY))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
VALUE scriptName = rb_ary_entry(script, 1);
|
VALUE scriptName = rb_ary_entry(script, 1);
|
||||||
|
@ -259,61 +466,168 @@ static void runRMXPScripts()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store encoding header + the decoded script
|
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
|
||||||
* in 'sc.decData' */
|
|
||||||
std::string decData = "#encoding:utf-8\n";
|
|
||||||
size_t hdSize = decData.size();
|
|
||||||
decData.resize(hdSize + bufferLen);
|
|
||||||
memcpy(&decData[hdSize], decodeBuffer.c_str(), bufferLen);
|
|
||||||
|
|
||||||
ruby_script(RSTRING_PTR(scriptName));
|
|
||||||
|
|
||||||
rb_gc_start();
|
|
||||||
|
|
||||||
/* Execute code */
|
|
||||||
rb_eval_string_protect(decData.c_str(), 0);
|
|
||||||
|
|
||||||
VALUE exc = rb_errinfo();
|
|
||||||
if (!NIL_P(exc))
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Execute preloaded scripts */
|
||||||
|
for (std::set<std::string>::iterator i = conf.preloadScripts.begin();
|
||||||
|
i != conf.preloadScripts.end(); ++i)
|
||||||
|
runCustomScript(*i);
|
||||||
|
|
||||||
|
VALUE exc = rb_gv_get("$!");
|
||||||
|
if (exc != Qnil)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
for (long i = 0; i < scriptCount; ++i)
|
||||||
|
{
|
||||||
|
VALUE script = rb_ary_entry(scriptArray, i);
|
||||||
|
VALUE scriptDecoded = rb_ary_entry(script, 3);
|
||||||
|
VALUE string = newStringUTF8(RSTRING_PTR(scriptDecoded),
|
||||||
|
RSTRING_LEN(scriptDecoded));
|
||||||
|
|
||||||
|
VALUE fname;
|
||||||
|
const char *scriptName = RSTRING_PTR(rb_ary_entry(script, 1));
|
||||||
|
char buf[512];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (conf.useScriptNames)
|
||||||
|
len = snprintf(buf, sizeof(buf), "%03ld:%s", i, scriptName);
|
||||||
|
else
|
||||||
|
len = snprintf(buf, sizeof(buf), SCRIPT_SECTION_FMT, i);
|
||||||
|
|
||||||
|
fname = newStringUTF8(buf, len);
|
||||||
|
btData.scriptNames.insert(buf, scriptName);
|
||||||
|
|
||||||
|
int state;
|
||||||
|
evalString(string, fname, &state);
|
||||||
|
if (state)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE exc = rb_gv_get("$!");
|
||||||
|
if (rb_obj_class(exc) != getRbData()->exc[Reset])
|
||||||
|
break;
|
||||||
|
|
||||||
|
processReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showExc(VALUE exc, const BacktraceData &btData)
|
||||||
|
{
|
||||||
|
VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
|
||||||
|
VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL);
|
||||||
|
VALUE bt0 = rb_ary_entry(bt, 0);
|
||||||
|
VALUE name = rb_class_path(rb_obj_class(exc));
|
||||||
|
|
||||||
|
VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")",
|
||||||
|
bt0, exc, name);
|
||||||
|
/* omit "useless" last entry (from ruby:1:in `eval') */
|
||||||
|
for (long i = 1, btlen = RARRAY_LEN(bt) - 1; i < btlen; ++i)
|
||||||
|
rb_str_catf(ds, "\n\tfrom %" PRIsVALUE, rb_ary_entry(bt, i));
|
||||||
|
Debug() << StringValueCStr(ds);
|
||||||
|
|
||||||
|
char *s = RSTRING_PTR(bt0);
|
||||||
|
|
||||||
|
char line[16];
|
||||||
|
std::string file(512, '\0');
|
||||||
|
|
||||||
|
char *p = s + strlen(s);
|
||||||
|
char *e;
|
||||||
|
|
||||||
|
while (p != s)
|
||||||
|
if (*--p == ':')
|
||||||
|
break;
|
||||||
|
|
||||||
|
e = p;
|
||||||
|
|
||||||
|
while (p != s)
|
||||||
|
if (*--p == ':')
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* s p e
|
||||||
|
* SectionXXX:YY: in 'blabla' */
|
||||||
|
|
||||||
|
*e = '\0';
|
||||||
|
strncpy(line, *p ? p+1 : p, sizeof(line));
|
||||||
|
line[sizeof(line)-1] = '\0';
|
||||||
|
*e = ':';
|
||||||
|
e = p;
|
||||||
|
|
||||||
|
/* s e
|
||||||
|
* SectionXXX:YY: in 'blabla' */
|
||||||
|
|
||||||
|
*e = '\0';
|
||||||
|
strncpy(&file[0], s, file.size());
|
||||||
|
*e = ':';
|
||||||
|
|
||||||
|
/* Shrink to fit */
|
||||||
|
file.resize(strlen(file.c_str()));
|
||||||
|
file = btData.scriptNames.value(file, file);
|
||||||
|
|
||||||
|
std::string ms(640, '\0');
|
||||||
|
snprintf(&ms[0], ms.size(), "Script '%s' line %s: %s occured.\n\n%s",
|
||||||
|
file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
||||||
|
|
||||||
|
showMsg(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mriBindingExecute()
|
static void mriBindingExecute()
|
||||||
{
|
{
|
||||||
|
/* Normally only a ruby executable would do a sysinit,
|
||||||
|
* but not doing it will lead to crashes due to closed
|
||||||
|
* stdio streams on some platforms (eg. Windows) */
|
||||||
|
int argc = 0;
|
||||||
|
char **argv = 0;
|
||||||
|
ruby_sysinit(&argc, &argv);
|
||||||
|
|
||||||
ruby_setup();
|
ruby_setup();
|
||||||
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
|
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
|
||||||
|
|
||||||
|
Config &conf = shState->rtData().config;
|
||||||
|
|
||||||
|
if (!conf.rubyLoadpaths.empty())
|
||||||
|
{
|
||||||
|
/* Setup custom load paths */
|
||||||
|
VALUE lpaths = rb_gv_get(":");
|
||||||
|
|
||||||
|
for (size_t i = 0; i < conf.rubyLoadpaths.size(); ++i)
|
||||||
|
{
|
||||||
|
std::string &path = conf.rubyLoadpaths[i];
|
||||||
|
|
||||||
|
VALUE pathv = rb_str_new(path.c_str(), path.size());
|
||||||
|
rb_ary_push(lpaths, pathv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RbData rbData;
|
RbData rbData;
|
||||||
shState->setBindingData(&rbData);
|
shState->setBindingData(&rbData);
|
||||||
|
BacktraceData btData;
|
||||||
|
|
||||||
mriBindingInit();
|
mriBindingInit();
|
||||||
|
|
||||||
std::string &customScript = shState->rtData().config.customScript;
|
std::string &customScript = conf.customScript;
|
||||||
if (!customScript.empty())
|
if (!customScript.empty())
|
||||||
runCustomScript(customScript.c_str());
|
runCustomScript(customScript);
|
||||||
else
|
else
|
||||||
runRMXPScripts();
|
runRMXPScripts(btData);
|
||||||
|
|
||||||
VALUE exc = rb_errinfo();
|
VALUE exc = rb_errinfo();
|
||||||
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
|
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
|
||||||
{
|
showExc(exc, btData);
|
||||||
Debug() << "Had exception:" << rb_class2name(rb_obj_class(exc));
|
|
||||||
VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
|
|
||||||
rb_p(bt);
|
|
||||||
VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL);
|
|
||||||
if (RSTRING_LEN(msg) < 256)
|
|
||||||
showMsg(RSTRING_PTR(msg));
|
|
||||||
else
|
|
||||||
Debug() << (RSTRING_PTR(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
ruby_cleanup(0);
|
ruby_cleanup(0);
|
||||||
|
|
||||||
shState->rtData().rqTermAck = true;
|
shState->rtData().rqTermAck.set();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mriBindingTerminate()
|
static void mriBindingTerminate()
|
||||||
{
|
{
|
||||||
rb_raise(rb_eSystemExit, " ");
|
rb_raise(rb_eSystemExit, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mriBindingReset()
|
||||||
|
{
|
||||||
|
rb_raise(getRbData()->exc[Reset], " ");
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,21 +26,9 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
void initType(rb_data_type_struct &type,
|
|
||||||
const char *name,
|
|
||||||
void (*freeInst)(void *))
|
|
||||||
{
|
|
||||||
type.wrap_struct_name = name;
|
|
||||||
type.function.dmark = 0;
|
|
||||||
type.function.dsize = 0;
|
|
||||||
type.function.dfree = freeInst;
|
|
||||||
type.function.reserved[0] =
|
|
||||||
type.function.reserved[1] = 0;
|
|
||||||
type.parent = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
RbData *getRbData()
|
RbData *getRbData()
|
||||||
{
|
{
|
||||||
return static_cast<RbData*>(shState->bindingData());
|
return static_cast<RbData*>(shState->bindingData());
|
||||||
|
@ -53,7 +41,6 @@ struct
|
||||||
} static customExc[] =
|
} static customExc[] =
|
||||||
{
|
{
|
||||||
{ MKXP, "MKXPError" },
|
{ MKXP, "MKXPError" },
|
||||||
{ RGSS, "RGSSError" },
|
|
||||||
{ PHYSFS, "PHYSFSError" },
|
{ PHYSFS, "PHYSFSError" },
|
||||||
{ SDL, "SDLError" }
|
{ SDL, "SDLError" }
|
||||||
};
|
};
|
||||||
|
@ -63,6 +50,9 @@ RbData::RbData()
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(customExc); ++i)
|
for (size_t i = 0; i < ARRAY_SIZE(customExc); ++i)
|
||||||
exc[customExc[i].id] = rb_define_class(customExc[i].name, rb_eException);
|
exc[customExc[i].id] = rb_define_class(customExc[i].name, rb_eException);
|
||||||
|
|
||||||
|
exc[RGSS] = rb_define_class("RGSSError", rb_eStandardError);
|
||||||
|
exc[Reset] = rb_define_class(rgssVer >= 3 ? "RGSSReset" : "Reset", rb_eException);
|
||||||
|
|
||||||
exc[ErrnoENOENT] = rb_const_get(rb_const_get(rb_cObject, rb_intern("Errno")), rb_intern("ENOENT"));
|
exc[ErrnoENOENT] = rb_const_get(rb_const_get(rb_cObject, rb_intern("Errno")), rb_intern("ENOENT"));
|
||||||
exc[IOError] = rb_eIOError;
|
exc[IOError] = rb_eIOError;
|
||||||
exc[TypeError] = rb_eTypeError;
|
exc[TypeError] = rb_eTypeError;
|
||||||
|
@ -97,6 +87,18 @@ void raiseRbExc(const Exception &exc)
|
||||||
rb_raise(excClass, "%s", exc.msg.c_str());
|
rb_raise(excClass, "%s", exc.msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
raiseDisposedAccess(VALUE self)
|
||||||
|
{
|
||||||
|
const char *klassName = RTYPEDDATA_TYPE(self)->wrap_struct_name;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
strncpy(buf, klassName, sizeof(buf));
|
||||||
|
buf[0] = tolower(buf[0]);
|
||||||
|
|
||||||
|
rb_raise(getRbData()->exc[RGSS], "disposed %s", buf);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +150,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
||||||
VALUE *str = va_arg(ap, VALUE*);
|
VALUE *str = va_arg(ap, VALUE*);
|
||||||
VALUE tmp = *arg;
|
VALUE tmp = *arg;
|
||||||
|
|
||||||
if (!(rb_type(tmp) == RUBY_T_STRING))
|
if (!RB_TYPE_P(tmp, RUBY_T_STRING))
|
||||||
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
||||||
|
|
||||||
*str = tmp;
|
*str = tmp;
|
||||||
|
@ -167,7 +169,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
||||||
|
|
||||||
VALUE tmp = *arg;
|
VALUE tmp = *arg;
|
||||||
|
|
||||||
if (!(rb_type(tmp) == RUBY_T_STRING))
|
if (!RB_TYPE_P(tmp, RUBY_T_STRING))
|
||||||
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
||||||
|
|
||||||
*s = RSTRING_PTR(tmp);
|
*s = RSTRING_PTR(tmp);
|
||||||
|
@ -186,7 +188,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
||||||
|
|
||||||
VALUE tmp = *arg++;
|
VALUE tmp = *arg++;
|
||||||
|
|
||||||
if (!(rb_type(tmp) == RUBY_T_STRING))
|
if (!RB_TYPE_P(tmp, RUBY_T_STRING))
|
||||||
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
||||||
|
|
||||||
*s = RSTRING_PTR(tmp);
|
*s = RSTRING_PTR(tmp);
|
||||||
|
@ -237,6 +239,24 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'n' :
|
||||||
|
{
|
||||||
|
if (argI >= argc)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ID *sym = va_arg(ap, ID*);
|
||||||
|
|
||||||
|
VALUE symVal = *arg++;
|
||||||
|
|
||||||
|
if (!SYMBOL_P(symVal))
|
||||||
|
rb_raise(rb_eTypeError, "Argument %d: Expected symbol", argI);
|
||||||
|
|
||||||
|
*sym = SYM2ID(symVal);
|
||||||
|
++argI;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case '|' :
|
case '|' :
|
||||||
opt = true;
|
opt = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
enum RbException
|
enum RbException
|
||||||
{
|
{
|
||||||
RGSS = 0,
|
RGSS = 0,
|
||||||
|
Reset,
|
||||||
PHYSFS,
|
PHYSFS,
|
||||||
SDL,
|
SDL,
|
||||||
MKXP,
|
MKXP,
|
||||||
|
@ -47,6 +48,9 @@ struct RbData
|
||||||
{
|
{
|
||||||
VALUE exc[RbExceptionsMax];
|
VALUE exc[RbExceptionsMax];
|
||||||
|
|
||||||
|
/* Input module (RGSS3) */
|
||||||
|
VALUE buttoncodeHash;
|
||||||
|
|
||||||
RbData();
|
RbData();
|
||||||
~RbData();
|
~RbData();
|
||||||
};
|
};
|
||||||
|
@ -59,19 +63,39 @@ void
|
||||||
raiseRbExc(const Exception &exc);
|
raiseRbExc(const Exception &exc);
|
||||||
|
|
||||||
#define DECL_TYPE(Klass) \
|
#define DECL_TYPE(Klass) \
|
||||||
extern rb_data_type_struct Klass##Type
|
extern rb_data_type_t Klass##Type
|
||||||
|
|
||||||
#define DEF_TYPE(Klass) \
|
/* 2.1 has added a new field (flags) to rb_data_type_t */
|
||||||
rb_data_type_struct Klass##Type
|
#include <ruby/version.h>
|
||||||
|
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 1
|
||||||
|
/* TODO: can mkxp use RUBY_TYPED_FREE_IMMEDIATELY here? */
|
||||||
|
#define DEF_TYPE_FLAGS 0
|
||||||
|
#else
|
||||||
|
#define DEF_TYPE_FLAGS
|
||||||
|
#endif
|
||||||
|
|
||||||
void initType(rb_data_type_struct &type,
|
#define DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, Free) \
|
||||||
const char *name,
|
rb_data_type_t Klass##Type = { \
|
||||||
void (*freeInst)(void*));
|
Name, { 0, Free, 0, { 0, 0 } }, 0, 0, DEF_TYPE_FLAGS \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEF_TYPE_CUSTOMFREE(Klass, Free) \
|
||||||
|
DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, #Klass, Free)
|
||||||
|
|
||||||
|
#define DEF_TYPE_CUSTOMNAME(Klass, Name) \
|
||||||
|
DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, freeInstance<Klass>)
|
||||||
|
|
||||||
|
#define DEF_TYPE(Klass) DEF_TYPE_CUSTOMNAME(Klass, #Klass)
|
||||||
|
|
||||||
template<rb_data_type_t *rbType>
|
template<rb_data_type_t *rbType>
|
||||||
static VALUE classAllocate(VALUE klass)
|
static VALUE classAllocate(VALUE klass)
|
||||||
{
|
{
|
||||||
|
/* 2.3 has changed the name of this function */
|
||||||
|
#if RUBY_API_VERSION_MAJOR >= 2 && RUBY_API_VERSION_MINOR >= 3
|
||||||
|
return rb_data_typed_object_wrap(klass, 0, rbType);
|
||||||
|
#else
|
||||||
return rb_data_typed_object_alloc(klass, 0, rbType);
|
return rb_data_typed_object_alloc(klass, 0, rbType);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
|
@ -80,18 +104,21 @@ static void freeInstance(void *inst)
|
||||||
delete static_cast<C*>(inst);
|
delete static_cast<C*>(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INIT_TYPE(Klass) initType(Klass##Type, #Klass, freeInstance<Klass>)
|
void
|
||||||
|
raiseDisposedAccess(VALUE self);
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
static inline C *
|
inline C *
|
||||||
getPrivateData(VALUE self)
|
getPrivateData(VALUE self)
|
||||||
{
|
{
|
||||||
return static_cast<C*>(RTYPEDDATA_DATA(self));
|
C *c = static_cast<C*>(RTYPEDDATA_DATA(self));
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
static inline C *
|
static inline C *
|
||||||
getPrivateDataCheck(VALUE self, const rb_data_type_struct &type)
|
getPrivateDataCheck(VALUE self, const rb_data_type_t &type)
|
||||||
{
|
{
|
||||||
void *obj = Check_TypedStruct(self, &type);
|
void *obj = Check_TypedStruct(self, &type);
|
||||||
return static_cast<C*>(obj);
|
return static_cast<C*>(obj);
|
||||||
|
@ -104,9 +131,10 @@ setPrivateData(VALUE self, void *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VALUE
|
inline VALUE
|
||||||
wrapObject(void *p, const rb_data_type_struct &type)
|
wrapObject(void *p, const rb_data_type_t &type,
|
||||||
|
VALUE underKlass = rb_cObject)
|
||||||
{
|
{
|
||||||
VALUE klass = rb_const_get(rb_cObject, rb_intern(type.wrap_struct_name));
|
VALUE klass = rb_const_get(underKlass, rb_intern(type.wrap_struct_name));
|
||||||
VALUE obj = rb_obj_alloc(klass);
|
VALUE obj = rb_obj_alloc(klass);
|
||||||
|
|
||||||
setPrivateData(obj, p);
|
setPrivateData(obj, p);
|
||||||
|
@ -116,22 +144,17 @@ wrapObject(void *p, const rb_data_type_struct &type)
|
||||||
|
|
||||||
inline VALUE
|
inline VALUE
|
||||||
wrapProperty(VALUE self, void *prop, const char *iv,
|
wrapProperty(VALUE self, void *prop, const char *iv,
|
||||||
const rb_data_type_struct &type)
|
const rb_data_type_t &type,
|
||||||
|
VALUE underKlass = rb_cObject)
|
||||||
{
|
{
|
||||||
VALUE propObj = wrapObject(prop, type);
|
VALUE propObj = wrapObject(prop, type, underKlass);
|
||||||
|
|
||||||
rb_iv_set(self, iv, propObj);
|
rb_iv_set(self, iv, propObj);
|
||||||
|
|
||||||
return propObj;
|
return propObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
/* Implemented: oSszfibn| */
|
||||||
wrapNilProperty(VALUE self, const char *iv)
|
|
||||||
{
|
|
||||||
rb_iv_set(self, iv, Qnil);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implemented: oSszfib| */
|
|
||||||
int
|
int
|
||||||
rb_get_args(int argc, VALUE *argv, const char *format, ...);
|
rb_get_args(int argc, VALUE *argv, const char *format, ...);
|
||||||
|
|
||||||
|
@ -281,38 +304,14 @@ rb_check_argc(int actual, int expected)
|
||||||
return self; \
|
return self; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're not binding a disposable class,
|
/* Object property which is copied by reference, with allowed NIL
|
||||||
* we want to #undef DEF_PROP_CHK_DISP */
|
* FIXME: Getter assumes prop is disposable,
|
||||||
#define DEF_PROP_CHK_DISP \
|
* because self.disposed? is not checked in this case.
|
||||||
checkDisposed(k, DISP_CLASS_NAME);
|
* Should make this more clear */
|
||||||
|
#define DEF_PROP_OBJ_REF(Klass, PropKlass, PropName, prop_iv) \
|
||||||
#define DEF_PROP_OBJ(Klass, PropKlass, PropName, prop_iv) \
|
|
||||||
RB_METHOD(Klass##Get##PropName) \
|
RB_METHOD(Klass##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
RB_UNUSED_PARAM; \
|
RB_UNUSED_PARAM; \
|
||||||
Klass *k = getPrivateData<Klass>(self); (void) k; \
|
|
||||||
DEF_PROP_CHK_DISP \
|
|
||||||
return rb_iv_get(self, prop_iv); \
|
|
||||||
} \
|
|
||||||
RB_METHOD(Klass##Set##PropName) \
|
|
||||||
{ \
|
|
||||||
rb_check_argc(argc, 1); \
|
|
||||||
Klass *k = getPrivateData<Klass>(self); \
|
|
||||||
VALUE propObj = *argv; \
|
|
||||||
PropKlass *prop; \
|
|
||||||
prop = getPrivateDataCheck<PropKlass>(propObj, PropKlass##Type); \
|
|
||||||
GUARD_EXC( k->set##PropName(prop); ) \
|
|
||||||
rb_iv_set(self, prop_iv, propObj); \
|
|
||||||
return propObj; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Object property with allowed NIL */
|
|
||||||
#define DEF_PROP_OBJ_NIL(Klass, PropKlass, PropName, prop_iv) \
|
|
||||||
RB_METHOD(Klass##Get##PropName) \
|
|
||||||
{ \
|
|
||||||
RB_UNUSED_PARAM; \
|
|
||||||
Klass *k = getPrivateData<Klass>(self); (void) k; \
|
|
||||||
DEF_PROP_CHK_DISP \
|
|
||||||
return rb_iv_get(self, prop_iv); \
|
return rb_iv_get(self, prop_iv); \
|
||||||
} \
|
} \
|
||||||
RB_METHOD(Klass##Set##PropName) \
|
RB_METHOD(Klass##Set##PropName) \
|
||||||
|
@ -331,13 +330,33 @@ rb_check_argc(int actual, int expected)
|
||||||
return propObj; \
|
return propObj; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Object property which is copied by value, not reference */
|
||||||
|
#define DEF_PROP_OBJ_VAL(Klass, PropKlass, PropName, prop_iv) \
|
||||||
|
RB_METHOD(Klass##Get##PropName) \
|
||||||
|
{ \
|
||||||
|
RB_UNUSED_PARAM; \
|
||||||
|
checkDisposed<Klass>(self); \
|
||||||
|
return rb_iv_get(self, prop_iv); \
|
||||||
|
} \
|
||||||
|
RB_METHOD(Klass##Set##PropName) \
|
||||||
|
{ \
|
||||||
|
rb_check_argc(argc, 1); \
|
||||||
|
Klass *k = getPrivateData<Klass>(self); \
|
||||||
|
VALUE propObj = *argv; \
|
||||||
|
PropKlass *prop; \
|
||||||
|
prop = getPrivateDataCheck<PropKlass>(propObj, PropKlass##Type); \
|
||||||
|
GUARD_EXC( k->set##PropName(*prop); ) \
|
||||||
|
return propObj; \
|
||||||
|
}
|
||||||
|
|
||||||
#define DEF_PROP(Klass, type, PropName, arg_fun, value_fun) \
|
#define DEF_PROP(Klass, type, PropName, arg_fun, value_fun) \
|
||||||
RB_METHOD(Klass##Get##PropName) \
|
RB_METHOD(Klass##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
RB_UNUSED_PARAM; \
|
RB_UNUSED_PARAM; \
|
||||||
Klass *k = getPrivateData<Klass>(self); \
|
Klass *k = getPrivateData<Klass>(self); \
|
||||||
DEF_PROP_CHK_DISP \
|
type value = 0; \
|
||||||
return value_fun(k->get##PropName()); \
|
GUARD_EXC( value = k->get##PropName(); ) \
|
||||||
|
return value_fun(value); \
|
||||||
} \
|
} \
|
||||||
RB_METHOD(Klass##Set##PropName) \
|
RB_METHOD(Klass##Set##PropName) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,14 +22,32 @@
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "bitmap"
|
|
||||||
|
|
||||||
DEF_TYPE(Bitmap);
|
DEF_TYPE(Bitmap);
|
||||||
|
|
||||||
|
static const char *objAsStringPtr(VALUE obj)
|
||||||
|
{
|
||||||
|
VALUE str = rb_obj_as_string(obj);
|
||||||
|
return RSTRING_PTR(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bitmapInitProps(Bitmap *b, VALUE self)
|
||||||
|
{
|
||||||
|
/* Wrap properties */
|
||||||
|
VALUE fontKlass = rb_const_get(rb_cObject, rb_intern("Font"));
|
||||||
|
VALUE fontObj = rb_obj_alloc(fontKlass);
|
||||||
|
rb_obj_call_init(fontObj, 0, 0);
|
||||||
|
|
||||||
|
Font *font = getPrivateData<Font>(fontObj);
|
||||||
|
b->setInitFont(font);
|
||||||
|
|
||||||
|
rb_iv_set(self, "font", fontObj);
|
||||||
|
}
|
||||||
|
|
||||||
RB_METHOD(bitmapInitialize)
|
RB_METHOD(bitmapInitialize)
|
||||||
{
|
{
|
||||||
Bitmap *b = 0;
|
Bitmap *b = 0;
|
||||||
|
@ -50,14 +68,7 @@ RB_METHOD(bitmapInitialize)
|
||||||
}
|
}
|
||||||
|
|
||||||
setPrivateData(self, b);
|
setPrivateData(self, b);
|
||||||
|
bitmapInitProps(b, self);
|
||||||
/* Wrap properties */
|
|
||||||
Font *font = new Font();
|
|
||||||
b->setFont(font);
|
|
||||||
font->setColor(new Color(*font->getColor()));
|
|
||||||
|
|
||||||
VALUE fontProp = wrapProperty(self, font, "font", FontType);
|
|
||||||
wrapProperty(fontProp, font->getColor(), "color", ColorType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -197,12 +208,7 @@ RB_METHOD(bitmapGetPixel)
|
||||||
|
|
||||||
rb_get_args(argc, argv, "ii", &x, &y RB_ARG_END);
|
rb_get_args(argc, argv, "ii", &x, &y RB_ARG_END);
|
||||||
|
|
||||||
GUARD_EXC(
|
Color value;
|
||||||
if (x < 0 || y < 0 || x >= b->width() || y >= b->height())
|
|
||||||
return Qnil;
|
|
||||||
)
|
|
||||||
|
|
||||||
Vec4 value;
|
|
||||||
GUARD_EXC( value = b->getPixel(x, y); );
|
GUARD_EXC( value = b->getPixel(x, y); );
|
||||||
|
|
||||||
Color *color = new Color(value);
|
Color *color = new Color(value);
|
||||||
|
@ -223,7 +229,7 @@ RB_METHOD(bitmapSetPixel)
|
||||||
|
|
||||||
color = getPrivateDataCheck<Color>(colorObj, ColorType);
|
color = getPrivateDataCheck<Color>(colorObj, ColorType);
|
||||||
|
|
||||||
GUARD_EXC( b->setPixel(x, y, color->norm); );
|
GUARD_EXC( b->setPixel(x, y, *color); );
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +259,17 @@ RB_METHOD(bitmapDrawText)
|
||||||
VALUE rectObj;
|
VALUE rectObj;
|
||||||
Rect *rect;
|
Rect *rect;
|
||||||
|
|
||||||
rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END);
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
VALUE strObj;
|
||||||
|
rb_get_args(argc, argv, "oo|i", &rectObj, &strObj, &align RB_ARG_END);
|
||||||
|
|
||||||
|
str = objAsStringPtr(strObj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END);
|
||||||
|
}
|
||||||
|
|
||||||
rect = getPrivateDataCheck<Rect>(rectObj, RectType);
|
rect = getPrivateDataCheck<Rect>(rectObj, RectType);
|
||||||
|
|
||||||
|
@ -263,7 +279,17 @@ RB_METHOD(bitmapDrawText)
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
rb_get_args(argc, argv, "iiiiz|i", &x, &y, &width, &height, &str, &align RB_ARG_END);
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
VALUE strObj;
|
||||||
|
rb_get_args(argc, argv, "iiiio|i", &x, &y, &width, &height, &strObj, &align RB_ARG_END);
|
||||||
|
|
||||||
|
str = objAsStringPtr(strObj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb_get_args(argc, argv, "iiiiz|i", &x, &y, &width, &height, &str, &align RB_ARG_END);
|
||||||
|
}
|
||||||
|
|
||||||
GUARD_EXC( b->drawText(x, y, width, height, str, align); );
|
GUARD_EXC( b->drawText(x, y, width, height, str, align); );
|
||||||
}
|
}
|
||||||
|
@ -277,7 +303,17 @@ RB_METHOD(bitmapTextSize)
|
||||||
|
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
VALUE strObj;
|
||||||
|
rb_get_args(argc, argv, "o", &strObj RB_ARG_END);
|
||||||
|
|
||||||
|
str = objAsStringPtr(strObj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb_get_args(argc, argv, "z", &str RB_ARG_END);
|
||||||
|
}
|
||||||
|
|
||||||
IntRect value;
|
IntRect value;
|
||||||
GUARD_EXC( value = b->textSize(str); );
|
GUARD_EXC( value = b->textSize(str); );
|
||||||
|
@ -287,28 +323,127 @@ RB_METHOD(bitmapTextSize)
|
||||||
return wrapObject(rect, RectType);
|
return wrapObject(rect, RectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_PROP_OBJ(Bitmap, Font, Font, "font")
|
DEF_PROP_OBJ_VAL(Bitmap, Font, Font, "font")
|
||||||
|
|
||||||
// FIXME: This isn't entire correct as the cloned bitmap
|
RB_METHOD(bitmapGradientFillRect)
|
||||||
// does not get a cloned version of the original bitmap's 'font'
|
{
|
||||||
// attribute (the internal font attrb is the default one, whereas
|
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||||
// the stored iv visible to ruby would still be the same as the original)
|
|
||||||
// Not sure if this needs fixing though
|
VALUE color1Obj, color2Obj;
|
||||||
INITCOPY_FUN(Bitmap)
|
Color *color1, *color2;
|
||||||
|
bool vertical = false;
|
||||||
|
|
||||||
|
if (argc == 3 || argc == 4)
|
||||||
|
{
|
||||||
|
VALUE rectObj;
|
||||||
|
Rect *rect;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "ooo|b", &rectObj,
|
||||||
|
&color1Obj, &color2Obj, &vertical RB_ARG_END);
|
||||||
|
|
||||||
|
rect = getPrivateDataCheck<Rect>(rectObj, RectType);
|
||||||
|
color1 = getPrivateDataCheck<Color>(color1Obj, ColorType);
|
||||||
|
color2 = getPrivateDataCheck<Color>(color2Obj, ColorType);
|
||||||
|
|
||||||
|
GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, vertical); );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int x, y, width, height;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height,
|
||||||
|
&color1Obj, &color2Obj, &vertical RB_ARG_END);
|
||||||
|
|
||||||
|
color1 = getPrivateDataCheck<Color>(color1Obj, ColorType);
|
||||||
|
color2 = getPrivateDataCheck<Color>(color2Obj, ColorType);
|
||||||
|
|
||||||
|
GUARD_EXC( b->gradientFillRect(x, y, width, height, color1->norm, color2->norm, vertical); );
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(bitmapClearRect)
|
||||||
|
{
|
||||||
|
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
VALUE rectObj;
|
||||||
|
Rect *rect;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "o", &rectObj RB_ARG_END);
|
||||||
|
|
||||||
|
rect = getPrivateDataCheck<Rect>(rectObj, RectType);
|
||||||
|
|
||||||
|
GUARD_EXC( b->clearRect(rect->toIntRect()); );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int x, y, width, height;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "iiii", &x, &y, &width, &height RB_ARG_END);
|
||||||
|
|
||||||
|
GUARD_EXC( b->clearRect(x, y, width, height); );
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(bitmapBlur)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||||
|
|
||||||
|
b->blur();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(bitmapRadialBlur)
|
||||||
|
{
|
||||||
|
Bitmap *b = getPrivateData<Bitmap>(self);
|
||||||
|
|
||||||
|
int angle, divisions;
|
||||||
|
rb_get_args(argc, argv, "ii", &angle, &divisions RB_ARG_END);
|
||||||
|
|
||||||
|
b->radialBlur(angle, divisions);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(bitmapInitializeCopy)
|
||||||
|
{
|
||||||
|
rb_check_argc(argc, 1);
|
||||||
|
VALUE origObj = argv[0];
|
||||||
|
|
||||||
|
if (!OBJ_INIT_COPY(self, origObj))
|
||||||
|
return self;
|
||||||
|
|
||||||
|
Bitmap *orig = getPrivateData<Bitmap>(origObj);
|
||||||
|
Bitmap *b = 0;
|
||||||
|
GUARD_EXC( b = new Bitmap(*orig); );
|
||||||
|
|
||||||
|
bitmapInitProps(b, self);
|
||||||
|
b->setFont(orig->getFont());
|
||||||
|
|
||||||
|
setPrivateData(self, b);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bitmapBindingInit()
|
bitmapBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Bitmap);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Bitmap", rb_cObject);
|
VALUE klass = rb_define_class("Bitmap", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&BitmapType>);
|
rb_define_alloc_func(klass, classAllocate<&BitmapType>);
|
||||||
|
|
||||||
disposableBindingInit<Bitmap>(klass);
|
disposableBindingInit<Bitmap>(klass);
|
||||||
|
|
||||||
_rb_define_method(klass, "initialize", bitmapInitialize);
|
_rb_define_method(klass, "initialize", bitmapInitialize);
|
||||||
_rb_define_method(klass, "initialize_copy", BitmapInitializeCopy);
|
_rb_define_method(klass, "initialize_copy", bitmapInitializeCopy);
|
||||||
|
|
||||||
_rb_define_method(klass, "width", bitmapWidth);
|
_rb_define_method(klass, "width", bitmapWidth);
|
||||||
_rb_define_method(klass, "height", bitmapHeight);
|
_rb_define_method(klass, "height", bitmapHeight);
|
||||||
|
@ -323,5 +458,13 @@ bitmapBindingInit()
|
||||||
_rb_define_method(klass, "draw_text", bitmapDrawText);
|
_rb_define_method(klass, "draw_text", bitmapDrawText);
|
||||||
_rb_define_method(klass, "text_size", bitmapTextSize);
|
_rb_define_method(klass, "text_size", bitmapTextSize);
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
_rb_define_method(klass, "gradient_fill_rect", bitmapGradientFillRect);
|
||||||
|
_rb_define_method(klass, "clear_rect", bitmapClearRect);
|
||||||
|
_rb_define_method(klass, "blur", bitmapBlur);
|
||||||
|
_rb_define_method(klass, "radial_blur", bitmapRadialBlur);
|
||||||
|
}
|
||||||
|
|
||||||
INIT_PROP_BIND(Bitmap, Font, "font");
|
INIT_PROP_BIND(Bitmap, Font, "font");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -25,12 +25,54 @@
|
||||||
#include "disposable.h"
|
#include "disposable.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
|
||||||
|
/* 'Children' are disposables that are disposed together
|
||||||
|
* with their parent. Currently this is only used by Viewport
|
||||||
|
* in RGSS1. */
|
||||||
|
inline void
|
||||||
|
disposableAddChild(VALUE disp, VALUE child)
|
||||||
|
{
|
||||||
|
VALUE children = rb_iv_get(disp, "children");
|
||||||
|
|
||||||
|
if (NIL_P(children))
|
||||||
|
{
|
||||||
|
children = rb_ary_new();
|
||||||
|
rb_iv_set(disp, "children", children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Assumes children are never removed until destruction */
|
||||||
|
rb_ary_push(children, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
disposableDisposeChildren(VALUE disp)
|
||||||
|
{
|
||||||
|
VALUE children = rb_iv_get(disp, "children");
|
||||||
|
|
||||||
|
if (NIL_P(children))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ID dispFun = rb_intern("_mkxp_dispose_alias");
|
||||||
|
|
||||||
|
for (long i = 0; i < RARRAY_LEN(children); ++i)
|
||||||
|
rb_funcall2(rb_ary_entry(children, i), dispFun, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
RB_METHOD(disposableDispose)
|
RB_METHOD(disposableDispose)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
Disposable *d = getPrivateData<C>(self);
|
C *d = getPrivateData<C>(self);
|
||||||
|
|
||||||
|
if (!d)
|
||||||
|
return Qnil;
|
||||||
|
|
||||||
|
/* Nothing to do if already disposed */
|
||||||
|
if (d->isDisposed())
|
||||||
|
return Qnil;
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableDisposeChildren(self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
|
||||||
|
@ -42,7 +84,10 @@ RB_METHOD(disposableIsDisposed)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
Disposable *d = getPrivateData<C>(self);
|
C *d = getPrivateData<C>(self);
|
||||||
|
|
||||||
|
if (!d)
|
||||||
|
return Qtrue;
|
||||||
|
|
||||||
return rb_bool_new(d->isDisposed());
|
return rb_bool_new(d->isDisposed());
|
||||||
}
|
}
|
||||||
|
@ -52,14 +97,19 @@ static void disposableBindingInit(VALUE klass)
|
||||||
{
|
{
|
||||||
_rb_define_method(klass, "dispose", disposableDispose<C>);
|
_rb_define_method(klass, "dispose", disposableDispose<C>);
|
||||||
_rb_define_method(klass, "disposed?", disposableIsDisposed<C>);
|
_rb_define_method(klass, "disposed?", disposableIsDisposed<C>);
|
||||||
|
|
||||||
|
/* Make sure we always have access to the original method, even
|
||||||
|
* if it is overridden by user scripts */
|
||||||
|
if (rgssVer == 1)
|
||||||
|
rb_define_alias(klass, "_mkxp_dispose_alias", "dispose");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void checkDisposed(Disposable *d, const char *klassName)
|
template<class C>
|
||||||
|
inline void
|
||||||
|
checkDisposed(VALUE self)
|
||||||
{
|
{
|
||||||
RbData *data = getRbData(); (void) data;
|
if (disposableIsDisposed<C>(0, 0, self) == Qtrue)
|
||||||
|
raiseDisposedAccess(self);
|
||||||
if (d->isDisposed())
|
|
||||||
rb_raise(getRbData()->exc[RGSS], "disposed %s", klassName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DISPOSABLEBINDING_H
|
#endif // DISPOSABLEBINDING_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "serializable-binding.h"
|
#include "serializable-binding.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
|
|
||||||
DEF_TYPE(Color);
|
DEF_TYPE(Color);
|
||||||
DEF_TYPE(Tone);
|
DEF_TYPE(Tone);
|
||||||
|
@ -68,6 +69,9 @@ ATTR_INT_RW(Rect, Height)
|
||||||
VALUE otherObj; \
|
VALUE otherObj; \
|
||||||
Klass *other; \
|
Klass *other; \
|
||||||
rb_get_args(argc, argv, "o", &otherObj RB_ARG_END); \
|
rb_get_args(argc, argv, "o", &otherObj RB_ARG_END); \
|
||||||
|
if (rgssVer >= 3) \
|
||||||
|
if (!rb_typeddata_is_kind_of(otherObj, &Klass##Type)) \
|
||||||
|
return Qfalse; \
|
||||||
other = getPrivateDataCheck<Klass>(otherObj, Klass##Type); \
|
other = getPrivateDataCheck<Klass>(otherObj, Klass##Type); \
|
||||||
return rb_bool_new(*p == *other); \
|
return rb_bool_new(*p == *other); \
|
||||||
}
|
}
|
||||||
|
@ -79,9 +83,17 @@ EQUAL_FUN(Rect)
|
||||||
#define INIT_FUN(Klass, param_type, param_t_s, last_param_def) \
|
#define INIT_FUN(Klass, param_type, param_t_s, last_param_def) \
|
||||||
RB_METHOD(Klass##Initialize) \
|
RB_METHOD(Klass##Initialize) \
|
||||||
{ \
|
{ \
|
||||||
param_type p1, p2, p3, p4 = last_param_def; \
|
Klass *k; \
|
||||||
rb_get_args(argc, argv, param_t_s, &p1, &p2, &p3, &p4 RB_ARG_END); \
|
if (argc == 0) \
|
||||||
Klass *k = new Klass(p1, p2, p3, p4); \
|
{ \
|
||||||
|
k = new Klass(); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
param_type p1, p2, p3, p4 = last_param_def; \
|
||||||
|
rb_get_args(argc, argv, param_t_s, &p1, &p2, &p3, &p4 RB_ARG_END); \
|
||||||
|
k = new Klass(p1, p2, p3, p4); \
|
||||||
|
} \
|
||||||
setPrivateData(self, k); \
|
setPrivateData(self, k); \
|
||||||
return self; \
|
return self; \
|
||||||
}
|
}
|
||||||
|
@ -93,10 +105,19 @@ INIT_FUN(Rect, int, "iiii", 0)
|
||||||
#define SET_FUN(Klass, param_type, param_t_s, last_param_def) \
|
#define SET_FUN(Klass, param_type, param_t_s, last_param_def) \
|
||||||
RB_METHOD(Klass##Set) \
|
RB_METHOD(Klass##Set) \
|
||||||
{ \
|
{ \
|
||||||
param_type p1, p2, p3, p4 = last_param_def; \
|
|
||||||
rb_get_args(argc, argv, param_t_s, &p1, &p2, &p3, &p4 RB_ARG_END); \
|
|
||||||
Klass *k = getPrivateData<Klass>(self); \
|
Klass *k = getPrivateData<Klass>(self); \
|
||||||
k->set(p1, p2, p3, p4); \
|
if (argc == 1) \
|
||||||
|
{ \
|
||||||
|
VALUE otherObj = argv[0]; \
|
||||||
|
Klass *other = getPrivateDataCheck<Klass>(otherObj, Klass##Type); \
|
||||||
|
*k = *other; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
param_type p1, p2, p3, p4 = last_param_def; \
|
||||||
|
rb_get_args(argc, argv, param_t_s, &p1, &p2, &p3, &p4 RB_ARG_END); \
|
||||||
|
k->set(p1, p2, p3, p4); \
|
||||||
|
} \
|
||||||
return self; \
|
return self; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +173,6 @@ INITCOPY_FUN(Rect)
|
||||||
|
|
||||||
#define INIT_BIND(Klass) \
|
#define INIT_BIND(Klass) \
|
||||||
{ \
|
{ \
|
||||||
INIT_TYPE(Klass); \
|
|
||||||
klass = rb_define_class(#Klass, rb_cObject); \
|
klass = rb_define_class(#Klass, rb_cObject); \
|
||||||
rb_define_alloc_func(klass, classAllocate<&Klass##Type>); \
|
rb_define_alloc_func(klass, classAllocate<&Klass##Type>); \
|
||||||
rb_define_class_method(klass, "_load", Klass##Load); \
|
rb_define_class_method(klass, "_load", Klass##Load); \
|
||||||
|
@ -161,6 +181,8 @@ INITCOPY_FUN(Rect)
|
||||||
_rb_define_method(klass, "initialize_copy", Klass##InitializeCopy); \
|
_rb_define_method(klass, "initialize_copy", Klass##InitializeCopy); \
|
||||||
_rb_define_method(klass, "set", Klass##Set); \
|
_rb_define_method(klass, "set", Klass##Set); \
|
||||||
_rb_define_method(klass, "==", Klass##Equal); \
|
_rb_define_method(klass, "==", Klass##Equal); \
|
||||||
|
_rb_define_method(klass, "===", Klass##Equal); \
|
||||||
|
_rb_define_method(klass, "eql?", Klass##Equal); \
|
||||||
_rb_define_method(klass, "to_s", Klass##Stringify); \
|
_rb_define_method(klass, "to_s", Klass##Stringify); \
|
||||||
_rb_define_method(klass, "inspect", Klass##Stringify); \
|
_rb_define_method(klass, "inspect", Klass##Stringify); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -28,13 +28,35 @@
|
||||||
#include "ruby/encoding.h"
|
#include "ruby/encoding.h"
|
||||||
#include "ruby/intern.h"
|
#include "ruby/intern.h"
|
||||||
|
|
||||||
DEF_TYPE(FileInt);
|
static void
|
||||||
|
fileIntFreeInstance(void *inst)
|
||||||
|
{
|
||||||
|
SDL_RWops *ops = static_cast<SDL_RWops*>(inst);
|
||||||
|
|
||||||
|
SDL_RWclose(ops);
|
||||||
|
SDL_FreeRW(ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
fileIntForPath(const char *path)
|
fileIntForPath(const char *path, bool rubyExc)
|
||||||
{
|
{
|
||||||
SDL_RWops *ops = SDL_AllocRW();
|
SDL_RWops *ops = SDL_AllocRW();
|
||||||
shState->fileSystem().openRead(*ops, path);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
shState->fileSystem().openReadRaw(*ops, path);
|
||||||
|
}
|
||||||
|
catch (const Exception &e)
|
||||||
|
{
|
||||||
|
SDL_FreeRW(ops);
|
||||||
|
|
||||||
|
if (rubyExc)
|
||||||
|
raiseRbExc(e);
|
||||||
|
else
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));
|
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));
|
||||||
|
|
||||||
|
@ -100,21 +122,12 @@ RB_METHOD(fileIntBinmode)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
fileIntFreeInstance(void *inst)
|
|
||||||
{
|
|
||||||
SDL_RWops *ops = static_cast<SDL_RWops*>(inst);
|
|
||||||
|
|
||||||
SDL_RWclose(ops);
|
|
||||||
SDL_FreeRW(ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
kernelLoadDataInt(const char *filename)
|
kernelLoadDataInt(const char *filename, bool rubyExc)
|
||||||
{
|
{
|
||||||
rb_gc_start();
|
rb_gc_start();
|
||||||
|
|
||||||
VALUE port = fileIntForPath(filename);
|
VALUE port = fileIntForPath(filename, rubyExc);
|
||||||
|
|
||||||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||||
|
|
||||||
|
@ -133,7 +146,7 @@ RB_METHOD(kernelLoadData)
|
||||||
const char *filename;
|
const char *filename;
|
||||||
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
||||||
|
|
||||||
return kernelLoadDataInt(filename);
|
return kernelLoadDataInt(filename, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(kernelSaveData)
|
RB_METHOD(kernelSaveData)
|
||||||
|
@ -159,7 +172,7 @@ RB_METHOD(kernelSaveData)
|
||||||
|
|
||||||
static VALUE stringForceUTF8(VALUE arg)
|
static VALUE stringForceUTF8(VALUE arg)
|
||||||
{
|
{
|
||||||
if (rb_type(arg) == RUBY_T_STRING && ENCODING_IS_ASCII8BIT(arg))
|
if (RB_TYPE_P(arg, RUBY_T_STRING) && ENCODING_IS_ASCII8BIT(arg))
|
||||||
rb_enc_associate_index(arg, rb_utf8_encindex());
|
rb_enc_associate_index(arg, rb_utf8_encindex());
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
|
@ -196,8 +209,6 @@ RB_METHOD(_marshalLoad)
|
||||||
void
|
void
|
||||||
fileIntBindingInit()
|
fileIntBindingInit()
|
||||||
{
|
{
|
||||||
initType(FileIntType, "FileInt", fileIntFreeInstance);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("FileInt", rb_cIO);
|
VALUE klass = rb_define_class("FileInt", rb_cIO);
|
||||||
rb_define_alloc_func(klass, classAllocate<&FileIntType>);
|
rb_define_alloc_func(klass, classAllocate<&FileIntType>);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -38,7 +38,7 @@ RB_METHOD(flashableFlash)
|
||||||
|
|
||||||
rb_get_args(argc, argv, "oi", &colorObj, &duration RB_ARG_END);
|
rb_get_args(argc, argv, "oi", &colorObj, &duration RB_ARG_END);
|
||||||
|
|
||||||
if (NIL_P(rb_type(colorObj)))
|
if (NIL_P(colorObj))
|
||||||
{
|
{
|
||||||
f->flash(0, duration);
|
f->flash(0, duration);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,32 @@
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
collectStrings(VALUE obj, std::vector<std::string> &out)
|
||||||
|
{
|
||||||
|
if (RB_TYPE_P(obj, RUBY_T_STRING))
|
||||||
|
{
|
||||||
|
out.push_back(RSTRING_PTR(obj));
|
||||||
|
}
|
||||||
|
else if (RB_TYPE_P(obj, RUBY_T_ARRAY))
|
||||||
|
{
|
||||||
|
for (long i = 0; i < RARRAY_LEN(obj); ++i)
|
||||||
|
{
|
||||||
|
VALUE str = rb_ary_entry(obj, i);
|
||||||
|
|
||||||
|
/* Non-string objects are tolerated (ignored) */
|
||||||
|
if (!RB_TYPE_P(str, RUBY_T_STRING))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
out.push_back(RSTRING_PTR(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEF_TYPE(Font);
|
DEF_TYPE(Font);
|
||||||
|
|
||||||
|
@ -30,26 +56,55 @@ RB_METHOD(fontDoesExist)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
const char *name;
|
const char *name = 0;
|
||||||
rb_get_args(argc, argv, "z", &name RB_ARG_END);
|
VALUE nameObj;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "o", &nameObj RB_ARG_END);
|
||||||
|
|
||||||
|
if (RB_TYPE_P(nameObj, RUBY_T_STRING))
|
||||||
|
name = rb_string_value_cstr(&nameObj);
|
||||||
|
|
||||||
return rb_bool_new(Font::doesExist(name));
|
return rb_bool_new(Font::doesExist(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_METHOD(FontSetName);
|
||||||
|
|
||||||
RB_METHOD(fontInitialize)
|
RB_METHOD(fontInitialize)
|
||||||
{
|
{
|
||||||
const char *name = 0;
|
VALUE namesObj = Qnil;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
rb_get_args(argc, argv, "|zi", &name, &size RB_ARG_END);
|
rb_get_args(argc, argv, "|oi", &namesObj, &size RB_ARG_END);
|
||||||
|
|
||||||
Font *f = new Font(name, size);
|
Font *f;
|
||||||
|
|
||||||
|
if (NIL_P(namesObj))
|
||||||
|
{
|
||||||
|
namesObj = rb_iv_get(rb_obj_class(self), "default_name");
|
||||||
|
f = new Font(0, size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::vector<std::string> names;
|
||||||
|
collectStrings(namesObj, names);
|
||||||
|
|
||||||
|
f = new Font(&names, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is semantically wrong; the new Font object should take
|
||||||
|
* a dup'ed object here in case of an array. Ditto for the setters.
|
||||||
|
* However the same bug/behavior exists in all RM versions. */
|
||||||
|
rb_iv_set(self, "name", namesObj);
|
||||||
|
|
||||||
setPrivateData(self, f);
|
setPrivateData(self, f);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->setColor(new Color(*f->getColor()));
|
f->initDynAttribs();
|
||||||
wrapProperty(self, f->getColor(), "color", ColorType);
|
|
||||||
|
wrapProperty(self, &f->getColor(), "color", ColorType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(self, &f->getOutColor(), "out_color", ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +122,12 @@ RB_METHOD(fontInitializeCopy)
|
||||||
setPrivateData(self, f);
|
setPrivateData(self, f);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->setColor(new Color(*f->getColor()));
|
f->initDynAttribs();
|
||||||
wrapProperty(self, f->getColor(), "color", ColorType);
|
|
||||||
|
wrapProperty(self, &f->getColor(), "color", ColorType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(self, &f->getOutColor(), "out_color", ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -77,30 +136,36 @@ RB_METHOD(FontGetName)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
Font *f = getPrivateData<Font>(self);
|
return rb_iv_get(self, "name");
|
||||||
|
|
||||||
return rb_str_new_cstr(f->getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(FontSetName)
|
RB_METHOD(FontSetName)
|
||||||
{
|
{
|
||||||
Font *f = getPrivateData<Font>(self);
|
Font *f = getPrivateData<Font>(self);
|
||||||
|
|
||||||
VALUE name;
|
rb_check_argc(argc, 1);
|
||||||
rb_get_args(argc, argv, "S", &name RB_ARG_END);
|
|
||||||
|
|
||||||
f->setName(RSTRING_PTR(name));
|
std::vector<std::string> namesObj;
|
||||||
|
collectStrings(argv[0], namesObj);
|
||||||
|
|
||||||
return name;
|
f->setName(namesObj);
|
||||||
|
rb_iv_set(self, "name", argv[0]);
|
||||||
|
|
||||||
|
return argv[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DEF_PROP_CHK_DISP
|
template<class C>
|
||||||
#define DEF_PROP_CHK_DISP
|
static void checkDisposed(VALUE) {}
|
||||||
|
|
||||||
|
DEF_PROP_OBJ_VAL(Font, Color, Color, "color")
|
||||||
|
DEF_PROP_OBJ_VAL(Font, Color, OutColor, "out_color")
|
||||||
|
|
||||||
DEF_PROP_I(Font, Size)
|
DEF_PROP_I(Font, Size)
|
||||||
|
|
||||||
DEF_PROP_B(Font, Bold)
|
DEF_PROP_B(Font, Bold)
|
||||||
DEF_PROP_B(Font, Italic)
|
DEF_PROP_B(Font, Italic)
|
||||||
DEF_PROP_OBJ(Font, Color, Color, "color")
|
DEF_PROP_B(Font, Shadow)
|
||||||
|
DEF_PROP_B(Font, Outline)
|
||||||
|
|
||||||
#define DEF_KLASS_PROP(Klass, type, PropName, param_t_s, value_fun) \
|
#define DEF_KLASS_PROP(Klass, type, PropName, param_t_s, value_fun) \
|
||||||
RB_METHOD(Klass##Get##PropName) \
|
RB_METHOD(Klass##Get##PropName) \
|
||||||
|
@ -117,25 +182,52 @@ DEF_PROP_OBJ(Font, Color, Color, "color")
|
||||||
return value_fun(value); \
|
return value_fun(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_KLASS_PROP(Font, int, DefaultSize, "i", rb_fix_new)
|
DEF_KLASS_PROP(Font, int, DefaultSize, "i", rb_fix_new)
|
||||||
DEF_KLASS_PROP(Font, bool, DefaultBold, "b", rb_bool_new)
|
DEF_KLASS_PROP(Font, bool, DefaultBold, "b", rb_bool_new)
|
||||||
DEF_KLASS_PROP(Font, bool, DefaultItalic, "b", rb_bool_new)
|
DEF_KLASS_PROP(Font, bool, DefaultItalic, "b", rb_bool_new)
|
||||||
|
DEF_KLASS_PROP(Font, bool, DefaultShadow, "b", rb_bool_new)
|
||||||
|
DEF_KLASS_PROP(Font, bool, DefaultOutline, "b", rb_bool_new)
|
||||||
|
|
||||||
|
RB_METHOD(FontGetDefaultOutColor)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
return rb_iv_get(self, "default_out_color");
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(FontSetDefaultOutColor)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
VALUE colorObj;
|
||||||
|
rb_get_args(argc, argv, "o", &colorObj RB_ARG_END);
|
||||||
|
|
||||||
|
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
||||||
|
|
||||||
|
Font::setDefaultOutColor(*c);
|
||||||
|
|
||||||
|
return colorObj;
|
||||||
|
}
|
||||||
|
|
||||||
RB_METHOD(FontGetDefaultName)
|
RB_METHOD(FontGetDefaultName)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
return rb_str_new_cstr(Font::getDefaultName());
|
|
||||||
|
return rb_iv_get(self, "default_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(FontSetDefaultName)
|
RB_METHOD(FontSetDefaultName)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
VALUE nameObj;
|
|
||||||
rb_get_args(argc, argv, "S", &nameObj RB_ARG_END);
|
|
||||||
|
|
||||||
Font::setDefaultName(RSTRING_PTR(nameObj));
|
rb_check_argc(argc, 1);
|
||||||
|
|
||||||
return nameObj;
|
std::vector<std::string> namesObj;
|
||||||
|
collectStrings(argv[0], namesObj);
|
||||||
|
|
||||||
|
Font::setDefaultName(namesObj, shState->fontState());
|
||||||
|
rb_iv_set(self, "default_name", argv[0]);
|
||||||
|
|
||||||
|
return argv[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(FontGetDefaultColor)
|
RB_METHOD(FontGetDefaultColor)
|
||||||
|
@ -147,13 +239,14 @@ RB_METHOD(FontGetDefaultColor)
|
||||||
|
|
||||||
RB_METHOD(FontSetDefaultColor)
|
RB_METHOD(FontSetDefaultColor)
|
||||||
{
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
VALUE colorObj;
|
VALUE colorObj;
|
||||||
rb_get_args(argc, argv, "o", &colorObj RB_ARG_END);
|
rb_get_args(argc, argv, "o", &colorObj RB_ARG_END);
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultColor(c);
|
Font::setDefaultColor(*c);
|
||||||
rb_iv_set(self, "default_color", colorObj);
|
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -167,13 +260,32 @@ RB_METHOD(FontSetDefaultColor)
|
||||||
void
|
void
|
||||||
fontBindingInit()
|
fontBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Font);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Font", rb_cObject);
|
VALUE klass = rb_define_class("Font", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&FontType>);
|
rb_define_alloc_func(klass, classAllocate<&FontType>);
|
||||||
|
|
||||||
Font::setDefaultColor(new Color(*Font::getDefaultColor()));
|
Font::initDefaultDynAttribs();
|
||||||
wrapProperty(klass, Font::getDefaultColor(), "default_color", ColorType);
|
wrapProperty(klass, &Font::getDefaultColor(), "default_color", ColorType);
|
||||||
|
|
||||||
|
/* Initialize default names */
|
||||||
|
const std::vector<std::string> &defNames = Font::getInitialDefaultNames();
|
||||||
|
VALUE defNamesObj;
|
||||||
|
|
||||||
|
if (defNames.size() == 1)
|
||||||
|
{
|
||||||
|
defNamesObj = rb_str_new_cstr(defNames[0].c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defNamesObj = rb_ary_new2(defNames.size());
|
||||||
|
|
||||||
|
for (size_t i = 0; i < defNames.size(); ++i)
|
||||||
|
rb_ary_push(defNamesObj, rb_str_new_cstr(defNames[i].c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
rb_iv_set(klass, "default_name", defNamesObj);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(klass, &Font::getDefaultOutColor(), "default_out_color", ColorType);
|
||||||
|
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
||||||
|
@ -181,6 +293,17 @@ fontBindingInit()
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic");
|
INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color");
|
INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color");
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
INIT_KLASS_PROP_BIND(Font, DefaultShadow, "default_shadow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline");
|
||||||
|
INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color");
|
||||||
|
}
|
||||||
|
|
||||||
rb_define_class_method(klass, "exist?", fontDoesExist);
|
rb_define_class_method(klass, "exist?", fontDoesExist);
|
||||||
|
|
||||||
_rb_define_method(klass, "initialize", fontInitialize);
|
_rb_define_method(klass, "initialize", fontInitialize);
|
||||||
|
@ -191,4 +314,15 @@ fontBindingInit()
|
||||||
INIT_PROP_BIND(Font, Bold, "bold");
|
INIT_PROP_BIND(Font, Bold, "bold");
|
||||||
INIT_PROP_BIND(Font, Italic, "italic");
|
INIT_PROP_BIND(Font, Italic, "italic");
|
||||||
INIT_PROP_BIND(Font, Color, "color");
|
INIT_PROP_BIND(Font, Color, "color");
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND(Font, Shadow, "shadow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND(Font, Outline, "outline");
|
||||||
|
INIT_PROP_BIND(Font, OutColor, "out_color");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
#include "binding-types.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
RB_METHOD(graphicsUpdate)
|
RB_METHOD(graphicsUpdate)
|
||||||
|
@ -47,7 +48,7 @@ RB_METHOD(graphicsTransition)
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
int duration = 8;
|
int duration = 8;
|
||||||
const char *filename = 0;
|
const char *filename = "";
|
||||||
int vague = 40;
|
int vague = 40;
|
||||||
|
|
||||||
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);
|
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);
|
||||||
|
@ -96,8 +97,107 @@ RB_METHOD(graphicsFrameReset)
|
||||||
return rb_bool_new(value); \
|
return rb_bool_new(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsWidth)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
return rb_fix_new(shState->graphics().width());
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsHeight)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
return rb_fix_new(shState->graphics().height());
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsWait)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
int duration;
|
||||||
|
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
|
||||||
|
|
||||||
|
shState->graphics().wait(duration);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsFadeout)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
int duration;
|
||||||
|
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
|
||||||
|
|
||||||
|
shState->graphics().fadeout(duration);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsFadein)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
int duration;
|
||||||
|
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
|
||||||
|
|
||||||
|
shState->graphics().fadein(duration);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bitmapInitProps(Bitmap *b, VALUE self);
|
||||||
|
|
||||||
|
RB_METHOD(graphicsSnapToBitmap)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
Bitmap *result = 0;
|
||||||
|
GUARD_EXC( result = shState->graphics().snapToBitmap(); );
|
||||||
|
|
||||||
|
VALUE obj = wrapObject(result, BitmapType);
|
||||||
|
bitmapInitProps(result, obj);
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsResizeScreen)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END);
|
||||||
|
|
||||||
|
shState->graphics().resizeScreen(width, height);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsReset)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
shState->graphics().reset();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(graphicsPlayMovie)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
const char *filename;
|
||||||
|
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
|
||||||
|
|
||||||
|
shState->graphics().playMovie(filename);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_GRA_PROP_I(FrameRate)
|
DEF_GRA_PROP_I(FrameRate)
|
||||||
DEF_GRA_PROP_I(FrameCount)
|
DEF_GRA_PROP_I(FrameCount)
|
||||||
|
DEF_GRA_PROP_I(Brightness)
|
||||||
|
|
||||||
DEF_GRA_PROP_B(Fullscreen)
|
DEF_GRA_PROP_B(Fullscreen)
|
||||||
DEF_GRA_PROP_B(ShowCursor)
|
DEF_GRA_PROP_B(ShowCursor)
|
||||||
|
@ -117,9 +217,29 @@ void graphicsBindingInit()
|
||||||
_rb_define_module_function(module, "transition", graphicsTransition);
|
_rb_define_module_function(module, "transition", graphicsTransition);
|
||||||
_rb_define_module_function(module, "frame_reset", graphicsFrameReset);
|
_rb_define_module_function(module, "frame_reset", graphicsFrameReset);
|
||||||
|
|
||||||
|
_rb_define_module_function(module, "__reset__", graphicsReset);
|
||||||
|
|
||||||
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
|
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
|
||||||
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
|
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
_rb_define_module_function(module, "width", graphicsWidth);
|
||||||
|
_rb_define_module_function(module, "height", graphicsHeight);
|
||||||
|
_rb_define_module_function(module, "wait", graphicsWait);
|
||||||
|
_rb_define_module_function(module, "fadeout", graphicsFadeout);
|
||||||
|
_rb_define_module_function(module, "fadein", graphicsFadein);
|
||||||
|
_rb_define_module_function(module, "snap_to_bitmap", graphicsSnapToBitmap);
|
||||||
|
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen);
|
||||||
|
|
||||||
|
INIT_GRA_PROP_BIND( Brightness, "brightness" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
|
||||||
|
}
|
||||||
|
|
||||||
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
|
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
|
||||||
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
|
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
RB_METHOD(inputUpdate)
|
RB_METHOD(inputUpdate)
|
||||||
{
|
{
|
||||||
|
@ -33,40 +34,56 @@ RB_METHOD(inputUpdate)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int getButtonArg(int argc, VALUE *argv)
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
|
||||||
|
rb_check_argc(argc, 1);
|
||||||
|
|
||||||
|
if (FIXNUM_P(argv[0]))
|
||||||
|
{
|
||||||
|
num = FIX2INT(argv[0]);
|
||||||
|
}
|
||||||
|
else if (SYMBOL_P(argv[0]) && rgssVer >= 3)
|
||||||
|
{
|
||||||
|
VALUE symHash = getRbData()->buttoncodeHash;
|
||||||
|
num = FIX2INT(rb_hash_lookup2(symHash, argv[0], INT2FIX(Input::None)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: RMXP allows only few more types that
|
||||||
|
// don't make sense (symbols in pre 3, floats)
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
RB_METHOD(inputPress)
|
RB_METHOD(inputPress)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
int num;
|
int num = getButtonArg(argc, argv);
|
||||||
rb_get_args(argc, argv, "i", &num RB_ARG_END);
|
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
return rb_bool_new(shState->input().isPressed(num));
|
||||||
|
|
||||||
return rb_bool_new(shState->input().isPressed(bc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(inputTrigger)
|
RB_METHOD(inputTrigger)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
int num;
|
int num = getButtonArg(argc, argv);
|
||||||
rb_get_args(argc, argv, "i", &num RB_ARG_END);
|
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
return rb_bool_new(shState->input().isTriggered(num));
|
||||||
|
|
||||||
return rb_bool_new(shState->input().isTriggered(bc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(inputRepeat)
|
RB_METHOD(inputRepeat)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
int num;
|
int num = getButtonArg(argc, argv);
|
||||||
rb_get_args(argc, argv, "i", &num RB_ARG_END);
|
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
return rb_bool_new(shState->input().isRepeated(num));
|
||||||
|
|
||||||
return rb_bool_new(shState->input().isRepeated(bc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(inputDir4)
|
RB_METHOD(inputDir4)
|
||||||
|
@ -98,8 +115,44 @@ RB_METHOD(inputMouseY)
|
||||||
return rb_fix_new(shState->input().mouseY());
|
return rb_fix_new(shState->input().mouseY());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_CONST_I(name, value) \
|
|
||||||
rb_const_set(module, rb_intern(name), rb_fix_new(value))
|
struct
|
||||||
|
{
|
||||||
|
const char *str;
|
||||||
|
Input::ButtonCode val;
|
||||||
|
}
|
||||||
|
static buttonCodes[] =
|
||||||
|
{
|
||||||
|
{ "DOWN", Input::Down },
|
||||||
|
{ "LEFT", Input::Left },
|
||||||
|
{ "RIGHT", Input::Right },
|
||||||
|
{ "UP", Input::Up },
|
||||||
|
|
||||||
|
{ "A", Input::A },
|
||||||
|
{ "B", Input::B },
|
||||||
|
{ "C", Input::C },
|
||||||
|
{ "X", Input::X },
|
||||||
|
{ "Y", Input::Y },
|
||||||
|
{ "Z", Input::Z },
|
||||||
|
{ "L", Input::L },
|
||||||
|
{ "R", Input::R },
|
||||||
|
|
||||||
|
{ "SHIFT", Input::Shift },
|
||||||
|
{ "CTRL", Input::Ctrl },
|
||||||
|
{ "ALT", Input::Alt },
|
||||||
|
|
||||||
|
{ "F5", Input::F5 },
|
||||||
|
{ "F6", Input::F6 },
|
||||||
|
{ "F7", Input::F7 },
|
||||||
|
{ "F8", Input::F8 },
|
||||||
|
{ "F9", Input::F9 },
|
||||||
|
|
||||||
|
{ "MOUSELEFT", Input::MouseLeft },
|
||||||
|
{ "MOUSEMIDDLE", Input::MouseMiddle },
|
||||||
|
{ "MOUSERIGHT", Input::MouseRight }
|
||||||
|
};
|
||||||
|
|
||||||
|
static elementsN(buttonCodes);
|
||||||
|
|
||||||
void
|
void
|
||||||
inputBindingInit()
|
inputBindingInit()
|
||||||
|
@ -113,34 +166,35 @@ inputBindingInit()
|
||||||
_rb_define_module_function(module, "dir4", inputDir4);
|
_rb_define_module_function(module, "dir4", inputDir4);
|
||||||
_rb_define_module_function(module, "dir8", inputDir8);
|
_rb_define_module_function(module, "dir8", inputDir8);
|
||||||
|
|
||||||
DEF_CONST_I("DOWN", Input::Down );
|
|
||||||
DEF_CONST_I("LEFT", Input::Left );
|
|
||||||
DEF_CONST_I("RIGHT", Input::Right);
|
|
||||||
DEF_CONST_I("UP", Input::Up );
|
|
||||||
|
|
||||||
DEF_CONST_I("A", Input::A );
|
|
||||||
DEF_CONST_I("B", Input::B );
|
|
||||||
DEF_CONST_I("C", Input::C );
|
|
||||||
DEF_CONST_I("X", Input::X );
|
|
||||||
DEF_CONST_I("Y", Input::Y );
|
|
||||||
DEF_CONST_I("Z", Input::Z );
|
|
||||||
DEF_CONST_I("L", Input::L );
|
|
||||||
DEF_CONST_I("R", Input::R );
|
|
||||||
|
|
||||||
DEF_CONST_I("SHIFT", Input::Shift);
|
|
||||||
DEF_CONST_I("CTRL", Input::Ctrl );
|
|
||||||
DEF_CONST_I("ALT", Input::Alt );
|
|
||||||
|
|
||||||
DEF_CONST_I("F5", Input::F5 );
|
|
||||||
DEF_CONST_I("F6", Input::F6 );
|
|
||||||
DEF_CONST_I("F7", Input::F7 );
|
|
||||||
DEF_CONST_I("F8", Input::F8 );
|
|
||||||
DEF_CONST_I("F9", Input::F9 );
|
|
||||||
|
|
||||||
_rb_define_module_function(module, "mouse_x", inputMouseX);
|
_rb_define_module_function(module, "mouse_x", inputMouseX);
|
||||||
_rb_define_module_function(module, "mouse_y", inputMouseY);
|
_rb_define_module_function(module, "mouse_y", inputMouseY);
|
||||||
|
|
||||||
DEF_CONST_I("MOUSELEFT", Input::MouseLeft );
|
if (rgssVer >= 3)
|
||||||
DEF_CONST_I("MOUSEMIDDLE", Input::MouseMiddle);
|
{
|
||||||
DEF_CONST_I("MOUSERIGHT", Input::MouseRight );
|
VALUE symHash = rb_hash_new();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||||
|
{
|
||||||
|
ID sym = rb_intern(buttonCodes[i].str);
|
||||||
|
VALUE val = INT2FIX(buttonCodes[i].val);
|
||||||
|
|
||||||
|
/* In RGSS3 all Input::XYZ constants are equal to :XYZ symbols,
|
||||||
|
* to be compatible with the previous convention */
|
||||||
|
rb_const_set(module, sym, ID2SYM(sym));
|
||||||
|
rb_hash_aset(symHash, ID2SYM(sym), val);
|
||||||
|
}
|
||||||
|
|
||||||
|
rb_iv_set(module, "buttoncodes", symHash);
|
||||||
|
getRbData()->buttoncodeHash = symHash;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||||
|
{
|
||||||
|
ID sym = rb_intern(buttonCodes[i].str);
|
||||||
|
VALUE val = INT2FIX(buttonCodes[i].val);
|
||||||
|
|
||||||
|
rb_const_set(module, sym, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
#include "module_rpg.rb.xxd"
|
|
||||||
|
# include "module_rpg1.rb.xxd"
|
||||||
|
# include "module_rpg2.rb.xxd"
|
||||||
|
# include "module_rpg3.rb.xxd"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extern const char module_rpg[] = {
|
extern const char module_rpg1[] = {
|
||||||
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x52, 0x50, 0x47, 0x0a, 0x20, 0x20, 0x6d, 0x6f, 0x64,
|
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x52, 0x50, 0x47, 0x0a, 0x20, 0x20, 0x6d, 0x6f, 0x64,
|
||||||
0x75, 0x6c, 0x65, 0x20, 0x43, 0x61, 0x63, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x40, 0x63,
|
0x75, 0x6c, 0x65, 0x20, 0x43, 0x61, 0x63, 0x68, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x40, 0x63,
|
||||||
0x61, 0x63, 0x68, 0x65, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65,
|
0x61, 0x63, 0x68, 0x65, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65,
|
||||||
|
@ -2404,4 +2404,4 @@ extern const char module_rpg[] = {
|
||||||
0x74, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x20, 0x3a, 0x70, 0x69, 0x74,
|
0x74, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x20, 0x3a, 0x70, 0x69, 0x74,
|
||||||
0x63, 0x68, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x00
|
0x63, 0x68, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x00
|
||||||
};
|
};
|
||||||
extern const unsigned int module_rpg_len = 38461;
|
extern const unsigned int module_rpg1_len = 38461;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -33,21 +33,17 @@ RB_METHOD(planeInitialize)
|
||||||
|
|
||||||
setPrivateData(self, p);
|
setPrivateData(self, p);
|
||||||
|
|
||||||
p->setColor(new Color);
|
p->initDynAttribs();
|
||||||
p->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapNilProperty(self, "bitmap");
|
wrapProperty(self, &p->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, p->getColor(), "color", ColorType);
|
wrapProperty(self, &p->getTone(), "tone", ToneType);
|
||||||
wrapProperty(self, p->getTone(), "tone", ToneType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "plane"
|
DEF_PROP_OBJ_REF(Plane, Bitmap, Bitmap, "bitmap")
|
||||||
|
DEF_PROP_OBJ_VAL(Plane, Color, Color, "color")
|
||||||
DEF_PROP_OBJ_NIL(Plane, Bitmap, Bitmap, "bitmap")
|
DEF_PROP_OBJ_VAL(Plane, Tone, Tone, "tone")
|
||||||
DEF_PROP_OBJ(Plane, Color, Color, "color")
|
|
||||||
DEF_PROP_OBJ(Plane, Tone, Tone, "tone")
|
|
||||||
|
|
||||||
DEF_PROP_I(Plane, OX)
|
DEF_PROP_I(Plane, OX)
|
||||||
DEF_PROP_I(Plane, OY)
|
DEF_PROP_I(Plane, OY)
|
||||||
|
@ -61,8 +57,6 @@ DEF_PROP_F(Plane, ZoomY)
|
||||||
void
|
void
|
||||||
planeBindingInit()
|
planeBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Plane);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Plane", rb_cObject);
|
VALUE klass = rb_define_class("Plane", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&PlaneType>);
|
rb_define_alloc_func(klass, classAllocate<&PlaneType>);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
#include "flashable-binding.h"
|
#include "flashable-binding.h"
|
||||||
#include "sceneelement-binding.h"
|
#include "sceneelement-binding.h"
|
||||||
|
@ -36,44 +37,66 @@ RB_METHOD(spriteInitialize)
|
||||||
setPrivateData(self, s);
|
setPrivateData(self, s);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
s->setSrcRect(new Rect);
|
s->initDynAttribs();
|
||||||
s->setColor(new Color);
|
|
||||||
s->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapNilProperty(self, "bitmap");
|
wrapProperty(self, &s->getSrcRect(), "src_rect", RectType);
|
||||||
wrapProperty(self, s->getSrcRect(), "src_rect", RectType);
|
wrapProperty(self, &s->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, s->getColor(), "color", ColorType);
|
wrapProperty(self, &s->getTone(), "tone", ToneType);
|
||||||
wrapProperty(self, s->getTone(), "tone", ToneType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "sprite"
|
DEF_PROP_OBJ_REF(Sprite, Bitmap, Bitmap, "bitmap")
|
||||||
|
DEF_PROP_OBJ_VAL(Sprite, Rect, SrcRect, "src_rect")
|
||||||
DEF_PROP_OBJ_NIL(Sprite, Bitmap, Bitmap, "bitmap")
|
DEF_PROP_OBJ_VAL(Sprite, Color, Color, "color")
|
||||||
DEF_PROP_OBJ(Sprite, Rect, SrcRect, "src_rect")
|
DEF_PROP_OBJ_VAL(Sprite, Tone, Tone, "tone")
|
||||||
DEF_PROP_OBJ(Sprite, Color, Color, "color")
|
|
||||||
DEF_PROP_OBJ(Sprite, Tone, Tone, "tone")
|
|
||||||
|
|
||||||
DEF_PROP_I(Sprite, X)
|
DEF_PROP_I(Sprite, X)
|
||||||
DEF_PROP_I(Sprite, Y)
|
DEF_PROP_I(Sprite, Y)
|
||||||
DEF_PROP_I(Sprite, OX)
|
DEF_PROP_I(Sprite, OX)
|
||||||
DEF_PROP_I(Sprite, OY)
|
DEF_PROP_I(Sprite, OY)
|
||||||
DEF_PROP_I(Sprite, BushDepth)
|
DEF_PROP_I(Sprite, BushDepth)
|
||||||
|
DEF_PROP_I(Sprite, BushOpacity)
|
||||||
DEF_PROP_I(Sprite, Opacity)
|
DEF_PROP_I(Sprite, Opacity)
|
||||||
DEF_PROP_I(Sprite, BlendType)
|
DEF_PROP_I(Sprite, BlendType)
|
||||||
|
DEF_PROP_I(Sprite, WaveAmp)
|
||||||
|
DEF_PROP_I(Sprite, WaveLength)
|
||||||
|
DEF_PROP_I(Sprite, WaveSpeed)
|
||||||
|
|
||||||
DEF_PROP_F(Sprite, ZoomX)
|
DEF_PROP_F(Sprite, ZoomX)
|
||||||
DEF_PROP_F(Sprite, ZoomY)
|
DEF_PROP_F(Sprite, ZoomY)
|
||||||
DEF_PROP_F(Sprite, Angle)
|
DEF_PROP_F(Sprite, Angle)
|
||||||
|
DEF_PROP_F(Sprite, WavePhase)
|
||||||
|
|
||||||
DEF_PROP_B(Sprite, Mirror)
|
DEF_PROP_B(Sprite, Mirror)
|
||||||
|
|
||||||
|
RB_METHOD(spriteWidth)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
Sprite *s = getPrivateData<Sprite>(self);
|
||||||
|
|
||||||
|
int value = 0;
|
||||||
|
GUARD_EXC( value = s->getWidth(); )
|
||||||
|
|
||||||
|
return rb_fix_new(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(spriteHeight)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
Sprite *s = getPrivateData<Sprite>(self);
|
||||||
|
|
||||||
|
int value = 0;
|
||||||
|
GUARD_EXC( value = s->getHeight(); )
|
||||||
|
|
||||||
|
return rb_fix_new(value);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spriteBindingInit()
|
spriteBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Sprite);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Sprite", rb_cObject);
|
VALUE klass = rb_define_class("Sprite", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&SpriteType>);
|
rb_define_alloc_func(klass, classAllocate<&SpriteType>);
|
||||||
|
|
||||||
|
@ -98,4 +121,17 @@ spriteBindingInit()
|
||||||
INIT_PROP_BIND( Sprite, BlendType, "blend_type" );
|
INIT_PROP_BIND( Sprite, BlendType, "blend_type" );
|
||||||
INIT_PROP_BIND( Sprite, Color, "color" );
|
INIT_PROP_BIND( Sprite, Color, "color" );
|
||||||
INIT_PROP_BIND( Sprite, Tone, "tone" );
|
INIT_PROP_BIND( Sprite, Tone, "tone" );
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
_rb_define_method(klass, "width", spriteWidth);
|
||||||
|
_rb_define_method(klass, "height", spriteHeight);
|
||||||
|
|
||||||
|
INIT_PROP_BIND( Sprite, BushOpacity, "bush_opacity" );
|
||||||
|
|
||||||
|
INIT_PROP_BIND( Sprite, WaveAmp, "wave_amp" );
|
||||||
|
INIT_PROP_BIND( Sprite, WaveLength, "wave_length" );
|
||||||
|
INIT_PROP_BIND( Sprite, WaveSpeed, "wave_speed" );
|
||||||
|
INIT_PROP_BIND( Sprite, WavePhase, "wave_phase" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,18 +19,44 @@
|
||||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "serializable-binding.h"
|
#include "serializable-binding.h"
|
||||||
|
|
||||||
|
static int num2TableSize(VALUE v)
|
||||||
|
{
|
||||||
|
int i = NUM2INT(v);
|
||||||
|
return std::max(0, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void parseArgsTableSizes(int argc, VALUE *argv, int *x, int *y, int *z)
|
||||||
|
{
|
||||||
|
*y = *z = 1;
|
||||||
|
|
||||||
|
switch (argc)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
*z = num2TableSize(argv[2]);
|
||||||
|
/* fall through */
|
||||||
|
case 2:
|
||||||
|
*y = num2TableSize(argv[1]);
|
||||||
|
/* fall through */
|
||||||
|
case 1:
|
||||||
|
*x = num2TableSize(argv[0]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rb_error_arity(argc, 1, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEF_TYPE(Table);
|
DEF_TYPE(Table);
|
||||||
|
|
||||||
RB_METHOD(tableInitialize)
|
RB_METHOD(tableInitialize)
|
||||||
{
|
{
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
x = y = z = 1;
|
|
||||||
|
|
||||||
rb_get_args(argc, argv, "i|ii", &x, &y, &z RB_ARG_END);
|
parseArgsTableSizes(argc, argv, &x, &y, &z);
|
||||||
|
|
||||||
Table *t = new Table(x, y, z);
|
Table *t = new Table(x, y, z);
|
||||||
|
|
||||||
|
@ -43,24 +69,12 @@ RB_METHOD(tableResize)
|
||||||
{
|
{
|
||||||
Table *t = getPrivateData<Table>(self);
|
Table *t = getPrivateData<Table>(self);
|
||||||
|
|
||||||
switch (argc)
|
int x, y, z;
|
||||||
{
|
parseArgsTableSizes(argc, argv, &x, &y, &z);
|
||||||
default:
|
|
||||||
case 1:
|
|
||||||
t->resize(FIX2INT(argv[0]));
|
|
||||||
return Qnil;
|
|
||||||
|
|
||||||
case 2:
|
t->resize(x, y, z);
|
||||||
t->resize(FIX2INT(argv[0]),
|
|
||||||
FIX2INT(argv[1]));
|
|
||||||
return Qnil;
|
|
||||||
|
|
||||||
case 3:
|
return Qnil;
|
||||||
t->resize(FIX2INT(argv[0]),
|
|
||||||
FIX2INT(argv[1]),
|
|
||||||
FIX2INT(argv[2]));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TABLE_SIZE(d, D) \
|
#define TABLE_SIZE(d, D) \
|
||||||
|
@ -68,7 +82,7 @@ RB_METHOD(tableResize)
|
||||||
{ \
|
{ \
|
||||||
RB_UNUSED_PARAM \
|
RB_UNUSED_PARAM \
|
||||||
Table *t = getPrivateData<Table>(self); \
|
Table *t = getPrivateData<Table>(self); \
|
||||||
return rb_int2inum(t->d##Size()); \
|
return INT2NUM(t->d##Size()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
TABLE_SIZE(x, X)
|
TABLE_SIZE(x, X)
|
||||||
|
@ -98,9 +112,9 @@ RB_METHOD(tableGetAt)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = t->get(x, y, z);
|
short result = t->get(x, y, z);
|
||||||
|
|
||||||
return rb_int2inum(result);
|
return INT2FIX(result); /* short always fits in a Fixnum */
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(tableSetAt)
|
RB_METHOD(tableSetAt)
|
||||||
|
@ -117,37 +131,36 @@ RB_METHOD(tableSetAt)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 2 :
|
case 2 :
|
||||||
x = FIX2INT(argv[0]);
|
x = NUM2INT(argv[0]);
|
||||||
value = FIX2INT(argv[1]);
|
value = NUM2INT(argv[1]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
x = FIX2INT(argv[0]);
|
x = NUM2INT(argv[0]);
|
||||||
y = FIX2INT(argv[1]);
|
y = NUM2INT(argv[1]);
|
||||||
value = FIX2INT(argv[2]);
|
value = NUM2INT(argv[2]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
x = FIX2INT(argv[0]);
|
x = NUM2INT(argv[0]);
|
||||||
y = FIX2INT(argv[1]);
|
y = NUM2INT(argv[1]);
|
||||||
z = FIX2INT(argv[2]);
|
z = NUM2INT(argv[2]);
|
||||||
value = FIX2INT(argv[3]);
|
value = NUM2INT(argv[3]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
t->set(value, x, y, z);
|
t->set(value, x, y, z);
|
||||||
|
|
||||||
return rb_int2inum(value);
|
return argv[argc - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
MARSH_LOAD_FUN(Table)
|
MARSH_LOAD_FUN(Table)
|
||||||
|
INITCOPY_FUN(Table)
|
||||||
|
|
||||||
void
|
void
|
||||||
tableBindingInit()
|
tableBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Table);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Table", rb_cObject);
|
VALUE klass = rb_define_class("Table", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&TableType>);
|
rb_define_alloc_func(klass, classAllocate<&TableType>);
|
||||||
|
|
||||||
|
@ -156,6 +169,7 @@ tableBindingInit()
|
||||||
rb_define_class_method(klass, "_load", TableLoad);
|
rb_define_class_method(klass, "_load", TableLoad);
|
||||||
|
|
||||||
_rb_define_method(klass, "initialize", tableInitialize);
|
_rb_define_method(klass, "initialize", tableInitialize);
|
||||||
|
_rb_define_method(klass, "initialize_copy", TableInitializeCopy);
|
||||||
_rb_define_method(klass, "resize", tableResize);
|
_rb_define_method(klass, "resize", tableResize);
|
||||||
_rb_define_method(klass, "xsize", tableXSize);
|
_rb_define_method(klass, "xsize", tableXSize);
|
||||||
_rb_define_method(klass, "ysize", tableYSize);
|
_rb_define_method(klass, "ysize", tableYSize);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
|
|
||||||
rb_data_type_struct TilemapAutotilesType;
|
DEF_TYPE_CUSTOMFREE(TilemapAutotiles, RUBY_TYPED_NEVER_FREE);
|
||||||
|
|
||||||
RB_METHOD(tilemapAutotilesSet)
|
RB_METHOD(tilemapAutotilesSet)
|
||||||
{
|
{
|
||||||
|
@ -94,6 +94,10 @@ RB_METHOD(tilemapInitialize)
|
||||||
|
|
||||||
rb_iv_set(autotilesObj, "array", ary);
|
rb_iv_set(autotilesObj, "array", ary);
|
||||||
|
|
||||||
|
/* Circular reference so both objects are always
|
||||||
|
* alive at the same time */
|
||||||
|
rb_iv_set(autotilesObj, "tilemap", self);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +105,8 @@ RB_METHOD(tilemapGetAutotiles)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
checkDisposed<Tilemap>(self);
|
||||||
|
|
||||||
return rb_iv_get(self, "autotiles");
|
return rb_iv_get(self, "autotiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,23 +121,19 @@ RB_METHOD(tilemapUpdate)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "tilemap"
|
|
||||||
|
|
||||||
RB_METHOD(tilemapGetViewport)
|
RB_METHOD(tilemapGetViewport)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
Tilemap *t = getPrivateData<Tilemap>(self);
|
checkDisposed<Tilemap>(self);
|
||||||
|
|
||||||
checkDisposed(t, DISP_CLASS_NAME);
|
|
||||||
|
|
||||||
return rb_iv_get(self, "viewport");
|
return rb_iv_get(self, "viewport");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_PROP_OBJ(Tilemap, Bitmap, Tileset, "tileset")
|
DEF_PROP_OBJ_REF(Tilemap, Bitmap, Tileset, "tileset")
|
||||||
DEF_PROP_OBJ(Tilemap, Table, MapData, "map_data")
|
DEF_PROP_OBJ_REF(Tilemap, Table, MapData, "map_data")
|
||||||
DEF_PROP_OBJ(Tilemap, Table, FlashData, "flash_data")
|
DEF_PROP_OBJ_REF(Tilemap, Table, FlashData, "flash_data")
|
||||||
DEF_PROP_OBJ(Tilemap, Table, Priorities, "priorities")
|
DEF_PROP_OBJ_REF(Tilemap, Table, Priorities, "priorities")
|
||||||
|
|
||||||
DEF_PROP_B(Tilemap, Visible)
|
DEF_PROP_B(Tilemap, Visible)
|
||||||
|
|
||||||
|
@ -141,16 +143,12 @@ DEF_PROP_I(Tilemap, OY)
|
||||||
void
|
void
|
||||||
tilemapBindingInit()
|
tilemapBindingInit()
|
||||||
{
|
{
|
||||||
initType(TilemapAutotilesType, "TilemapAutotiles", 0);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("TilemapAutotiles", rb_cObject);
|
VALUE klass = rb_define_class("TilemapAutotiles", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&TilemapAutotilesType>);
|
rb_define_alloc_func(klass, classAllocate<&TilemapAutotilesType>);
|
||||||
|
|
||||||
_rb_define_method(klass, "[]=", tilemapAutotilesSet);
|
_rb_define_method(klass, "[]=", tilemapAutotilesSet);
|
||||||
_rb_define_method(klass, "[]", tilemapAutotilesGet);
|
_rb_define_method(klass, "[]", tilemapAutotilesGet);
|
||||||
|
|
||||||
INIT_TYPE(Tilemap);
|
|
||||||
|
|
||||||
klass = rb_define_class("Tilemap", rb_cObject);
|
klass = rb_define_class("Tilemap", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&TilemapType>);
|
rb_define_alloc_func(klass, classAllocate<&TilemapType>);
|
||||||
|
|
||||||
|
@ -170,4 +168,3 @@ tilemapBindingInit()
|
||||||
INIT_PROP_BIND( Tilemap, OX, "ox" );
|
INIT_PROP_BIND( Tilemap, OX, "ox" );
|
||||||
INIT_PROP_BIND( Tilemap, OY, "oy" );
|
INIT_PROP_BIND( Tilemap, OY, "oy" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
** tilemapvx-binding.cpp
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tilemapvx.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
#include "bitmap.h"
|
||||||
|
#include "table.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
|
|
||||||
|
#include "disposable-binding.h"
|
||||||
|
#include "binding-util.h"
|
||||||
|
#include "binding-types.h"
|
||||||
|
|
||||||
|
DEF_TYPE_CUSTOMNAME(TilemapVX, "Tilemap");
|
||||||
|
|
||||||
|
DEF_TYPE_CUSTOMFREE(BitmapArray, RUBY_TYPED_NEVER_FREE);
|
||||||
|
|
||||||
|
RB_METHOD(tilemapVXInitialize)
|
||||||
|
{
|
||||||
|
TilemapVX *t;
|
||||||
|
|
||||||
|
/* Get parameters */
|
||||||
|
VALUE viewportObj = Qnil;
|
||||||
|
Viewport *viewport = 0;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "|o", &viewportObj RB_ARG_END);
|
||||||
|
|
||||||
|
if (!NIL_P(viewportObj))
|
||||||
|
viewport = getPrivateDataCheck<Viewport>(viewportObj, ViewportType);
|
||||||
|
|
||||||
|
/* Construct object */
|
||||||
|
t = new TilemapVX(viewport);
|
||||||
|
|
||||||
|
setPrivateData(self, t);
|
||||||
|
|
||||||
|
rb_iv_set(self, "viewport", viewportObj);
|
||||||
|
|
||||||
|
wrapProperty(self, &t->getBitmapArray(), "bitmap_array", BitmapArrayType,
|
||||||
|
rb_const_get(rb_cObject, rb_intern("Tilemap")));
|
||||||
|
|
||||||
|
VALUE autotilesObj = rb_iv_get(self, "bitmap_array");
|
||||||
|
|
||||||
|
VALUE ary = rb_ary_new2(9);
|
||||||
|
for (int i = 0; i < 9; ++i)
|
||||||
|
rb_ary_push(ary, Qnil);
|
||||||
|
|
||||||
|
rb_iv_set(autotilesObj, "array", ary);
|
||||||
|
|
||||||
|
/* Circular reference so both objects are always
|
||||||
|
* alive at the same time */
|
||||||
|
rb_iv_set(autotilesObj, "tilemap", self);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(tilemapVXGetBitmapArray)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
checkDisposed<TilemapVX>(self);
|
||||||
|
|
||||||
|
return rb_iv_get(self, "bitmap_array");
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(tilemapVXUpdate)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
TilemapVX *t = getPrivateData<TilemapVX>(self);
|
||||||
|
|
||||||
|
t->update();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEF_PROP_OBJ_REF(TilemapVX, Viewport, Viewport, "viewport")
|
||||||
|
DEF_PROP_OBJ_REF(TilemapVX, Table, MapData, "map_data")
|
||||||
|
DEF_PROP_OBJ_REF(TilemapVX, Table, FlashData, "flash_data")
|
||||||
|
DEF_PROP_OBJ_REF(TilemapVX, Table, Flags, "flags")
|
||||||
|
|
||||||
|
DEF_PROP_B(TilemapVX, Visible)
|
||||||
|
|
||||||
|
DEF_PROP_I(TilemapVX, OX)
|
||||||
|
DEF_PROP_I(TilemapVX, OY)
|
||||||
|
|
||||||
|
RB_METHOD(tilemapVXBitmapsSet)
|
||||||
|
{
|
||||||
|
TilemapVX::BitmapArray *a = getPrivateData<TilemapVX::BitmapArray>(self);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
VALUE bitmapObj;
|
||||||
|
|
||||||
|
rb_get_args(argc, argv, "io", &i, &bitmapObj RB_ARG_END);
|
||||||
|
|
||||||
|
Bitmap *bitmap = getPrivateDataCheck<Bitmap>(bitmapObj, BitmapType);
|
||||||
|
|
||||||
|
a->set(i, bitmap);
|
||||||
|
|
||||||
|
VALUE ary = rb_iv_get(self, "array");
|
||||||
|
rb_ary_store(ary, i, bitmapObj);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(tilemapVXBitmapsGet)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
rb_get_args (argc, argv, "i", &i RB_ARG_END);
|
||||||
|
|
||||||
|
if (i < 0 || i > 8)
|
||||||
|
return Qnil;
|
||||||
|
|
||||||
|
VALUE ary = rb_iv_get(self, "array");
|
||||||
|
|
||||||
|
return rb_ary_entry(ary, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tilemapVXBindingInit()
|
||||||
|
{
|
||||||
|
VALUE klass = rb_define_class("Tilemap", rb_cObject);
|
||||||
|
rb_define_alloc_func(klass, classAllocate<&TilemapVXType>);
|
||||||
|
|
||||||
|
disposableBindingInit<TilemapVX>(klass);
|
||||||
|
|
||||||
|
_rb_define_method(klass, "initialize", tilemapVXInitialize);
|
||||||
|
_rb_define_method(klass, "bitmaps", tilemapVXGetBitmapArray);
|
||||||
|
_rb_define_method(klass, "update", tilemapVXUpdate);
|
||||||
|
|
||||||
|
INIT_PROP_BIND( TilemapVX, Viewport, "viewport" );
|
||||||
|
INIT_PROP_BIND( TilemapVX, MapData, "map_data" );
|
||||||
|
INIT_PROP_BIND( TilemapVX, FlashData, "flash_data" );
|
||||||
|
INIT_PROP_BIND( TilemapVX, Visible, "visible" );
|
||||||
|
INIT_PROP_BIND( TilemapVX, OX, "ox" );
|
||||||
|
INIT_PROP_BIND( TilemapVX, OY, "oy" );
|
||||||
|
|
||||||
|
if (rgssVer == 3)
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND( TilemapVX, Flags, "flags" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND( TilemapVX, Flags, "passages" );
|
||||||
|
}
|
||||||
|
|
||||||
|
klass = rb_define_class_under(klass, "BitmapArray", rb_cObject);
|
||||||
|
rb_define_alloc_func(klass, classAllocate<&BitmapArrayType>);
|
||||||
|
|
||||||
|
_rb_define_method(klass, "[]=", tilemapVXBitmapsSet);
|
||||||
|
_rb_define_method(klass, "[]", tilemapVXBitmapsGet);
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
#include "flashable-binding.h"
|
#include "flashable-binding.h"
|
||||||
#include "sceneelement-binding.h"
|
#include "sceneelement-binding.h"
|
||||||
|
@ -32,7 +33,11 @@ RB_METHOD(viewportInitialize)
|
||||||
{
|
{
|
||||||
Viewport *v;
|
Viewport *v;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 0 && rgssVer >= 3)
|
||||||
|
{
|
||||||
|
v = new Viewport();
|
||||||
|
}
|
||||||
|
else if (argc == 1)
|
||||||
{
|
{
|
||||||
/* The rect arg is only used to init the viewport,
|
/* The rect arg is only used to init the viewport,
|
||||||
* and does NOT replace its 'rect' property */
|
* and does NOT replace its 'rect' property */
|
||||||
|
@ -57,22 +62,23 @@ RB_METHOD(viewportInitialize)
|
||||||
setPrivateData(self, v);
|
setPrivateData(self, v);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
v->setRect(new Rect(*v->getRect()));
|
v->initDynAttribs();
|
||||||
v->setColor(new Color);
|
|
||||||
v->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapProperty(self, v->getRect(), "rect", RectType);
|
wrapProperty(self, &v->getRect(), "rect", RectType);
|
||||||
wrapProperty(self, v->getColor(), "color", ColorType);
|
wrapProperty(self, &v->getColor(), "color", ColorType);
|
||||||
wrapProperty(self, v->getTone(), "tone", ToneType);
|
wrapProperty(self, &v->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
|
/* 'elements' holds all SceneElements that become children
|
||||||
|
* of this viewport, so we can dispose them when the viewport
|
||||||
|
* is disposed */
|
||||||
|
rb_iv_set(self, "elements", rb_ary_new());
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "viewport"
|
DEF_PROP_OBJ_VAL(Viewport, Rect, Rect, "rect")
|
||||||
|
DEF_PROP_OBJ_VAL(Viewport, Color, Color, "color")
|
||||||
DEF_PROP_OBJ(Viewport, Rect, Rect, "rect")
|
DEF_PROP_OBJ_VAL(Viewport, Tone, Tone, "tone")
|
||||||
DEF_PROP_OBJ(Viewport, Color, Color, "color")
|
|
||||||
DEF_PROP_OBJ(Viewport, Tone, Tone, "tone")
|
|
||||||
|
|
||||||
DEF_PROP_I(Viewport, OX)
|
DEF_PROP_I(Viewport, OX)
|
||||||
DEF_PROP_I(Viewport, OY)
|
DEF_PROP_I(Viewport, OY)
|
||||||
|
@ -81,8 +87,6 @@ DEF_PROP_I(Viewport, OY)
|
||||||
void
|
void
|
||||||
viewportBindingInit()
|
viewportBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Viewport);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Viewport", rb_cObject);
|
VALUE klass = rb_define_class("Viewport", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&ViewportType>);
|
rb_define_alloc_func(klass, classAllocate<&ViewportType>);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,25 +23,23 @@
|
||||||
#define VIEWPORTELEMENTBINDING_H
|
#define VIEWPORTELEMENTBINDING_H
|
||||||
|
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
|
|
||||||
#include "sceneelement-binding.h"
|
#include "sceneelement-binding.h"
|
||||||
|
#include "disposable-binding.h"
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
RB_METHOD(viewportElementGetViewport)
|
RB_METHOD(viewportElementGetViewport)
|
||||||
{
|
{
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
ViewportElement *ve = getPrivateData<C>(self);
|
checkDisposed<C>(self);
|
||||||
|
|
||||||
GUARD_EXC( ve->aboutToAccess(); );
|
|
||||||
|
|
||||||
return rb_iv_get(self, "viewport");
|
return rb_iv_get(self, "viewport");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
RB_METHOD(viewportElementSetViewport)
|
RB_METHOD(viewportElementSetViewport)
|
||||||
{
|
{
|
||||||
|
@ -64,8 +62,6 @@ RB_METHOD(viewportElementSetViewport)
|
||||||
return viewportObj;
|
return viewportObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
static C *
|
static C *
|
||||||
viewportElementInitialize(int argc, VALUE *argv, VALUE self)
|
viewportElementInitialize(int argc, VALUE *argv, VALUE self)
|
||||||
|
@ -77,8 +73,13 @@ viewportElementInitialize(int argc, VALUE *argv, VALUE self)
|
||||||
rb_get_args(argc, argv, "|o", &viewportObj RB_ARG_END);
|
rb_get_args(argc, argv, "|o", &viewportObj RB_ARG_END);
|
||||||
|
|
||||||
if (!NIL_P(viewportObj))
|
if (!NIL_P(viewportObj))
|
||||||
|
{
|
||||||
viewport = getPrivateDataCheck<Viewport>(viewportObj, ViewportType);
|
viewport = getPrivateDataCheck<Viewport>(viewportObj, ViewportType);
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableAddChild(viewportObj, self);
|
||||||
|
}
|
||||||
|
|
||||||
/* Construct object */
|
/* Construct object */
|
||||||
C *ve = new C(viewport);
|
C *ve = new C(viewport);
|
||||||
|
|
||||||
|
@ -96,9 +97,10 @@ viewportElementBindingInit(VALUE klass)
|
||||||
|
|
||||||
_rb_define_method(klass, "viewport", viewportElementGetViewport<C>);
|
_rb_define_method(klass, "viewport", viewportElementGetViewport<C>);
|
||||||
|
|
||||||
#ifdef RGSS2
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
_rb_define_method(klass, "viewport=", viewportElementSetViewport<C>);
|
_rb_define_method(klass, "viewport=", viewportElementSetViewport<C>);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // VIEWPORTELEMENTBINDING_H
|
#endif // VIEWPORTELEMENTBINDING_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -32,10 +32,9 @@ RB_METHOD(windowInitialize)
|
||||||
|
|
||||||
setPrivateData(self, w);
|
setPrivateData(self, w);
|
||||||
|
|
||||||
w->setCursorRect(new Rect);
|
w->initDynAttribs();
|
||||||
wrapNilProperty(self, "windowskin");
|
|
||||||
wrapNilProperty(self, "contents");
|
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
||||||
wrapProperty(self, w->getCursorRect(), "cursor_rect", RectType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -51,11 +50,9 @@ RB_METHOD(windowUpdate)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "window"
|
DEF_PROP_OBJ_REF(Window, Bitmap, Windowskin, "windowskin")
|
||||||
|
DEF_PROP_OBJ_REF(Window, Bitmap, Contents, "contents")
|
||||||
DEF_PROP_OBJ_NIL(Window, Bitmap, Windowskin, "windowskin")
|
DEF_PROP_OBJ_VAL(Window, Rect, CursorRect, "cursor_rect")
|
||||||
DEF_PROP_OBJ_NIL(Window, Bitmap, Contents, "contents")
|
|
||||||
DEF_PROP_OBJ(Window, Rect, CursorRect, "cursor_rect")
|
|
||||||
|
|
||||||
DEF_PROP_B(Window, Stretch)
|
DEF_PROP_B(Window, Stretch)
|
||||||
DEF_PROP_B(Window, Active)
|
DEF_PROP_B(Window, Active)
|
||||||
|
@ -75,8 +72,6 @@ DEF_PROP_I(Window, ContentsOpacity)
|
||||||
void
|
void
|
||||||
windowBindingInit()
|
windowBindingInit()
|
||||||
{
|
{
|
||||||
INIT_TYPE(Window);
|
|
||||||
|
|
||||||
VALUE klass = rb_define_class("Window", rb_cObject);
|
VALUE klass = rb_define_class("Window", rb_cObject);
|
||||||
rb_define_alloc_func(klass, classAllocate<&WindowType>);
|
rb_define_alloc_func(klass, classAllocate<&WindowType>);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
** window-binding.cpp
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "windowvx.h"
|
||||||
|
#include "disposable-binding.h"
|
||||||
|
#include "viewportelement-binding.h"
|
||||||
|
#include "binding-util.h"
|
||||||
|
|
||||||
|
#include "bitmap.h"
|
||||||
|
|
||||||
|
DEF_TYPE_CUSTOMNAME(WindowVX, "Window");
|
||||||
|
|
||||||
|
void bitmapInitProps(Bitmap *b, VALUE self);
|
||||||
|
|
||||||
|
RB_METHOD(windowVXInitialize)
|
||||||
|
{
|
||||||
|
WindowVX *w;
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
int x, y, width, height;
|
||||||
|
x = y = width = height = 0;
|
||||||
|
|
||||||
|
if (argc == 4)
|
||||||
|
rb_get_args(argc, argv, "iiii", &x, &y, &width, &height RB_ARG_END);
|
||||||
|
|
||||||
|
w = new WindowVX(x, y, width, height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w = viewportElementInitialize<WindowVX>(argc, argv, self);
|
||||||
|
}
|
||||||
|
|
||||||
|
setPrivateData(self, w);
|
||||||
|
|
||||||
|
w->initDynAttribs();
|
||||||
|
|
||||||
|
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(self, &w->getTone(), "tone", ToneType);
|
||||||
|
|
||||||
|
Bitmap *contents = new Bitmap(1, 1);
|
||||||
|
VALUE contentsObj = wrapObject(contents, BitmapType);
|
||||||
|
bitmapInitProps(contents, contentsObj);
|
||||||
|
rb_iv_set(self, "contents", contentsObj);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(windowVXUpdate)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
WindowVX *w = getPrivateData<WindowVX>(self);
|
||||||
|
|
||||||
|
w->update();
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(windowVXMove)
|
||||||
|
{
|
||||||
|
WindowVX *w = getPrivateData<WindowVX>(self);
|
||||||
|
|
||||||
|
int x, y, width, height;
|
||||||
|
rb_get_args(argc, argv, "iiii", &x, &y, &width, &height RB_ARG_END);
|
||||||
|
|
||||||
|
w->move(x, y, width, height);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(windowVXIsOpen)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
WindowVX *w = getPrivateData<WindowVX>(self);
|
||||||
|
|
||||||
|
return rb_bool_new(w->isOpen());
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_METHOD(windowVXIsClosed)
|
||||||
|
{
|
||||||
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
WindowVX *w = getPrivateData<WindowVX>(self);
|
||||||
|
|
||||||
|
return rb_bool_new(w->isClosed());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEF_PROP_OBJ_REF(WindowVX, Bitmap, Windowskin, "windowskin")
|
||||||
|
DEF_PROP_OBJ_REF(WindowVX, Bitmap, Contents, "contents")
|
||||||
|
|
||||||
|
DEF_PROP_OBJ_VAL(WindowVX, Rect, CursorRect, "cursor_rect")
|
||||||
|
DEF_PROP_OBJ_VAL(WindowVX, Tone, Tone, "tone")
|
||||||
|
|
||||||
|
DEF_PROP_I(WindowVX, X)
|
||||||
|
DEF_PROP_I(WindowVX, Y)
|
||||||
|
DEF_PROP_I(WindowVX, OX)
|
||||||
|
DEF_PROP_I(WindowVX, OY)
|
||||||
|
DEF_PROP_I(WindowVX, Width)
|
||||||
|
DEF_PROP_I(WindowVX, Height)
|
||||||
|
DEF_PROP_I(WindowVX, Padding)
|
||||||
|
DEF_PROP_I(WindowVX, PaddingBottom)
|
||||||
|
DEF_PROP_I(WindowVX, Opacity)
|
||||||
|
DEF_PROP_I(WindowVX, BackOpacity)
|
||||||
|
DEF_PROP_I(WindowVX, ContentsOpacity)
|
||||||
|
DEF_PROP_I(WindowVX, Openness)
|
||||||
|
|
||||||
|
DEF_PROP_B(WindowVX, Active)
|
||||||
|
DEF_PROP_B(WindowVX, ArrowsVisible)
|
||||||
|
DEF_PROP_B(WindowVX, Pause)
|
||||||
|
|
||||||
|
void
|
||||||
|
windowVXBindingInit()
|
||||||
|
{
|
||||||
|
VALUE klass = rb_define_class("Window", rb_cObject);
|
||||||
|
rb_define_alloc_func(klass, classAllocate<&WindowVXType>);
|
||||||
|
|
||||||
|
disposableBindingInit <WindowVX>(klass);
|
||||||
|
viewportElementBindingInit<WindowVX>(klass);
|
||||||
|
|
||||||
|
_rb_define_method(klass, "initialize", windowVXInitialize);
|
||||||
|
_rb_define_method(klass, "update", windowVXUpdate);
|
||||||
|
|
||||||
|
INIT_PROP_BIND( WindowVX, Windowskin, "windowskin" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Contents, "contents" );
|
||||||
|
INIT_PROP_BIND( WindowVX, CursorRect, "cursor_rect" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Active, "active" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Pause, "pause" );
|
||||||
|
INIT_PROP_BIND( WindowVX, X, "x" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Y, "y" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Width, "width" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Height, "height" );
|
||||||
|
INIT_PROP_BIND( WindowVX, OX, "ox" );
|
||||||
|
INIT_PROP_BIND( WindowVX, OY, "oy" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Opacity, "opacity" );
|
||||||
|
INIT_PROP_BIND( WindowVX, BackOpacity, "back_opacity" );
|
||||||
|
INIT_PROP_BIND( WindowVX, ContentsOpacity, "contents_opacity" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Openness, "openness" );
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
_rb_define_method(klass, "move", windowVXMove);
|
||||||
|
_rb_define_method(klass, "open?", windowVXIsOpen);
|
||||||
|
_rb_define_method(klass, "close?", windowVXIsClosed);
|
||||||
|
|
||||||
|
INIT_PROP_BIND( WindowVX, ArrowsVisible, "arrows_visible" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Padding, "padding" );
|
||||||
|
INIT_PROP_BIND( WindowVX, PaddingBottom, "padding_bottom" );
|
||||||
|
INIT_PROP_BIND( WindowVX, Tone, "tone" );
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -51,11 +51,13 @@
|
||||||
|
|
||||||
static void mrbBindingExecute();
|
static void mrbBindingExecute();
|
||||||
static void mrbBindingTerminate();
|
static void mrbBindingTerminate();
|
||||||
|
static void mrbBindingReset();
|
||||||
|
|
||||||
ScriptBinding scriptBindingImpl =
|
ScriptBinding scriptBindingImpl =
|
||||||
{
|
{
|
||||||
mrbBindingExecute,
|
mrbBindingExecute,
|
||||||
mrbBindingTerminate
|
mrbBindingTerminate,
|
||||||
|
mrbBindingReset
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
||||||
|
@ -112,8 +114,17 @@ static void mrbBindingInit(mrb_state *mrb)
|
||||||
/* Load RPG module */
|
/* Load RPG module */
|
||||||
mrb_load_irep(mrb, mrbModuleRPG);
|
mrb_load_irep(mrb, mrbModuleRPG);
|
||||||
|
|
||||||
|
/* Load global constants */
|
||||||
mrb_define_global_const(mrb, "MKXP", mrb_true_value());
|
mrb_define_global_const(mrb, "MKXP", mrb_true_value());
|
||||||
|
|
||||||
|
mrb_value debug = rb_bool_new(shState->config().editor.debug);
|
||||||
|
if (rgssVer == 1)
|
||||||
|
mrb_define_global_const(mrb, "DEBUG", debug);
|
||||||
|
else if (rgssVer >= 2)
|
||||||
|
mrb_define_global_const(mrb, "TEST", debug);
|
||||||
|
|
||||||
|
mrb_define_global_const(mrb, "BTEST", mrb_bool_value(shState->config().editor.battleTest));
|
||||||
|
|
||||||
mrb_gc_arena_restore(mrb, arena);
|
mrb_gc_arena_restore(mrb, arena);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +151,7 @@ mkxpTimeOp(mrb_state *mrb, mrb_value)
|
||||||
printf("<%s> [%f ms]\n", opName, ms);
|
printf("<%s> [%f ms]\n", opName, ms);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return mrb__float_value(ms);
|
return mrb_float_value(mrb, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
@ -159,7 +170,7 @@ showExcMessageBox(mrb_state *mrb, mrb_value exc)
|
||||||
const char *excClass = mrb_class_name(mrb, mrb_class(mrb, exc));
|
const char *excClass = mrb_class_name(mrb, mrb_class(mrb, exc));
|
||||||
|
|
||||||
char msgBoxText[512];
|
char msgBoxText[512];
|
||||||
snprintf(msgBoxText, 512, "Script '%s' line %d: %s occured.\n\n%s",
|
snprintf(msgBoxText, sizeof(msgBoxText), "Script '%s' line %d: %s occured.\n\n%s",
|
||||||
mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg));
|
mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg));
|
||||||
|
|
||||||
shState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
shState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
||||||
|
@ -190,7 +201,7 @@ static void
|
||||||
runCustomScript(mrb_state *mrb, mrbc_context *ctx, const char *filename)
|
runCustomScript(mrb_state *mrb, mrbc_context *ctx, const char *filename)
|
||||||
{
|
{
|
||||||
/* Execute custom script */
|
/* Execute custom script */
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "rb");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +226,7 @@ static void
|
||||||
runMrbFile(mrb_state *mrb, const char *filename)
|
runMrbFile(mrb_state *mrb, const char *filename)
|
||||||
{
|
{
|
||||||
/* Execute compiled script */
|
/* Execute compiled script */
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "rb");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
|
@ -264,7 +275,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
||||||
mrb_state *scriptMrb = mrb_open();
|
mrb_state *scriptMrb = mrb_open();
|
||||||
SDL_RWops ops;
|
SDL_RWops ops;
|
||||||
|
|
||||||
shState->fileSystem().openRead(ops, scriptPack.c_str());
|
shState->fileSystem().openReadRaw(ops, scriptPack.c_str());
|
||||||
|
|
||||||
mrb_value scriptArray = mrb_nil_value();
|
mrb_value scriptArray = mrb_nil_value();
|
||||||
std::string readError;
|
std::string readError;
|
||||||
|
@ -384,7 +395,7 @@ static void mrbBindingExecute()
|
||||||
|
|
||||||
checkException(mrb);
|
checkException(mrb);
|
||||||
|
|
||||||
shState->rtData().rqTermAck = true;
|
shState->rtData().rqTermAck.set();
|
||||||
shState->texPool().disable();
|
shState->texPool().disable();
|
||||||
|
|
||||||
mrbc_context_free(mrb, ctx);
|
mrbc_context_free(mrb, ctx);
|
||||||
|
@ -398,3 +409,8 @@ static void mrbBindingTerminate()
|
||||||
|
|
||||||
mrb_raise(mrb, data->exc[Shutdown], "");
|
mrb_raise(mrb, data->exc[Shutdown], "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mrbBindingReset()
|
||||||
|
{
|
||||||
|
// No idea how to do this with mruby yet
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,8 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define SYMD(symbol) { CS##symbol, #symbol }
|
#define SYMD(symbol) { CS##symbol, #symbol }
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
@ -31,14 +33,15 @@ struct
|
||||||
const char *str;
|
const char *str;
|
||||||
} static const symData[] =
|
} static const symData[] =
|
||||||
{
|
{
|
||||||
SYMD(priv_iv),
|
|
||||||
SYMD(font),
|
SYMD(font),
|
||||||
SYMD(viewport),
|
SYMD(viewport),
|
||||||
SYMD(bitmap),
|
SYMD(bitmap),
|
||||||
SYMD(color),
|
SYMD(color),
|
||||||
|
SYMD(out_color),
|
||||||
SYMD(tone),
|
SYMD(tone),
|
||||||
SYMD(rect),
|
SYMD(rect),
|
||||||
SYMD(src_rect),
|
SYMD(src_rect),
|
||||||
|
SYMD(tilemap),
|
||||||
SYMD(tileset),
|
SYMD(tileset),
|
||||||
SYMD(autotiles),
|
SYMD(autotiles),
|
||||||
SYMD(map_data),
|
SYMD(map_data),
|
||||||
|
@ -49,7 +52,10 @@ struct
|
||||||
SYMD(cursor_rect),
|
SYMD(cursor_rect),
|
||||||
SYMD(path),
|
SYMD(path),
|
||||||
SYMD(array),
|
SYMD(array),
|
||||||
SYMD(default_color)
|
SYMD(default_color),
|
||||||
|
SYMD(default_out_color),
|
||||||
|
SYMD(children),
|
||||||
|
SYMD(_mkxp_dispose_alias)
|
||||||
};
|
};
|
||||||
|
|
||||||
static elementsN(symData);
|
static elementsN(symData);
|
||||||
|
@ -63,7 +69,6 @@ struct MrbExcData
|
||||||
static const MrbExcData excData[] =
|
static const MrbExcData excData[] =
|
||||||
{
|
{
|
||||||
{ Shutdown, "SystemExit" },
|
{ Shutdown, "SystemExit" },
|
||||||
{ RGSS, "RGSSError" },
|
|
||||||
{ PHYSFS, "PHYSFSError" },
|
{ PHYSFS, "PHYSFSError" },
|
||||||
{ SDL, "SDLError" },
|
{ SDL, "SDLError" },
|
||||||
{ MKXP, "MKXPError" },
|
{ MKXP, "MKXPError" },
|
||||||
|
@ -100,19 +105,21 @@ MrbData::MrbData(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
int arena = mrb_gc_arena_save(mrb);
|
int arena = mrb_gc_arena_save(mrb);
|
||||||
|
|
||||||
for (int i = 0; i < excDataN; ++i)
|
for (size_t i = 0; i < excDataN; ++i)
|
||||||
exc[excData[i].ind] = mrb_define_class(mrb, excData[i].str, mrb->eException_class);
|
exc[excData[i].ind] = mrb_define_class(mrb, excData[i].str, mrb->eException_class);
|
||||||
|
|
||||||
|
exc[RGSS] = mrb_define_class(mrb, "RGSSError", mrb->eStandardError_class);
|
||||||
|
|
||||||
RClass *errnoMod = mrb_define_module(mrb, "Errno");
|
RClass *errnoMod = mrb_define_module(mrb, "Errno");
|
||||||
|
|
||||||
for (int i = 0; i < enoExcDataN; ++i)
|
for (size_t i = 0; i < enoExcDataN; ++i)
|
||||||
exc[enoExcData[i].ind] =
|
exc[enoExcData[i].ind] =
|
||||||
mrb_define_class_under(mrb, errnoMod, enoExcData[i].str, mrb->eStandardError_class);
|
mrb_define_class_under(mrb, errnoMod, enoExcData[i].str, mrb->eStandardError_class);
|
||||||
|
|
||||||
exc[TypeError] = mrb_class_get(mrb, "TypeError");
|
exc[TypeError] = mrb_class_get(mrb, "TypeError");
|
||||||
exc[ArgumentError] = mrb_class_get(mrb, "ArgumentError");
|
exc[ArgumentError] = mrb_class_get(mrb, "ArgumentError");
|
||||||
|
|
||||||
for (int i = 0; i < symDataN; ++i)
|
for (size_t i = 0; i < symDataN; ++i)
|
||||||
symbols[symData[i].ind] = mrb_intern_cstr(mrb, symData[i].str);
|
symbols[symData[i].ind] = mrb_intern_cstr(mrb, symData[i].str);
|
||||||
|
|
||||||
mrb_gc_arena_restore(mrb, arena);
|
mrb_gc_arena_restore(mrb, arena);
|
||||||
|
@ -141,12 +148,23 @@ void raiseMrbExc(mrb_state *mrb, const Exception &exc)
|
||||||
mrb_raise(mrb, excClass, exc.msg.c_str());
|
mrb_raise(mrb, excClass, exc.msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
raiseDisposedAccess(mrb_state *mrb, mrb_value self)
|
||||||
|
{
|
||||||
|
const char *klassName = DATA_TYPE(self)->struct_name;
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
strncpy(buf, klassName, sizeof(buf));
|
||||||
|
buf[0] = tolower(buf[0]);
|
||||||
|
|
||||||
|
mrb_raisef(mrb, getMrbData(mrb)->exc[RGSS],
|
||||||
|
"disposed %S", mrb_str_new_cstr(mrb, buf));
|
||||||
|
}
|
||||||
|
|
||||||
MRB_METHOD_PUB(inspectObject)
|
MRB_METHOD_PUB(inspectObject)
|
||||||
{
|
{
|
||||||
mrb_value priv = mrb_obj_iv_get(mrb, mrb_obj_ptr(self), getSym(mrb, CSpriv_iv));
|
|
||||||
|
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
snprintf(buffer, sizeof(buffer), "#<%s:%p>", DATA_TYPE(priv)->struct_name, DATA_PTR(priv));
|
snprintf(buffer, sizeof(buffer), "#<%s:%p>", DATA_TYPE(self)->struct_name, DATA_PTR(self));
|
||||||
|
|
||||||
return mrb_str_new_cstr(mrb, buffer);
|
return mrb_str_new_cstr(mrb, buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,6 +22,8 @@
|
||||||
#ifndef BINDINGUTIL_H
|
#ifndef BINDINGUTIL_H
|
||||||
#define BINDINGUTIL_H
|
#define BINDINGUTIL_H
|
||||||
|
|
||||||
|
#include "exception.h"
|
||||||
|
|
||||||
#include <mruby.h>
|
#include <mruby.h>
|
||||||
#include <mruby/data.h>
|
#include <mruby/data.h>
|
||||||
#include <mruby/variable.h>
|
#include <mruby/variable.h>
|
||||||
|
@ -32,17 +34,15 @@
|
||||||
|
|
||||||
enum CommonSymbol
|
enum CommonSymbol
|
||||||
{
|
{
|
||||||
CSpriv_iv = 0, /* private data */
|
CSfont = 0,
|
||||||
|
|
||||||
/* From here on out all symbols
|
|
||||||
* have implicit '@' prefix */
|
|
||||||
CSfont,
|
|
||||||
CSviewport,
|
CSviewport,
|
||||||
CSbitmap,
|
CSbitmap,
|
||||||
CScolor,
|
CScolor,
|
||||||
|
CSout_color,
|
||||||
CStone,
|
CStone,
|
||||||
CSrect,
|
CSrect,
|
||||||
CSsrc_rect,
|
CSsrc_rect,
|
||||||
|
CStilemap,
|
||||||
CStileset,
|
CStileset,
|
||||||
CSautotiles,
|
CSautotiles,
|
||||||
CSmap_data,
|
CSmap_data,
|
||||||
|
@ -54,6 +54,9 @@ enum CommonSymbol
|
||||||
CSpath,
|
CSpath,
|
||||||
CSarray,
|
CSarray,
|
||||||
CSdefault_color,
|
CSdefault_color,
|
||||||
|
CSdefault_out_color,
|
||||||
|
CSchildren,
|
||||||
|
CS_mkxp_dispose_alias,
|
||||||
|
|
||||||
CommonSymbolsMax
|
CommonSymbolsMax
|
||||||
};
|
};
|
||||||
|
@ -98,6 +101,8 @@ struct MrbData
|
||||||
* so I can measure how much of a speed difference they make */
|
* so I can measure how much of a speed difference they make */
|
||||||
mrb_sym symbols[CommonSymbolsMax];
|
mrb_sym symbols[CommonSymbolsMax];
|
||||||
|
|
||||||
|
mrb_value buttoncodeHash;
|
||||||
|
|
||||||
MrbData(mrb_state *mrb);
|
MrbData(mrb_state *mrb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,6 +117,15 @@ getMrbData(mrb_state *mrb)
|
||||||
return static_cast<MrbData*>(mrb->ud);
|
return static_cast<MrbData*>(mrb->ud);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline RClass*
|
||||||
|
defineClass(mrb_state *mrb, const char *name)
|
||||||
|
{
|
||||||
|
RClass *klass = mrb_define_class(mrb, name, mrb->object_class);
|
||||||
|
MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
|
||||||
|
|
||||||
|
return klass;
|
||||||
|
}
|
||||||
|
|
||||||
#define GUARD_EXC(exp) \
|
#define GUARD_EXC(exp) \
|
||||||
{ try { exp } catch (Exception &exc) { raiseMrbExc(mrb, exc); } }
|
{ try { exp } catch (Exception &exc) { raiseMrbExc(mrb, exc); } }
|
||||||
|
|
||||||
|
@ -138,16 +152,11 @@ getMrbData(mrb_state *mrb)
|
||||||
|
|
||||||
#define MRB_FUN_UNUSED_PARAM { (void) mrb; }
|
#define MRB_FUN_UNUSED_PARAM { (void) mrb; }
|
||||||
|
|
||||||
/* If we're not binding a disposable class,
|
/* Object property which is copied by value, not reference */
|
||||||
* we want to #undef DEF_PROP_CHK_DISP */
|
#define DEF_PROP_OBJ_VAL(Klass, PropKlass, PropName, prop_iv) \
|
||||||
#define DEF_PROP_CHK_DISP \
|
|
||||||
checkDisposed(mrb, k, DISP_CLASS_NAME);
|
|
||||||
|
|
||||||
#define DEF_PROP_OBJ(Klass, PropKlass, PropName, prop_iv) \
|
|
||||||
MRB_METHOD(Klass##Get##PropName) \
|
MRB_METHOD(Klass##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
Klass *k = getPrivateData<Klass>(mrb, self); (void) k; \
|
checkDisposed<Klass>(mrb, self); \
|
||||||
DEF_PROP_CHK_DISP \
|
|
||||||
return getProperty(mrb, self, prop_iv); \
|
return getProperty(mrb, self, prop_iv); \
|
||||||
} \
|
} \
|
||||||
MRB_METHOD(Klass##Set##PropName) \
|
MRB_METHOD(Klass##Set##PropName) \
|
||||||
|
@ -157,17 +166,14 @@ getMrbData(mrb_state *mrb)
|
||||||
PropKlass *prop; \
|
PropKlass *prop; \
|
||||||
mrb_get_args(mrb, "o", &propObj); \
|
mrb_get_args(mrb, "o", &propObj); \
|
||||||
prop = getPrivateDataCheck<PropKlass>(mrb, propObj, PropKlass##Type); \
|
prop = getPrivateDataCheck<PropKlass>(mrb, propObj, PropKlass##Type); \
|
||||||
GUARD_EXC( k->set##PropName(prop); ) \
|
GUARD_EXC( k->set##PropName(*prop); ) \
|
||||||
setProperty(mrb, self, prop_iv, propObj); \
|
|
||||||
return propObj; \
|
return propObj; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Object property with allowed NIL */
|
/* Object property which is copied by reference, with allowed NIL */
|
||||||
#define DEF_PROP_OBJ_NIL(Klass, PropKlass, PropName, prop_iv) \
|
#define DEF_PROP_OBJ_REF(Klass, PropKlass, PropName, prop_iv) \
|
||||||
MRB_METHOD(Klass##Get##PropName) \
|
MRB_METHOD(Klass##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
Klass *k = getPrivateData<Klass>(mrb, self); (void) k; \
|
|
||||||
DEF_PROP_CHK_DISP \
|
|
||||||
return getProperty(mrb, self, prop_iv); \
|
return getProperty(mrb, self, prop_iv); \
|
||||||
} \
|
} \
|
||||||
MRB_METHOD(Klass##Set##PropName) \
|
MRB_METHOD(Klass##Set##PropName) \
|
||||||
|
@ -189,8 +195,9 @@ getMrbData(mrb_state *mrb)
|
||||||
MRB_METHOD(Klass##Get##PropName) \
|
MRB_METHOD(Klass##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
Klass *k = getPrivateData<Klass>(mrb, self); \
|
Klass *k = getPrivateData<Klass>(mrb, self); \
|
||||||
DEF_PROP_CHK_DISP \
|
mrb_type value = 0; \
|
||||||
return mrb_##conv_t##_value(k->get##PropName()); \
|
GUARD_EXC( value = k->get##PropName(); ) \
|
||||||
|
return mrb_##conv_t##_value(value); \
|
||||||
} \
|
} \
|
||||||
MRB_METHOD(Klass##Set##PropName) \
|
MRB_METHOD(Klass##Set##PropName) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -210,14 +217,16 @@ getMrbData(mrb_state *mrb)
|
||||||
#define DEF_PROP_B(Klass, PropName) \
|
#define DEF_PROP_B(Klass, PropName) \
|
||||||
DEF_PROP(Klass, mrb_bool, PropName, "b", bool)
|
DEF_PROP(Klass, mrb_bool, PropName, "b", bool)
|
||||||
|
|
||||||
#define CLONE_FUN(Klass) \
|
#define INITCOPY_FUN(Klass) \
|
||||||
MRB_METHOD(Klass##Clone) \
|
MRB_METHOD(Klass##InitializeCopy) \
|
||||||
{ \
|
{ \
|
||||||
Klass *k = getPrivateData<Klass>(mrb, self); \
|
mrb_value origObj; \
|
||||||
mrb_value dupObj = mrb_obj_clone(mrb, self); \
|
mrb_get_args(mrb, "o", &origObj); \
|
||||||
Klass *dupK = new Klass(*k); \
|
Klass *orig = getPrivateData<Klass>(mrb, origObj); \
|
||||||
setPrivateData(mrb, dupObj, dupK, Klass##Type); \
|
Klass *k = 0; \
|
||||||
return dupObj; \
|
GUARD_EXC( k = new Klass(*orig); ) \
|
||||||
|
setPrivateData(self, k, Klass##Type); \
|
||||||
|
return self; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MARSH_LOAD_FUN(Klass) \
|
#define MARSH_LOAD_FUN(Klass) \
|
||||||
|
@ -235,10 +244,10 @@ getMrbData(mrb_state *mrb)
|
||||||
static inline mrb_value
|
static inline mrb_value
|
||||||
mrb__float_value(mrb_float f)
|
mrb__float_value(mrb_float f)
|
||||||
{
|
{
|
||||||
mrb_value v;
|
mrb_value v;
|
||||||
|
|
||||||
MRB_SET_VALUE(v, MRB_TT_FLOAT, value.f, f);
|
SET_FLOAT_VALUE(0, v, f);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline mrb_sym
|
inline mrb_sym
|
||||||
|
@ -247,71 +256,47 @@ getSym(mrb_state *mrb, CommonSymbol sym)
|
||||||
return getMrbData(mrb)->symbols[sym];
|
return getMrbData(mrb)->symbols[sym];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
void
|
||||||
inline T *
|
raiseDisposedAccess(mrb_state *mrb, mrb_value self);
|
||||||
getPrivateData(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
|
||||||
mrb_value priv = mrb_obj_iv_get(mrb,
|
|
||||||
mrb_obj_ptr(self),
|
|
||||||
getSym(mrb, CSpriv_iv));
|
|
||||||
|
|
||||||
return static_cast<T*>(DATA_PTR(priv));
|
template<class C>
|
||||||
|
inline C *
|
||||||
|
getPrivateData(mrb_state *, mrb_value self)
|
||||||
|
{
|
||||||
|
C *c = static_cast<C*>(DATA_PTR(self));
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *
|
inline T *
|
||||||
getPrivateDataCheck(mrb_state *mrb, mrb_value obj, const mrb_data_type &type)
|
getPrivateDataCheck(mrb_state *mrb, mrb_value obj, const mrb_data_type &type)
|
||||||
{
|
{
|
||||||
static const char mesg[] = "wrong argument type %S (expected %S)";
|
void *ptr = mrb_check_datatype(mrb, obj, &type);
|
||||||
|
return static_cast<T*>(ptr);
|
||||||
if (mrb_type(obj) != MRB_TT_OBJECT)
|
|
||||||
mrb_raisef(mrb, E_TYPE_ERROR, mesg,
|
|
||||||
mrb_str_new_cstr(mrb, (mrb_class_name(mrb, mrb_class(mrb, obj)))),
|
|
||||||
mrb_str_new_cstr(mrb, type.struct_name));
|
|
||||||
|
|
||||||
RObject *objP = mrb_obj_ptr(obj);
|
|
||||||
|
|
||||||
if (!mrb_obj_iv_defined(mrb, objP, getSym(mrb, CSpriv_iv)))
|
|
||||||
mrb_raisef(mrb, E_TYPE_ERROR, mesg,
|
|
||||||
mrb_str_new_cstr(mrb, (mrb_class_name(mrb, mrb_class(mrb, obj)))),
|
|
||||||
mrb_str_new_cstr(mrb, type.struct_name));
|
|
||||||
|
|
||||||
mrb_value priv = mrb_obj_iv_get(mrb, objP, getSym(mrb, CSpriv_iv));
|
|
||||||
|
|
||||||
void *p = mrb_check_datatype(mrb, priv, &type);
|
|
||||||
|
|
||||||
return static_cast<T*>(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
setPrivateData(mrb_state *mrb, mrb_value self, void *p, const mrb_data_type &type)
|
setPrivateData(mrb_value self, void *p, const mrb_data_type &type)
|
||||||
{
|
{
|
||||||
RData *data =
|
DATA_PTR(self) = p;
|
||||||
mrb_data_object_alloc(mrb,
|
DATA_TYPE(self) = &type;
|
||||||
mrb_obj_class(mrb, self),
|
|
||||||
p,
|
|
||||||
&type);
|
|
||||||
|
|
||||||
mrb_obj_iv_set(mrb,
|
|
||||||
mrb_obj_ptr(self),
|
|
||||||
getSym(mrb, CSpriv_iv),
|
|
||||||
mrb_obj_value(data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline mrb_value
|
inline mrb_value
|
||||||
wrapObject(mrb_state *mrb, void *p, const mrb_data_type &type)
|
wrapObject(mrb_state *mrb, void *p, const mrb_data_type &type)
|
||||||
{
|
{
|
||||||
RClass *c = mrb_class_get(mrb, type.struct_name);
|
RClass *klass = mrb_class_get(mrb, type.struct_name);
|
||||||
RObject *o = (RObject*) mrb_obj_alloc(mrb, MRB_TT_OBJECT, c);
|
RData *data = mrb_data_object_alloc(mrb, klass, p, &type);
|
||||||
mrb_value obj = mrb_obj_value(o);
|
mrb_value obj = mrb_obj_value(data);
|
||||||
|
|
||||||
setPrivateData(mrb, obj, p, type);
|
setPrivateData(obj, p, type);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline mrb_value
|
||||||
wrapProperty(mrb_state *mrb, mrb_value self,
|
wrapProperty(mrb_state *mrb, mrb_value self,
|
||||||
void *prop, CommonSymbol iv, const mrb_data_type &type)
|
void *prop, CommonSymbol iv, const mrb_data_type &type)
|
||||||
{
|
{
|
||||||
|
@ -320,16 +305,9 @@ wrapProperty(mrb_state *mrb, mrb_value self,
|
||||||
mrb_obj_iv_set(mrb,
|
mrb_obj_iv_set(mrb,
|
||||||
mrb_obj_ptr(self),
|
mrb_obj_ptr(self),
|
||||||
getSym(mrb, iv),
|
getSym(mrb, iv),
|
||||||
propObj);
|
propObj);
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
return propObj;
|
||||||
wrapNilProperty(mrb_state *mrb, mrb_value self, CommonSymbol iv)
|
|
||||||
{
|
|
||||||
mrb_obj_iv_set(mrb,
|
|
||||||
mrb_obj_ptr(self),
|
|
||||||
getSym(mrb, iv),
|
|
||||||
mrb_nil_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline mrb_value
|
inline mrb_value
|
||||||
|
@ -378,12 +356,10 @@ objectLoad(mrb_state *mrb, mrb_value self, const mrb_data_type &type)
|
||||||
int data_len;
|
int data_len;
|
||||||
mrb_get_args(mrb, "s", &data, &data_len);
|
mrb_get_args(mrb, "s", &data, &data_len);
|
||||||
|
|
||||||
RObject *obj = (RObject*) mrb_obj_alloc(mrb, MRB_TT_OBJECT, klass);
|
|
||||||
mrb_value obj_value = mrb_obj_value(obj);
|
|
||||||
|
|
||||||
C *c = C::deserialize(data, data_len);
|
C *c = C::deserialize(data, data_len);
|
||||||
|
|
||||||
setPrivateData(mrb, obj_value, c, type);
|
RData *obj = mrb_data_object_alloc(mrb, klass, c, &type);
|
||||||
|
mrb_value obj_value = mrb_obj_value(obj);
|
||||||
|
|
||||||
return obj_value;
|
return obj_value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,12 +22,11 @@
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "bitmap"
|
|
||||||
|
|
||||||
DEF_TYPE(Bitmap);
|
DEF_TYPE(Bitmap);
|
||||||
|
|
||||||
MRB_METHOD(bitmapInitialize)
|
MRB_METHOD(bitmapInitialize)
|
||||||
|
@ -49,15 +48,19 @@ MRB_METHOD(bitmapInitialize)
|
||||||
GUARD_EXC( b = new Bitmap(width, height); )
|
GUARD_EXC( b = new Bitmap(width, height); )
|
||||||
}
|
}
|
||||||
|
|
||||||
setPrivateData(mrb, self, b, BitmapType);
|
setPrivateData(self, b, BitmapType);
|
||||||
|
|
||||||
/* Wrap properties */
|
/* Wrap properties */
|
||||||
Font *font = new Font();
|
Font *font = new Font();
|
||||||
b->setFont(font);
|
b->setInitFont(font);
|
||||||
font->setColor(new Color(*font->getColor()));
|
font->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(mrb, self, font, CSfont, FontType);
|
mrb_value fontProp = wrapProperty(mrb, self, font, CSfont, FontType);
|
||||||
wrapProperty(mrb, getProperty(mrb, self, CSfont), font->getColor(), CScolor, ColorType);
|
|
||||||
|
wrapProperty(mrb, fontProp, &font->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(mrb, fontProp, &font->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -189,12 +192,7 @@ MRB_METHOD(bitmapGetPixel)
|
||||||
|
|
||||||
mrb_get_args(mrb, "ii", &x, &y);
|
mrb_get_args(mrb, "ii", &x, &y);
|
||||||
|
|
||||||
GUARD_EXC(
|
Color value;
|
||||||
if (x < 0 || y < 0 || x >= b->width() || y >= b->height())
|
|
||||||
return mrb_nil_value();
|
|
||||||
)
|
|
||||||
|
|
||||||
Vec4 value;
|
|
||||||
GUARD_EXC( value = b->getPixel(x, y); )
|
GUARD_EXC( value = b->getPixel(x, y); )
|
||||||
|
|
||||||
Color *color = new Color(value);
|
Color *color = new Color(value);
|
||||||
|
@ -215,7 +213,7 @@ MRB_METHOD(bitmapSetPixel)
|
||||||
|
|
||||||
color = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
color = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
||||||
|
|
||||||
GUARD_EXC( b->setPixel(x, y, color->norm); )
|
GUARD_EXC( b->setPixel(x, y, *color); )
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
@ -282,8 +280,7 @@ MRB_METHOD(bitmapTextSize)
|
||||||
|
|
||||||
MRB_METHOD(bitmapGetFont)
|
MRB_METHOD(bitmapGetFont)
|
||||||
{
|
{
|
||||||
Bitmap *b = getPrivateData<Bitmap>(mrb, self);
|
checkDisposed<Bitmap>(mrb, self);
|
||||||
checkDisposed(mrb, b, "bitmap");
|
|
||||||
|
|
||||||
return getProperty(mrb, self, CSfont);
|
return getProperty(mrb, self, CSfont);
|
||||||
}
|
}
|
||||||
|
@ -299,23 +296,23 @@ MRB_METHOD(bitmapSetFont)
|
||||||
|
|
||||||
font = getPrivateDataCheck<Font>(mrb, fontObj, FontType);
|
font = getPrivateDataCheck<Font>(mrb, fontObj, FontType);
|
||||||
|
|
||||||
GUARD_EXC( b->setFont(font); )
|
GUARD_EXC( b->setFont(*font); )
|
||||||
setProperty(mrb, self, CSfont, fontObj);
|
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLONE_FUN(Bitmap)
|
INITCOPY_FUN(Bitmap)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bitmapBindingInit(mrb_state *mrb)
|
bitmapBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Bitmap", 0);
|
RClass *klass = defineClass(mrb, "Bitmap");
|
||||||
|
|
||||||
disposableBindingInit<Bitmap>(mrb, klass);
|
disposableBindingInit<Bitmap>(mrb, klass);
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "initialize", bitmapInitialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
|
mrb_define_method(mrb, klass, "initialize", bitmapInitialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
|
||||||
|
mrb_define_method(mrb, klass, "initialize_copy", BitmapInitializeCopy, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "width", bitmapWidth, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "width", bitmapWidth, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, klass, "height", bitmapHeight, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "height", bitmapHeight, MRB_ARGS_NONE());
|
||||||
|
@ -334,5 +331,4 @@ bitmapBindingInit(mrb_state *mrb)
|
||||||
mrb_define_method(mrb, klass, "font=", bitmapSetFont, MRB_ARGS_REQ(1));
|
mrb_define_method(mrb, klass, "font=", bitmapSetFont, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, klass, "clone", BitmapClone, MRB_ARGS_NONE());
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -25,12 +25,57 @@
|
||||||
#include "disposable.h"
|
#include "disposable.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
|
||||||
|
#include "mruby/array.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* 'Children' are disposables that are disposed together
|
||||||
|
* with their parent. Currently this is only used by Viewport
|
||||||
|
* in RGSS1.
|
||||||
|
* FIXME: Disable this behavior when RGSS2 or 3 */
|
||||||
|
inline void
|
||||||
|
disposableAddChild(mrb_state *mrb, mrb_value disp, mrb_value child)
|
||||||
|
{
|
||||||
|
mrb_sym sym = getMrbData(mrb)->symbols[CSchildren];
|
||||||
|
mrb_value children = mrb_iv_get(mrb, disp, sym);
|
||||||
|
|
||||||
|
if (mrb_nil_p(children))
|
||||||
|
{
|
||||||
|
children = mrb_ary_new(mrb);
|
||||||
|
mrb_iv_set(mrb, disp, sym, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Assumes children are never removed until destruction */
|
||||||
|
mrb_ary_push(mrb, children, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
disposableDisposeChildren(mrb_state *mrb, mrb_value disp)
|
||||||
|
{
|
||||||
|
MrbData *mrbData = getMrbData(mrb);
|
||||||
|
mrb_value children = mrb_iv_get(mrb, disp, mrbData->symbols[CSchildren]);
|
||||||
|
|
||||||
|
if (mrb_nil_p(children))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (mrb_int i = 0; i < RARRAY_LEN(children); ++i)
|
||||||
|
mrb_funcall_argv(mrb, mrb_ary_entry(children, i),
|
||||||
|
mrbData->symbols[CS_mkxp_dispose_alias], 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
MRB_METHOD(disposableDispose)
|
MRB_METHOD(disposableDispose)
|
||||||
{
|
{
|
||||||
Disposable *d = getPrivateData<C>(mrb, self);
|
C *d = static_cast<C*>(DATA_PTR(self));
|
||||||
|
|
||||||
|
if (!d)
|
||||||
|
return mrb_nil_value();
|
||||||
|
|
||||||
|
if (d->isDisposed())
|
||||||
|
return mrb_nil_value();
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableDisposeChildren(mrb, self);
|
||||||
|
|
||||||
d->dispose();
|
d->dispose();
|
||||||
|
|
||||||
|
@ -38,9 +83,14 @@ MRB_METHOD(disposableDispose)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
MRB_METHOD(disposableDisposed)
|
MRB_METHOD(disposableIsDisposed)
|
||||||
{
|
{
|
||||||
Disposable *d = getPrivateData<C>(mrb, self);
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
C *d = static_cast<C*>(DATA_PTR(self));
|
||||||
|
|
||||||
|
if (!d)
|
||||||
|
return mrb_true_value();
|
||||||
|
|
||||||
return mrb_bool_value(d->isDisposed());
|
return mrb_bool_value(d->isDisposed());
|
||||||
}
|
}
|
||||||
|
@ -49,16 +99,19 @@ template<class C>
|
||||||
static void disposableBindingInit(mrb_state *mrb, RClass *klass)
|
static void disposableBindingInit(mrb_state *mrb, RClass *klass)
|
||||||
{
|
{
|
||||||
mrb_define_method(mrb, klass, "dispose", disposableDispose<C>, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "dispose", disposableDispose<C>, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, klass, "disposed?", disposableDisposed<C>, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "disposed?", disposableIsDisposed<C>, MRB_ARGS_NONE());
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
mrb_alias_method(mrb, klass, getMrbData(mrb)->symbols[CS_mkxp_dispose_alias],
|
||||||
|
mrb_intern_lit(mrb, "dispose"));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void checkDisposed(mrb_state *mrb, Disposable *d, const char *klassName)
|
template<class C>
|
||||||
|
inline void
|
||||||
|
checkDisposed(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
MrbData *data = getMrbData(mrb);
|
if (mrb_test(disposableIsDisposed<C>(0, self)))
|
||||||
|
raiseDisposedAccess(mrb, self);
|
||||||
if (d->isDisposed())
|
|
||||||
mrb_raisef(mrb, data->exc[RGSS], "disposed %S",
|
|
||||||
mrb_str_new_static(mrb, klassName, strlen(klassName)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DISPOSABLEBINDING_H
|
#endif // DISPOSABLEBINDING_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,22 +24,22 @@
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
#include "serializable-binding.h"
|
#include "serializable-binding.h"
|
||||||
|
|
||||||
#define ATTR_RW(Type, attr, arg_type, mrb_val, arg_t_s) \
|
#define ATTR_RW(Type, Attr, arg_type, mrb_val, arg_t_s) \
|
||||||
MRB_METHOD(Type##Get_##attr) \
|
MRB_METHOD(Type##Get##Attr) \
|
||||||
{ \
|
{ \
|
||||||
Type *p = getPrivateData<Type>(mrb, self); \
|
Type *p = getPrivateData<Type>(mrb, self); \
|
||||||
\
|
\
|
||||||
return mrb_##mrb_val##_value(p->attr); \
|
return mrb_##mrb_val##_value(p->get##Attr()); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
MRB_METHOD(Type##Set_##attr) \
|
MRB_METHOD(Type##Set##Attr) \
|
||||||
{ \
|
{ \
|
||||||
Type *p = getPrivateData<Type>(mrb, self); \
|
Type *p = getPrivateData<Type>(mrb, self); \
|
||||||
\
|
\
|
||||||
arg_type arg; \
|
arg_type arg; \
|
||||||
mrb_get_args(mrb, arg_t_s, &arg); \
|
mrb_get_args(mrb, arg_t_s, &arg); \
|
||||||
\
|
\
|
||||||
p->attr = arg; \
|
p->set##Attr(arg); \
|
||||||
UPDATE_F \
|
UPDATE_F \
|
||||||
\
|
\
|
||||||
return mrb_##mrb_val##_value(arg); \
|
return mrb_##mrb_val##_value(arg); \
|
||||||
|
@ -64,22 +64,22 @@
|
||||||
#define ATTR_INT_RW(Type, attr) ATTR_RW(Type, attr, mrb_int, fixnum, "i")
|
#define ATTR_INT_RW(Type, attr) ATTR_RW(Type, attr, mrb_int, fixnum, "i")
|
||||||
|
|
||||||
#define UPDATE_F p->updateInternal();
|
#define UPDATE_F p->updateInternal();
|
||||||
ATTR_FLOAT_RW(Color, red)
|
ATTR_FLOAT_RW(Color, Red)
|
||||||
ATTR_FLOAT_RW(Color, green)
|
ATTR_FLOAT_RW(Color, Green)
|
||||||
ATTR_FLOAT_RW(Color, blue)
|
ATTR_FLOAT_RW(Color, Blue)
|
||||||
ATTR_FLOAT_RW(Color, alpha)
|
ATTR_FLOAT_RW(Color, Alpha)
|
||||||
|
|
||||||
ATTR_FLOAT_RW(Tone, red)
|
ATTR_FLOAT_RW(Tone, Red)
|
||||||
ATTR_FLOAT_RW(Tone, green)
|
ATTR_FLOAT_RW(Tone, Green)
|
||||||
ATTR_FLOAT_RW(Tone, blue)
|
ATTR_FLOAT_RW(Tone, Blue)
|
||||||
ATTR_FLOAT_RW(Tone, gray)
|
ATTR_FLOAT_RW(Tone, Gray)
|
||||||
|
|
||||||
#undef UPDATE_F
|
#undef UPDATE_F
|
||||||
#define UPDATE_F
|
#define UPDATE_F
|
||||||
ATTR_INT_RW(Rect, x)
|
ATTR_INT_RW(Rect, X)
|
||||||
ATTR_INT_RW(Rect, y)
|
ATTR_INT_RW(Rect, Y)
|
||||||
ATTR_INT_RW(Rect, width)
|
ATTR_INT_RW(Rect, Width)
|
||||||
ATTR_INT_RW(Rect, height)
|
ATTR_INT_RW(Rect, Height)
|
||||||
|
|
||||||
EQUAL_FUN(Color)
|
EQUAL_FUN(Color)
|
||||||
EQUAL_FUN(Tone)
|
EQUAL_FUN(Tone)
|
||||||
|
@ -95,7 +95,7 @@ DEF_TYPE(Rect);
|
||||||
param_type p1, p2, p3, p4 = last_param_def; \
|
param_type p1, p2, p3, p4 = last_param_def; \
|
||||||
mrb_get_args(mrb, param_t_s, &p1, &p2, &p3, &p4); \
|
mrb_get_args(mrb, param_t_s, &p1, &p2, &p3, &p4); \
|
||||||
Klass *k = new Klass(p1, p2, p3, p4); \
|
Klass *k = new Klass(p1, p2, p3, p4); \
|
||||||
setPrivateData(mrb, self, k, Klass##Type); \
|
setPrivateData(self, k, Klass##Type); \
|
||||||
return self; \
|
return self; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,28 +159,22 @@ MARSH_LOAD_FUN(Color)
|
||||||
MARSH_LOAD_FUN(Tone)
|
MARSH_LOAD_FUN(Tone)
|
||||||
MARSH_LOAD_FUN(Rect)
|
MARSH_LOAD_FUN(Rect)
|
||||||
|
|
||||||
CLONE_FUN(Tone)
|
INITCOPY_FUN(Tone)
|
||||||
CLONE_FUN(Color)
|
INITCOPY_FUN(Color)
|
||||||
CLONE_FUN(Rect)
|
INITCOPY_FUN(Rect)
|
||||||
|
|
||||||
#define MRB_ATTR_R(Class, attr) mrb_define_method(mrb, klass, #attr, Class##Get_##attr, MRB_ARGS_NONE())
|
#define MRB_ATTR_R(Class, Attr, sym) mrb_define_method(mrb, klass, sym, Class##Get##Attr, MRB_ARGS_NONE())
|
||||||
#define MRB_ATTR_W(Class, attr) mrb_define_method(mrb, klass, #attr "=", Class##Set_##attr, MRB_ARGS_REQ(1))
|
#define MRB_ATTR_W(Class, Attr, sym) mrb_define_method(mrb, klass, sym "=", Class##Set##Attr, MRB_ARGS_REQ(1))
|
||||||
#define MRB_ATTR_RW(Class, attr) { MRB_ATTR_R(Class, attr); MRB_ATTR_W(Class, attr); }
|
#define MRB_ATTR_RW(Class, Attr, sym) { MRB_ATTR_R(Class, Attr, sym); MRB_ATTR_W(Class, Attr, sym); }
|
||||||
|
|
||||||
#define MRB_ATTR_RW_A(Class, attr, alias) \
|
|
||||||
{ \
|
|
||||||
mrb_define_method(mrb, klass, #alias, Class##Get_##attr, MRB_ARGS_NONE()); \
|
|
||||||
mrb_define_method(mrb, klass, #alias "=", Class##Set_##attr, MRB_ARGS_REQ(1)); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INIT_BIND(Klass) \
|
#define INIT_BIND(Klass) \
|
||||||
{ \
|
{ \
|
||||||
klass = mrb_define_class(mrb, #Klass, 0); \
|
klass = defineClass(mrb, #Klass); \
|
||||||
mrb_define_class_method(mrb, klass, "_load", Klass##Load, MRB_ARGS_REQ(1)); \
|
mrb_define_class_method(mrb, klass, "_load", Klass##Load, MRB_ARGS_REQ(1)); \
|
||||||
serializableBindingInit<Klass>(mrb, klass); \
|
serializableBindingInit<Klass>(mrb, klass); \
|
||||||
mrb_define_method(mrb, klass, "initialize", Klass##Initialize, MRB_ARGS_REQ(3) | MRB_ARGS_OPT(1)); \
|
mrb_define_method(mrb, klass, "initialize", Klass##Initialize, MRB_ARGS_REQ(3) | MRB_ARGS_OPT(1)); \
|
||||||
|
mrb_define_method(mrb, klass, "initialize_copy", Klass##InitializeCopy, MRB_ARGS_REQ(1)); \
|
||||||
mrb_define_method(mrb, klass, "set", Klass##Set, MRB_ARGS_REQ(3) | MRB_ARGS_OPT(1)); \
|
mrb_define_method(mrb, klass, "set", Klass##Set, MRB_ARGS_REQ(3) | MRB_ARGS_OPT(1)); \
|
||||||
mrb_define_method(mrb, klass, "clone", Klass##Clone, MRB_ARGS_NONE()); \
|
|
||||||
mrb_define_method(mrb, klass, "==", Klass##Equal, MRB_ARGS_REQ(1)); \
|
mrb_define_method(mrb, klass, "==", Klass##Equal, MRB_ARGS_REQ(1)); \
|
||||||
mrb_define_method(mrb, klass, "to_s", Klass##Stringify, MRB_ARGS_NONE()); \
|
mrb_define_method(mrb, klass, "to_s", Klass##Stringify, MRB_ARGS_NONE()); \
|
||||||
mrb_define_method(mrb, klass, "inspect", Klass##Stringify, MRB_ARGS_NONE()); \
|
mrb_define_method(mrb, klass, "inspect", Klass##Stringify, MRB_ARGS_NONE()); \
|
||||||
|
@ -191,21 +185,21 @@ void etcBindingInit(mrb_state *mrb)
|
||||||
RClass *klass;
|
RClass *klass;
|
||||||
|
|
||||||
INIT_BIND(Color);
|
INIT_BIND(Color);
|
||||||
MRB_ATTR_RW(Color, red);
|
MRB_ATTR_RW(Color, Red, "red" );
|
||||||
MRB_ATTR_RW(Color, green);
|
MRB_ATTR_RW(Color, Green, "green");
|
||||||
MRB_ATTR_RW(Color, blue);
|
MRB_ATTR_RW(Color, Blue, "blue" );
|
||||||
MRB_ATTR_RW(Color, alpha);
|
MRB_ATTR_RW(Color, Alpha, "alpha");
|
||||||
|
|
||||||
INIT_BIND(Tone);
|
INIT_BIND(Tone);
|
||||||
MRB_ATTR_RW(Tone, red);
|
MRB_ATTR_RW(Tone, Red, "red" );
|
||||||
MRB_ATTR_RW(Tone, green);
|
MRB_ATTR_RW(Tone, Green, "green");
|
||||||
MRB_ATTR_RW(Tone, blue);
|
MRB_ATTR_RW(Tone, Blue, "blue" );
|
||||||
MRB_ATTR_RW(Tone, gray);
|
MRB_ATTR_RW(Tone, Gray, "gray" );
|
||||||
|
|
||||||
INIT_BIND(Rect);
|
INIT_BIND(Rect);
|
||||||
MRB_ATTR_RW(Rect, x);
|
MRB_ATTR_RW(Rect, X, "x" );
|
||||||
MRB_ATTR_RW(Rect, y);
|
MRB_ATTR_RW(Rect, Y, "y" );
|
||||||
MRB_ATTR_RW(Rect, width);
|
MRB_ATTR_RW(Rect, Width, "width" );
|
||||||
MRB_ATTR_RW(Rect, height);
|
MRB_ATTR_RW(Rect, Height, "height");
|
||||||
mrb_define_method(mrb, klass, "empty", RectEmpty, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "empty", RectEmpty, MRB_ARGS_NONE());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
@ -30,8 +31,13 @@ DEF_TYPE(Font);
|
||||||
|
|
||||||
MRB_FUNCTION(fontDoesExist)
|
MRB_FUNCTION(fontDoesExist)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name = 0;
|
||||||
mrb_get_args(mrb, "z", &name);
|
mrb_value nameObj;
|
||||||
|
|
||||||
|
mrb_get_args(mrb, "o", &nameObj);
|
||||||
|
|
||||||
|
if (mrb_string_p(nameObj))
|
||||||
|
name = mrb_string_value_cstr(mrb, &nameObj);
|
||||||
|
|
||||||
return mrb_bool_value(Font::doesExist(name));
|
return mrb_bool_value(Font::doesExist(name));
|
||||||
}
|
}
|
||||||
|
@ -45,11 +51,35 @@ MRB_METHOD(fontInitialize)
|
||||||
|
|
||||||
Font *f = new Font(name, size);
|
Font *f = new Font(name, size);
|
||||||
|
|
||||||
setPrivateData(mrb, self, f, FontType);
|
setPrivateData(self, f, FontType);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->setColor(new Color(*f->getColor()));
|
f->initDynAttribs();
|
||||||
wrapProperty(mrb, self, f->getColor(), CScolor, ColorType);
|
|
||||||
|
wrapProperty(mrb, self, &f->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(mrb, self, &f->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
MRB_METHOD(fontInitializeCopy)
|
||||||
|
{
|
||||||
|
mrb_value origObj;
|
||||||
|
mrb_get_args(mrb, "o", &origObj);
|
||||||
|
|
||||||
|
Font *orig = getPrivateData<Font>(mrb, origObj);
|
||||||
|
Font *f = new Font(*orig);
|
||||||
|
setPrivateData(self, f, FontType);
|
||||||
|
|
||||||
|
/* Wrap property objects */
|
||||||
|
f->initDynAttribs();
|
||||||
|
|
||||||
|
wrapProperty(mrb, self, &f->getColor(), CScolor, ColorType);
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
wrapProperty(mrb, self, &f->getOutColor(), CSout_color, ColorType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -73,13 +103,16 @@ MRB_METHOD(FontSetName)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DEF_PROP_CHK_DISP
|
template<class C>
|
||||||
#define DEF_PROP_CHK_DISP
|
static void checkDisposed(mrb_state *, mrb_value) {}
|
||||||
|
|
||||||
DEF_PROP_I(Font, Size)
|
DEF_PROP_I(Font, Size)
|
||||||
DEF_PROP_B(Font, Bold)
|
DEF_PROP_B(Font, Bold)
|
||||||
DEF_PROP_B(Font, Italic)
|
DEF_PROP_B(Font, Italic)
|
||||||
DEF_PROP_OBJ(Font, Color, Color, CScolor)
|
DEF_PROP_B(Font, Outline)
|
||||||
|
DEF_PROP_B(Font, Shadow)
|
||||||
|
DEF_PROP_OBJ_VAL(Font, Color, Color, CScolor)
|
||||||
|
DEF_PROP_OBJ_VAL(Font, Color, OutColor, CSout_color)
|
||||||
|
|
||||||
#define DEF_KLASS_PROP(Klass, mrb_type, PropName, arg_type, conv_t) \
|
#define DEF_KLASS_PROP(Klass, mrb_type, PropName, arg_type, conv_t) \
|
||||||
static mrb_value \
|
static mrb_value \
|
||||||
|
@ -96,9 +129,11 @@ DEF_PROP_OBJ(Font, Color, Color, CScolor)
|
||||||
return mrb_##conv_t##_value(value); \
|
return mrb_##conv_t##_value(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_KLASS_PROP(Font, mrb_int, DefaultSize, "i", fixnum)
|
DEF_KLASS_PROP(Font, mrb_int, DefaultSize, "i", fixnum)
|
||||||
DEF_KLASS_PROP(Font, mrb_bool, DefaultBold, "b", bool)
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultBold, "b", bool)
|
||||||
DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool)
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool)
|
||||||
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultOutline, "b", bool)
|
||||||
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultShadow, "b", bool)
|
||||||
|
|
||||||
MRB_FUNCTION(FontGetDefaultName)
|
MRB_FUNCTION(FontGetDefaultName)
|
||||||
{
|
{
|
||||||
|
@ -122,13 +157,33 @@ MRB_METHOD(FontGetDefaultColor)
|
||||||
|
|
||||||
MRB_METHOD(FontSetDefaultColor)
|
MRB_METHOD(FontSetDefaultColor)
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value colorObj;
|
mrb_value colorObj;
|
||||||
mrb_get_args(mrb, "o", &colorObj);
|
mrb_get_args(mrb, "o", &colorObj);
|
||||||
|
|
||||||
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
||||||
|
|
||||||
Font::setDefaultColor(c);
|
Font::setDefaultColor(*c);
|
||||||
setProperty(mrb, self, CSdefault_color, colorObj);
|
|
||||||
|
return colorObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
MRB_METHOD(FontGetDefaultOutColor)
|
||||||
|
{
|
||||||
|
return getProperty(mrb, self, CSdefault_out_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
MRB_METHOD(FontSetDefaultOutColor)
|
||||||
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
mrb_value colorObj;
|
||||||
|
mrb_get_args(mrb, "o", &colorObj);
|
||||||
|
|
||||||
|
Color *c = getPrivateDataCheck<Color>(mrb, colorObj, ColorType);
|
||||||
|
|
||||||
|
Font::setDefaultOutColor(*c);
|
||||||
|
|
||||||
return colorObj;
|
return colorObj;
|
||||||
}
|
}
|
||||||
|
@ -142,26 +197,50 @@ MRB_METHOD(FontSetDefaultColor)
|
||||||
void
|
void
|
||||||
fontBindingInit(mrb_state *mrb)
|
fontBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Font", 0);
|
RClass *klass = defineClass(mrb, "Font");
|
||||||
|
|
||||||
Font::setDefaultColor(new Color(*Font::getDefaultColor()));
|
Font::initDefaultDynAttribs();
|
||||||
wrapProperty(mrb, mrb_obj_value(klass), Font::getDefaultColor(), CSdefault_color, ColorType);
|
wrapProperty(mrb, mrb_obj_value(klass), &Font::getDefaultColor(), CSdefault_color, ColorType);
|
||||||
|
|
||||||
mrb_define_class_method(mrb, klass, "exist?", fontDoesExist, MRB_ARGS_REQ(1));
|
mrb_define_class_method(mrb, klass, "exist?", fontDoesExist, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultBold, "default_bold");
|
INIT_KLASS_PROP_BIND(Font, DefaultBold, "default_bold");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic");
|
INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic");
|
||||||
INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color");
|
INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color");
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "initialize", fontInitialize, MRB_ARGS_OPT(2));
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
INIT_KLASS_PROP_BIND(Font, DefaultShadow, "default_shadow");
|
||||||
|
}
|
||||||
|
|
||||||
INIT_PROP_BIND(Font, Name, "name");
|
if (rgssVer >= 3)
|
||||||
INIT_PROP_BIND(Font, Size, "size");
|
{
|
||||||
INIT_PROP_BIND(Font, Bold, "bold");
|
INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline");
|
||||||
INIT_PROP_BIND(Font, Italic, "italic");
|
INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color");
|
||||||
INIT_PROP_BIND(Font, Color, "color");
|
wrapProperty(mrb, mrb_obj_value(klass), &Font::getDefaultOutColor(), CSdefault_out_color, ColorType);
|
||||||
|
}
|
||||||
|
|
||||||
|
mrb_define_method(mrb, klass, "initialize", fontInitialize, MRB_ARGS_OPT(2));
|
||||||
|
mrb_define_method(mrb, klass, "initialize_copy", fontInitializeCopy, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
|
INIT_PROP_BIND(Font, Name, "name");
|
||||||
|
INIT_PROP_BIND(Font, Size, "size");
|
||||||
|
INIT_PROP_BIND(Font, Bold, "bold");
|
||||||
|
INIT_PROP_BIND(Font, Italic, "italic");
|
||||||
|
INIT_PROP_BIND(Font, Color, "color");
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND(Font, Shadow, "shadow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
INIT_PROP_BIND(Font, Outline, "outline");
|
||||||
|
INIT_PROP_BIND(Font, OutColor, "out_color");
|
||||||
|
}
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -45,7 +45,7 @@ MRB_FUNCTION(graphicsFreeze)
|
||||||
MRB_FUNCTION(graphicsTransition)
|
MRB_FUNCTION(graphicsTransition)
|
||||||
{
|
{
|
||||||
mrb_int duration = 8;
|
mrb_int duration = 8;
|
||||||
const char *filename = 0;
|
const char *filename = "";
|
||||||
mrb_int vague = 40;
|
mrb_int vague = 40;
|
||||||
|
|
||||||
mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
|
mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,10 @@
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <mruby/hash.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
MRB_FUNCTION(inputUpdate)
|
MRB_FUNCTION(inputUpdate)
|
||||||
{
|
{
|
||||||
|
@ -33,34 +37,59 @@ MRB_FUNCTION(inputUpdate)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_FUNCTION(inputPress)
|
static mrb_int getButtonArg(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
mrb_int num;
|
mrb_int num;
|
||||||
mrb_get_args(mrb, "i", &num);
|
mrb_value arg;
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
mrb_get_args(mrb, "o", &arg);
|
||||||
|
|
||||||
return mrb_bool_value(shState->input().isPressed(bc));
|
if (mrb_fixnum_p(arg))
|
||||||
|
{
|
||||||
|
num = mrb_fixnum(arg);
|
||||||
|
}
|
||||||
|
else if (mrb_symbol_p(arg) && rgssVer >= 3)
|
||||||
|
{
|
||||||
|
mrb_value symHash = getMrbData(mrb)->buttoncodeHash;
|
||||||
|
mrb_value numVal = mrb_hash_fetch(mrb, symHash, arg,
|
||||||
|
mrb_fixnum_value(Input::None));
|
||||||
|
num = mrb_fixnum(numVal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: RMXP allows only few more types that
|
||||||
|
// don't make sense (symbols in pre 3, floats)
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_FUNCTION(inputTrigger)
|
MRB_METHOD(inputPress)
|
||||||
{
|
{
|
||||||
mrb_int num;
|
MRB_UNUSED_PARAM;
|
||||||
mrb_get_args(mrb, "i", &num);
|
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
mrb_int num = getButtonArg(mrb);
|
||||||
|
|
||||||
return mrb_bool_value(shState->input().isTriggered(bc));
|
return mrb_bool_value(shState->input().isPressed(num));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_FUNCTION(inputRepeat)
|
MRB_METHOD(inputTrigger)
|
||||||
{
|
{
|
||||||
mrb_int num;
|
MRB_UNUSED_PARAM;
|
||||||
mrb_get_args(mrb, "i", &num);
|
|
||||||
|
|
||||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
mrb_int num = getButtonArg(mrb);
|
||||||
|
|
||||||
return mrb_bool_value(shState->input().isRepeated(bc));
|
return mrb_bool_value(shState->input().isTriggered(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
MRB_METHOD(inputRepeat)
|
||||||
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
|
mrb_int num = getButtonArg(mrb);
|
||||||
|
|
||||||
|
return mrb_bool_value(shState->input().isRepeated(num));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_FUNCTION(inputDir4)
|
MRB_FUNCTION(inputDir4)
|
||||||
|
@ -92,8 +121,43 @@ MRB_FUNCTION(inputMouseY)
|
||||||
return mrb_fixnum_value(shState->input().mouseY());
|
return mrb_fixnum_value(shState->input().mouseY());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_CONST_I(name, value) \
|
struct
|
||||||
mrb_const_set(mrb, mrb_obj_value(module), mrb_intern_lit(mrb, name), mrb_fixnum_value(value))
|
{
|
||||||
|
const char *str;
|
||||||
|
Input::ButtonCode val;
|
||||||
|
}
|
||||||
|
static buttonCodes[] =
|
||||||
|
{
|
||||||
|
{ "DOWN", Input::Down },
|
||||||
|
{ "LEFT", Input::Left },
|
||||||
|
{ "RIGHT", Input::Right },
|
||||||
|
{ "UP", Input::Up },
|
||||||
|
|
||||||
|
{ "A", Input::A },
|
||||||
|
{ "B", Input::B },
|
||||||
|
{ "C", Input::C },
|
||||||
|
{ "X", Input::X },
|
||||||
|
{ "Y", Input::Y },
|
||||||
|
{ "Z", Input::Z },
|
||||||
|
{ "L", Input::L },
|
||||||
|
{ "R", Input::R },
|
||||||
|
|
||||||
|
{ "SHIFT", Input::Shift },
|
||||||
|
{ "CTRL", Input::Ctrl },
|
||||||
|
{ "ALT", Input::Alt },
|
||||||
|
|
||||||
|
{ "F5", Input::F5 },
|
||||||
|
{ "F6", Input::F6 },
|
||||||
|
{ "F7", Input::F7 },
|
||||||
|
{ "F8", Input::F8 },
|
||||||
|
{ "F9", Input::F9 },
|
||||||
|
|
||||||
|
{ "MOUSELEFT", Input::MouseLeft },
|
||||||
|
{ "MOUSEMIDDLE", Input::MouseMiddle },
|
||||||
|
{ "MOUSERIGHT", Input::MouseRight }
|
||||||
|
};
|
||||||
|
|
||||||
|
static elementsN(buttonCodes);
|
||||||
|
|
||||||
void
|
void
|
||||||
inputBindingInit(mrb_state *mrb)
|
inputBindingInit(mrb_state *mrb)
|
||||||
|
@ -107,34 +171,40 @@ inputBindingInit(mrb_state *mrb)
|
||||||
mrb_define_module_function(mrb, module, "dir4", inputDir4, MRB_ARGS_NONE());
|
mrb_define_module_function(mrb, module, "dir4", inputDir4, MRB_ARGS_NONE());
|
||||||
mrb_define_module_function(mrb, module, "dir8", inputDir8, MRB_ARGS_NONE());
|
mrb_define_module_function(mrb, module, "dir8", inputDir8, MRB_ARGS_NONE());
|
||||||
|
|
||||||
DEF_CONST_I("DOWN", Input::Down );
|
|
||||||
DEF_CONST_I("LEFT", Input::Left );
|
|
||||||
DEF_CONST_I("RIGHT", Input::Right);
|
|
||||||
DEF_CONST_I("UP", Input::Up );
|
|
||||||
|
|
||||||
DEF_CONST_I("A", Input::A );
|
|
||||||
DEF_CONST_I("B", Input::B );
|
|
||||||
DEF_CONST_I("C", Input::C );
|
|
||||||
DEF_CONST_I("X", Input::X );
|
|
||||||
DEF_CONST_I("Y", Input::Y );
|
|
||||||
DEF_CONST_I("Z", Input::Z );
|
|
||||||
DEF_CONST_I("L", Input::L );
|
|
||||||
DEF_CONST_I("R", Input::R );
|
|
||||||
|
|
||||||
DEF_CONST_I("SHIFT", Input::Shift);
|
|
||||||
DEF_CONST_I("CTRL", Input::Ctrl );
|
|
||||||
DEF_CONST_I("ALT", Input::Alt );
|
|
||||||
|
|
||||||
DEF_CONST_I("F5", Input::F5 );
|
|
||||||
DEF_CONST_I("F6", Input::F6 );
|
|
||||||
DEF_CONST_I("F7", Input::F7 );
|
|
||||||
DEF_CONST_I("F8", Input::F8 );
|
|
||||||
DEF_CONST_I("F9", Input::F9 );
|
|
||||||
|
|
||||||
mrb_define_module_function(mrb, module, "mouse_x", inputMouseX, MRB_ARGS_NONE());
|
mrb_define_module_function(mrb, module, "mouse_x", inputMouseX, MRB_ARGS_NONE());
|
||||||
mrb_define_module_function(mrb, module, "mouse_y", inputMouseY, MRB_ARGS_NONE());
|
mrb_define_module_function(mrb, module, "mouse_y", inputMouseY, MRB_ARGS_NONE());
|
||||||
|
|
||||||
DEF_CONST_I("MOUSELEFT", Input::MouseLeft );
|
mrb_value modVal = mrb_obj_value(module);
|
||||||
DEF_CONST_I("MOUSEMIDDLE", Input::MouseMiddle);
|
|
||||||
DEF_CONST_I("MOUSERIGHT", Input::MouseRight );
|
if (rgssVer >= 3)
|
||||||
|
{
|
||||||
|
mrb_value symHash = mrb_hash_new_capa(mrb, buttonCodesN);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||||
|
{
|
||||||
|
const char *str = buttonCodes[i].str;
|
||||||
|
mrb_sym sym = mrb_intern_static(mrb, str, strlen(str));
|
||||||
|
mrb_value symVal = mrb_symbol_value(sym);
|
||||||
|
mrb_value val = mrb_fixnum_value(buttonCodes[i].val);
|
||||||
|
|
||||||
|
/* In RGSS3 all Input::XYZ constants are equal to :XYZ symbols,
|
||||||
|
* to be compatible with the previous convention */
|
||||||
|
mrb_const_set(mrb, modVal, sym, symVal);
|
||||||
|
mrb_hash_set(mrb, symHash, symVal, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
mrb_iv_set(mrb, modVal, mrb_intern_lit(mrb, "buttoncodes"), symHash);
|
||||||
|
getMrbData(mrb)->buttoncodeHash = symHash;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < buttonCodesN; ++i)
|
||||||
|
{
|
||||||
|
const char *str = buttonCodes[i].str;
|
||||||
|
mrb_sym sym = mrb_intern_static(mrb, str, strlen(str));
|
||||||
|
mrb_value val = mrb_fixnum_value(buttonCodes[i].val);
|
||||||
|
|
||||||
|
mrb_const_set(mrb, modVal, sym, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -227,7 +227,7 @@ MRB_FUNCTION(fileExpandPath)
|
||||||
if (defDir)
|
if (defDir)
|
||||||
Debug() << "FIXME: File.expand_path: default_dir not implemented";
|
Debug() << "FIXME: File.expand_path: default_dir not implemented";
|
||||||
|
|
||||||
char buffer[512];
|
char buffer[PATH_MAX];
|
||||||
char *unused = realpath(path, buffer);
|
char *unused = realpath(path, buffer);
|
||||||
(void) unused;
|
(void) unused;
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ readLine(FILE *f, std::vector<char> &buffer)
|
||||||
if (feof(f))
|
if (feof(f))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
char c = fgetc(f);
|
int c = fgetc(f);
|
||||||
|
|
||||||
if (c == '\n' || c == EOF)
|
if (c == '\n' || c == EOF)
|
||||||
break;
|
break;
|
||||||
|
@ -568,7 +568,7 @@ fileBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
mrb_define_method(mrb, mrb->kernel_module, "open", fileOpen, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1) | MRB_ARGS_BLOCK());
|
mrb_define_method(mrb, mrb->kernel_module, "open", fileOpen, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1) | MRB_ARGS_BLOCK());
|
||||||
|
|
||||||
RClass *klass = mrb_define_class(mrb, "IO", 0);
|
RClass *klass = defineClass(mrb, "IO");
|
||||||
klass = mrb_define_class(mrb, "File", klass);
|
klass = mrb_define_class(mrb, "File", klass);
|
||||||
|
|
||||||
mrb_define_class_method(mrb, klass, "basename", fileBasename, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
|
mrb_define_class_method(mrb, klass, "basename", fileBasename, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(1));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -114,7 +114,7 @@ struct LinkBuffer
|
||||||
return hash.contains(value);
|
return hash.contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool containsIdx(int idx)
|
bool containsIdx(size_t idx)
|
||||||
{
|
{
|
||||||
if (vec.empty())
|
if (vec.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,7 +132,7 @@ struct LinkBuffer
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
T lookup(int idx)
|
T lookup(size_t idx)
|
||||||
{
|
{
|
||||||
return vec[idx];
|
return vec[idx];
|
||||||
}
|
}
|
||||||
|
@ -153,9 +153,9 @@ struct MarshalContext
|
||||||
LinkBuffer<mrb_sym> symbols;
|
LinkBuffer<mrb_sym> symbols;
|
||||||
LinkBuffer<mrb_value> objects;
|
LinkBuffer<mrb_value> objects;
|
||||||
|
|
||||||
char readByte()
|
int8_t readByte()
|
||||||
{
|
{
|
||||||
char byte;
|
int8_t byte;
|
||||||
int result = SDL_RWread(ops, &byte, 1, 1);
|
int result = SDL_RWread(ops, &byte, 1, 1);
|
||||||
|
|
||||||
if (result < 1)
|
if (result < 1)
|
||||||
|
@ -172,7 +172,7 @@ struct MarshalContext
|
||||||
throw Exception(Exception::ArgumentError, "dump format error");
|
throw Exception(Exception::ArgumentError, "dump format error");
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeByte(char byte)
|
void writeByte(int8_t byte)
|
||||||
{
|
{
|
||||||
int result = SDL_RWwrite(ops, &byte, 1, 1);
|
int result = SDL_RWwrite(ops, &byte, 1, 1);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ struct MarshalContext
|
||||||
static int
|
static int
|
||||||
read_fixnum(MarshalContext *ctx)
|
read_fixnum(MarshalContext *ctx)
|
||||||
{
|
{
|
||||||
char head = ctx->readByte();
|
int8_t head = ctx->readByte();
|
||||||
|
|
||||||
if (head == 0)
|
if (head == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -202,10 +202,10 @@ read_fixnum(MarshalContext *ctx)
|
||||||
else if (head < -4)
|
else if (head < -4)
|
||||||
return head + 5;
|
return head + 5;
|
||||||
|
|
||||||
int pos = (head > 0);
|
int8_t pos = (head > 0);
|
||||||
int len = pos ? head : head * -1;
|
int8_t len = pos ? head : head * -1;
|
||||||
|
|
||||||
char n1, n2, n3, n4;
|
int8_t n1, n2, n3, n4;
|
||||||
|
|
||||||
if (pos)
|
if (pos)
|
||||||
n2 = n3 = n4 = 0;
|
n2 = n3 = n4 = 0;
|
||||||
|
@ -259,21 +259,13 @@ read_string_value(MarshalContext *ctx)
|
||||||
mrb_state *mrb = ctx->mrb;
|
mrb_state *mrb = ctx->mrb;
|
||||||
int len = read_fixnum(ctx);
|
int len = read_fixnum(ctx);
|
||||||
|
|
||||||
struct RString *str =
|
mrb_value str = mrb_str_new(mrb, 0, len);
|
||||||
(struct RString*) mrb_obj_alloc
|
char *ptr = RSTR_PTR(RSTRING(str));
|
||||||
(mrb, MRB_TT_STRING, mrb->string_class);
|
|
||||||
|
|
||||||
str->c = mrb->string_class;
|
ctx->readData(ptr, len);
|
||||||
str->len = len;
|
ptr[len] = '\0';
|
||||||
str->aux.capa = len;
|
|
||||||
str->ptr = (char*) mrb_malloc(mrb, len+1);
|
|
||||||
|
|
||||||
ctx->readData(str->ptr, len);
|
return str;
|
||||||
str->ptr[len] = '\0';
|
|
||||||
|
|
||||||
mrb_value str_obj = mrb_obj_value(str);
|
|
||||||
|
|
||||||
return str_obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value read_value(MarshalContext *ctx);
|
static mrb_value read_value(MarshalContext *ctx);
|
||||||
|
@ -479,7 +471,7 @@ static mrb_value
|
||||||
read_value(MarshalContext *ctx)
|
read_value(MarshalContext *ctx)
|
||||||
{
|
{
|
||||||
mrb_state *mrb = ctx->mrb;
|
mrb_state *mrb = ctx->mrb;
|
||||||
char type = ctx->readByte();
|
int8_t type = ctx->readByte();
|
||||||
mrb_value value;
|
mrb_value value;
|
||||||
if (mrb->arena_idx > maxArena)
|
if (mrb->arena_idx > maxArena)
|
||||||
maxArena = mrb->arena_idx;
|
maxArena = mrb->arena_idx;
|
||||||
|
@ -567,16 +559,16 @@ write_fixnum(MarshalContext *ctx, int value)
|
||||||
}
|
}
|
||||||
else if (value > 0 && value < 123)
|
else if (value > 0 && value < 123)
|
||||||
{
|
{
|
||||||
ctx->writeByte((char) value + 5);
|
ctx->writeByte((int8_t) value + 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (value < 0 && value > -124)
|
else if (value < 0 && value > -124)
|
||||||
{
|
{
|
||||||
ctx->writeByte((char) value - 5);
|
ctx->writeByte((int8_t) value - 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char len;
|
int8_t len;
|
||||||
|
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
{
|
{
|
||||||
|
@ -724,7 +716,7 @@ write_symbol(MarshalContext *ctx, mrb_value symbol)
|
||||||
{
|
{
|
||||||
mrb_state *mrb = ctx->mrb;
|
mrb_state *mrb = ctx->mrb;
|
||||||
mrb_sym sym = mrb_symbol(symbol);
|
mrb_sym sym = mrb_symbol(symbol);
|
||||||
size_t len;
|
mrb_int len;
|
||||||
const char *p = mrb_sym2name_len(mrb, sym, &len);
|
const char *p = mrb_sym2name_len(mrb, sym, &len);
|
||||||
|
|
||||||
write_string(ctx, p);
|
write_string(ctx, p);
|
||||||
|
@ -883,8 +875,8 @@ writeMarshalHeader(MarshalContext *ctx)
|
||||||
static void
|
static void
|
||||||
verifyMarshalHeader(MarshalContext *ctx)
|
verifyMarshalHeader(MarshalContext *ctx)
|
||||||
{
|
{
|
||||||
char maj = ctx->readByte();
|
int8_t maj = ctx->readByte();
|
||||||
char min = ctx->readByte();
|
int8_t min = ctx->readByte();
|
||||||
|
|
||||||
if (maj != MARSHAL_MAJOR || min != MARSHAL_MINOR)
|
if (maj != MARSHAL_MAJOR || min != MARSHAL_MINOR)
|
||||||
throw Exception(Exception::TypeError, "incompatible marshal file format (can't be read)");
|
throw Exception(Exception::TypeError, "incompatible marshal file format (can't be read)");
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rwmem.h"
|
#include "rwmem.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <SDL_rwops.h>
|
#include <SDL_rwops.h>
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ int RWMemGetData(SDL_RWops *ops, void *buffer)
|
||||||
ByteVec *v = getRWPrivate(ops);
|
ByteVec *v = getRWPrivate(ops);
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
memcpy(buffer, &(*v)[0], v->size());
|
memcpy(buffer, dataPtr(*v), v->size());
|
||||||
|
|
||||||
return v->size();
|
return v->size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -197,8 +197,8 @@ TIME_ATTR(wday)
|
||||||
void
|
void
|
||||||
timeBindingInit(mrb_state *mrb)
|
timeBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Time", 0);
|
RClass *klass = defineClass(mrb, "Time");
|
||||||
mrb_include_module(mrb, klass, mrb_class_get(mrb, "Comparable"));
|
mrb_include_module(mrb, klass, mrb_module_get(mrb, "Comparable"));
|
||||||
|
|
||||||
mrb_define_class_method(mrb, klass, "now", timeNow, MRB_ARGS_NONE());
|
mrb_define_class_method(mrb, klass, "now", timeNow, MRB_ARGS_NONE());
|
||||||
mrb_define_class_method(mrb, klass, "at", timeAt, MRB_ARGS_REQ(1));
|
mrb_define_class_method(mrb, klass, "at", timeAt, MRB_ARGS_REQ(1));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,23 +31,19 @@ MRB_METHOD(planeInitialize)
|
||||||
{
|
{
|
||||||
Plane *p = viewportElementInitialize<Plane>(mrb, self);
|
Plane *p = viewportElementInitialize<Plane>(mrb, self);
|
||||||
|
|
||||||
setPrivateData(mrb, self, p, PlaneType);
|
setPrivateData(self, p, PlaneType);
|
||||||
|
|
||||||
p->setColor(new Color);
|
p->initDynAttribs();
|
||||||
p->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapNilProperty(mrb, self, CSbitmap);
|
wrapProperty(mrb, self, &p->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, p->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &p->getTone(), CStone, ToneType);
|
||||||
wrapProperty(mrb, self, p->getTone(), CStone, ToneType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "plane"
|
DEF_PROP_OBJ_REF(Plane, Bitmap, Bitmap, CSbitmap)
|
||||||
|
DEF_PROP_OBJ_VAL(Plane, Color, Color, CScolor)
|
||||||
DEF_PROP_OBJ(Plane, Bitmap, Bitmap, CSbitmap)
|
DEF_PROP_OBJ_VAL(Plane, Tone, Tone, CStone)
|
||||||
DEF_PROP_OBJ(Plane, Color, Color, CScolor)
|
|
||||||
DEF_PROP_OBJ(Plane, Tone, Tone, CStone)
|
|
||||||
|
|
||||||
DEF_PROP_I(Plane, OX)
|
DEF_PROP_I(Plane, OX)
|
||||||
DEF_PROP_I(Plane, OY)
|
DEF_PROP_I(Plane, OY)
|
||||||
|
@ -61,7 +57,7 @@ DEF_PROP_F(Plane, ZoomY)
|
||||||
void
|
void
|
||||||
planeBindingInit(mrb_state *mrb)
|
planeBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Plane", 0);
|
RClass *klass = defineClass(mrb, "Plane");
|
||||||
|
|
||||||
disposableBindingInit<Plane> (mrb, klass);
|
disposableBindingInit<Plane> (mrb, klass);
|
||||||
viewportElementBindingInit<Plane>(mrb, klass);
|
viewportElementBindingInit<Plane>(mrb, klass);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "sharedstate.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
#include "flashable-binding.h"
|
#include "flashable-binding.h"
|
||||||
#include "sceneelement-binding.h"
|
#include "sceneelement-binding.h"
|
||||||
|
@ -32,27 +33,22 @@ MRB_METHOD(spriteInitialize)
|
||||||
{
|
{
|
||||||
Sprite *s = viewportElementInitialize<Sprite>(mrb, self);
|
Sprite *s = viewportElementInitialize<Sprite>(mrb, self);
|
||||||
|
|
||||||
setPrivateData(mrb, self, s, SpriteType);
|
setPrivateData(self, s, SpriteType);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
s->setSrcRect(new Rect);
|
s->initDynAttribs();
|
||||||
s->setColor(new Color);
|
|
||||||
s->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapNilProperty(mrb, self, CSbitmap);
|
wrapProperty(mrb, self, &s->getSrcRect(), CSsrc_rect, RectType);
|
||||||
wrapProperty(mrb, self, s->getSrcRect(), CSsrc_rect, RectType);
|
wrapProperty(mrb, self, &s->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, s->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &s->getTone(), CStone, ToneType);
|
||||||
wrapProperty(mrb, self, s->getTone(), CStone, ToneType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "sprite"
|
DEF_PROP_OBJ_REF(Sprite, Bitmap, Bitmap, CSbitmap)
|
||||||
|
DEF_PROP_OBJ_VAL(Sprite, Rect, SrcRect, CSsrc_rect)
|
||||||
DEF_PROP_OBJ_NIL(Sprite, Bitmap, Bitmap, CSbitmap)
|
DEF_PROP_OBJ_VAL(Sprite, Color, Color, CScolor)
|
||||||
DEF_PROP_OBJ(Sprite, Rect, SrcRect, CSsrc_rect)
|
DEF_PROP_OBJ_VAL(Sprite, Tone, Tone, CStone)
|
||||||
DEF_PROP_OBJ(Sprite, Color, Color, CScolor)
|
|
||||||
DEF_PROP_OBJ(Sprite, Tone, Tone, CStone)
|
|
||||||
|
|
||||||
DEF_PROP_I(Sprite, X)
|
DEF_PROP_I(Sprite, X)
|
||||||
DEF_PROP_I(Sprite, Y)
|
DEF_PROP_I(Sprite, Y)
|
||||||
|
@ -61,17 +57,41 @@ DEF_PROP_I(Sprite, OY)
|
||||||
DEF_PROP_I(Sprite, BushDepth)
|
DEF_PROP_I(Sprite, BushDepth)
|
||||||
DEF_PROP_I(Sprite, Opacity)
|
DEF_PROP_I(Sprite, Opacity)
|
||||||
DEF_PROP_I(Sprite, BlendType)
|
DEF_PROP_I(Sprite, BlendType)
|
||||||
|
DEF_PROP_I(Sprite, WaveAmp)
|
||||||
|
DEF_PROP_I(Sprite, WaveLength)
|
||||||
|
DEF_PROP_I(Sprite, WaveSpeed)
|
||||||
|
|
||||||
DEF_PROP_F(Sprite, ZoomX)
|
DEF_PROP_F(Sprite, ZoomX)
|
||||||
DEF_PROP_F(Sprite, ZoomY)
|
DEF_PROP_F(Sprite, ZoomY)
|
||||||
DEF_PROP_F(Sprite, Angle)
|
DEF_PROP_F(Sprite, Angle)
|
||||||
|
DEF_PROP_F(Sprite, WavePhase)
|
||||||
|
|
||||||
DEF_PROP_B(Sprite, Mirror)
|
DEF_PROP_B(Sprite, Mirror)
|
||||||
|
|
||||||
|
MRB_METHOD(spriteWidth)
|
||||||
|
{
|
||||||
|
Sprite *s = getPrivateData<Sprite>(mrb, self);
|
||||||
|
|
||||||
|
int value = 0;
|
||||||
|
GUARD_EXC( value = s->getWidth(); )
|
||||||
|
|
||||||
|
return mrb_fixnum_value(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
MRB_METHOD(spriteHeight)
|
||||||
|
{
|
||||||
|
Sprite *s = getPrivateData<Sprite>(mrb, self);
|
||||||
|
|
||||||
|
int value = 0;
|
||||||
|
GUARD_EXC( value = s->getHeight(); )
|
||||||
|
|
||||||
|
return mrb_fixnum_value(value);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spriteBindingInit(mrb_state *mrb)
|
spriteBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Sprite", 0);
|
RClass *klass = defineClass(mrb, "Sprite");
|
||||||
|
|
||||||
disposableBindingInit <Sprite>(mrb, klass);
|
disposableBindingInit <Sprite>(mrb, klass);
|
||||||
flashableBindingInit <Sprite>(mrb, klass);
|
flashableBindingInit <Sprite>(mrb, klass);
|
||||||
|
@ -95,5 +115,16 @@ spriteBindingInit(mrb_state *mrb)
|
||||||
INIT_PROP_BIND( Sprite, Color, "color" );
|
INIT_PROP_BIND( Sprite, Color, "color" );
|
||||||
INIT_PROP_BIND( Sprite, Tone, "tone" );
|
INIT_PROP_BIND( Sprite, Tone, "tone" );
|
||||||
|
|
||||||
|
if (rgssVer >= 2)
|
||||||
|
{
|
||||||
|
mrb_define_method(mrb, klass, "width", spriteWidth, MRB_ARGS_NONE());
|
||||||
|
mrb_define_method(mrb, klass, "height", spriteHeight, MRB_ARGS_NONE());
|
||||||
|
|
||||||
|
INIT_PROP_BIND( Sprite, WaveAmp, "wave_amp" );
|
||||||
|
INIT_PROP_BIND( Sprite, WaveLength, "wave_length" );
|
||||||
|
INIT_PROP_BIND( Sprite, WaveSpeed, "wave_speed" );
|
||||||
|
INIT_PROP_BIND( Sprite, WavePhase, "wave_phase" );
|
||||||
|
}
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -35,7 +35,7 @@ MRB_METHOD(tableInitialize)
|
||||||
|
|
||||||
Table *t = new Table(x, y, z);
|
Table *t = new Table(x, y, z);
|
||||||
|
|
||||||
setPrivateData(mrb, self, t, TableType);
|
setPrivateData(self, t, TableType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -141,16 +141,19 @@ MRB_METHOD(tableSetAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
MARSH_LOAD_FUN(Table)
|
MARSH_LOAD_FUN(Table)
|
||||||
|
INITCOPY_FUN(Table)
|
||||||
|
|
||||||
void
|
void
|
||||||
tableBindingInit(mrb_state *mrb)
|
tableBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Table", 0);
|
RClass *klass = defineClass(mrb, "Table");
|
||||||
|
|
||||||
mrb_define_class_method(mrb, klass, "_load", TableLoad, MRB_ARGS_REQ(1));
|
mrb_define_class_method(mrb, klass, "_load", TableLoad, MRB_ARGS_REQ(1));
|
||||||
serializableBindingInit<Table>(mrb, klass);
|
serializableBindingInit<Table>(mrb, klass);
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "initialize", tableInitialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
|
mrb_define_method(mrb, klass, "initialize", tableInitialize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
|
||||||
|
mrb_define_method(mrb, klass, "initialize_copy", TableInitializeCopy, MRB_ARGS_REQ(1));
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "resize", tableResize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
|
mrb_define_method(mrb, klass, "resize", tableResize, MRB_ARGS_REQ(1) | MRB_ARGS_OPT(2));
|
||||||
mrb_define_method(mrb, klass, "xsize", tableXSize, MRB_ARGS_NONE() );
|
mrb_define_method(mrb, klass, "xsize", tableXSize, MRB_ARGS_NONE() );
|
||||||
mrb_define_method(mrb, klass, "ysize", tableYSize, MRB_ARGS_NONE() );
|
mrb_define_method(mrb, klass, "ysize", tableYSize, MRB_ARGS_NONE() );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -87,25 +87,32 @@ MRB_METHOD(tilemapInitialize)
|
||||||
/* Construct object */
|
/* Construct object */
|
||||||
t = new Tilemap(viewport);
|
t = new Tilemap(viewport);
|
||||||
|
|
||||||
setPrivateData(mrb, self, t, TilemapType);
|
setPrivateData(self, t, TilemapType);
|
||||||
|
|
||||||
setProperty(mrb, self, CSviewport, viewportObj);
|
setProperty(mrb, self, CSviewport, viewportObj);
|
||||||
|
|
||||||
wrapProperty(mrb, self, &t->getAutotiles(), CSautotiles, TilemapAutotilesType);
|
wrapProperty(mrb, self, &t->getAutotiles(), CSautotiles, TilemapAutotilesType);
|
||||||
|
|
||||||
mrb_value autotilesObj = mrb_iv_get(mrb, self, getMrbData(mrb)->symbols[CSautotiles]);
|
MrbData &mrbData = *getMrbData(mrb);
|
||||||
|
mrb_value autotilesObj = mrb_iv_get(mrb, self, mrbData.symbols[CSautotiles]);
|
||||||
|
|
||||||
mrb_value ary = mrb_ary_new_capa(mrb, 7);
|
mrb_value ary = mrb_ary_new_capa(mrb, 7);
|
||||||
for (int i = 0; i < 7; ++i)
|
for (int i = 0; i < 7; ++i)
|
||||||
mrb_ary_push(mrb, ary, mrb_nil_value());
|
mrb_ary_push(mrb, ary, mrb_nil_value());
|
||||||
|
|
||||||
mrb_iv_set(mrb, autotilesObj, getMrbData(mrb)->symbols[CSarray], ary);
|
mrb_iv_set(mrb, autotilesObj, mrbData.symbols[CSarray], ary);
|
||||||
|
|
||||||
|
/* Circular reference so both objects are always
|
||||||
|
* alive at the same time */
|
||||||
|
mrb_iv_set(mrb, autotilesObj, mrbData.symbols[CStilemap], self);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(tilemapGetAutotiles)
|
MRB_METHOD(tilemapGetAutotiles)
|
||||||
{
|
{
|
||||||
|
checkDisposed<Tilemap>(mrb, self);
|
||||||
|
|
||||||
return getProperty(mrb, self, CSautotiles);
|
return getProperty(mrb, self, CSautotiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,21 +125,17 @@ MRB_METHOD(tilemapUpdate)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "tilemap"
|
|
||||||
|
|
||||||
MRB_METHOD(tilemapGetViewport)
|
MRB_METHOD(tilemapGetViewport)
|
||||||
{
|
{
|
||||||
Tilemap *t = getPrivateData<Tilemap>(mrb, self);
|
checkDisposed<Tilemap>(mrb, self);
|
||||||
|
|
||||||
checkDisposed(mrb, t, DISP_CLASS_NAME);
|
|
||||||
|
|
||||||
return getProperty(mrb, self, CSviewport);
|
return getProperty(mrb, self, CSviewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_PROP_OBJ(Tilemap, Bitmap, Tileset, CStileset)
|
DEF_PROP_OBJ_REF(Tilemap, Bitmap, Tileset, CStileset)
|
||||||
DEF_PROP_OBJ(Tilemap, Table, MapData, CSmap_data)
|
DEF_PROP_OBJ_REF(Tilemap, Table, MapData, CSmap_data)
|
||||||
DEF_PROP_OBJ(Tilemap, Table, FlashData, CSflash_data)
|
DEF_PROP_OBJ_REF(Tilemap, Table, FlashData, CSflash_data)
|
||||||
DEF_PROP_OBJ(Tilemap, Table, Priorities, CSpriorities)
|
DEF_PROP_OBJ_REF(Tilemap, Table, Priorities, CSpriorities)
|
||||||
|
|
||||||
DEF_PROP_B(Tilemap, Visible)
|
DEF_PROP_B(Tilemap, Visible)
|
||||||
|
|
||||||
|
@ -142,13 +145,13 @@ DEF_PROP_I(Tilemap, OY)
|
||||||
void
|
void
|
||||||
tilemapBindingInit(mrb_state *mrb)
|
tilemapBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "TilemapAutotiles", 0);
|
RClass *klass = defineClass(mrb, "TilemapAutotiles");
|
||||||
|
|
||||||
mrb_define_method(mrb, klass, "[]=", tilemapAutotilesSet, MRB_ARGS_REQ(2));
|
mrb_define_method(mrb, klass, "[]=", tilemapAutotilesSet, MRB_ARGS_REQ(2));
|
||||||
mrb_define_method(mrb, klass, "[]", tilemapAutotilesGet, MRB_ARGS_REQ(1));
|
mrb_define_method(mrb, klass, "[]", tilemapAutotilesGet, MRB_ARGS_REQ(1));
|
||||||
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE());
|
||||||
|
|
||||||
klass = mrb_define_class(mrb, "Tilemap", 0);
|
klass = defineClass(mrb, "Tilemap");
|
||||||
|
|
||||||
disposableBindingInit<Tilemap>(mrb, klass);
|
disposableBindingInit<Tilemap>(mrb, klass);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -54,25 +54,21 @@ MRB_METHOD(viewportInitialize)
|
||||||
v = new Viewport(x, y, width, height);
|
v = new Viewport(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
setPrivateData(mrb, self, v, ViewportType);
|
setPrivateData(self, v, ViewportType);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
v->setRect(new Rect(*v->getRect()));
|
v->initDynAttribs();
|
||||||
v->setColor(new Color);
|
|
||||||
v->setTone(new Tone);
|
|
||||||
|
|
||||||
wrapProperty(mrb, self, v->getRect(), CSrect, RectType);
|
wrapProperty(mrb, self, &v->getRect(), CSrect, RectType);
|
||||||
wrapProperty(mrb, self, v->getColor(), CScolor, ColorType);
|
wrapProperty(mrb, self, &v->getColor(), CScolor, ColorType);
|
||||||
wrapProperty(mrb, self, v->getTone(), CStone, ToneType);
|
wrapProperty(mrb, self, &v->getTone(), CStone, ToneType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "viewport"
|
DEF_PROP_OBJ_VAL(Viewport, Rect, Rect, CSrect)
|
||||||
|
DEF_PROP_OBJ_VAL(Viewport, Color, Color, CScolor)
|
||||||
DEF_PROP_OBJ(Viewport, Rect, Rect, CSrect)
|
DEF_PROP_OBJ_VAL(Viewport, Tone, Tone, CStone)
|
||||||
DEF_PROP_OBJ(Viewport, Color, Color, CScolor)
|
|
||||||
DEF_PROP_OBJ(Viewport, Tone, Tone, CStone)
|
|
||||||
|
|
||||||
DEF_PROP_I(Viewport, OX)
|
DEF_PROP_I(Viewport, OX)
|
||||||
DEF_PROP_I(Viewport, OY)
|
DEF_PROP_I(Viewport, OY)
|
||||||
|
@ -81,7 +77,7 @@ DEF_PROP_I(Viewport, OY)
|
||||||
void
|
void
|
||||||
viewportBindingInit(mrb_state *mrb)
|
viewportBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Viewport", 0);
|
RClass *klass = defineClass(mrb, "Viewport");
|
||||||
|
|
||||||
disposableBindingInit <Viewport>(mrb, klass);
|
disposableBindingInit <Viewport>(mrb, klass);
|
||||||
flashableBindingInit <Viewport>(mrb, klass);
|
flashableBindingInit <Viewport>(mrb, klass);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,13 +27,12 @@
|
||||||
#include "binding-types.h"
|
#include "binding-types.h"
|
||||||
|
|
||||||
#include "sceneelement-binding.h"
|
#include "sceneelement-binding.h"
|
||||||
|
#include "disposable-binding.h"
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
MRB_METHOD(viewportElementGetViewport)
|
MRB_METHOD(viewportElementGetViewport)
|
||||||
{
|
{
|
||||||
ViewportElement *ve = getPrivateData<C>(mrb, self);
|
checkDisposed<C>(mrb, self);
|
||||||
|
|
||||||
GUARD_EXC( ve->aboutToAccess(); )
|
|
||||||
|
|
||||||
return getProperty(mrb, self, CSviewport);
|
return getProperty(mrb, self, CSviewport);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +48,13 @@ viewportElementInitialize(mrb_state *mrb, mrb_value self)
|
||||||
mrb_get_args(mrb, "|o", &viewportObj);
|
mrb_get_args(mrb, "|o", &viewportObj);
|
||||||
|
|
||||||
if (!mrb_nil_p(viewportObj))
|
if (!mrb_nil_p(viewportObj))
|
||||||
|
{
|
||||||
viewport = getPrivateDataCheck<Viewport>(mrb, viewportObj, ViewportType);
|
viewport = getPrivateDataCheck<Viewport>(mrb, viewportObj, ViewportType);
|
||||||
|
|
||||||
|
if (rgssVer == 1)
|
||||||
|
disposableAddChild(mrb, viewportObj, self);
|
||||||
|
}
|
||||||
|
|
||||||
/* Construct object */
|
/* Construct object */
|
||||||
C *ve = new C(viewport);
|
C *ve = new C(viewport);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -30,12 +30,10 @@ MRB_METHOD(windowInitialize)
|
||||||
{
|
{
|
||||||
Window *w = viewportElementInitialize<Window>(mrb, self);
|
Window *w = viewportElementInitialize<Window>(mrb, self);
|
||||||
|
|
||||||
setPrivateData(mrb, self, w, WindowType);
|
setPrivateData(self, w, WindowType);
|
||||||
|
|
||||||
w->setCursorRect(new Rect);
|
w->initDynAttribs();
|
||||||
wrapNilProperty(mrb, self, CSwindowskin);
|
wrapProperty(mrb, self, &w->getCursorRect(), CScursor_rect, RectType);
|
||||||
wrapNilProperty(mrb, self, CScontents);
|
|
||||||
wrapProperty(mrb, self, w->getCursorRect(), CScursor_rect, RectType);
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -49,11 +47,9 @@ MRB_METHOD(windowUpdate)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISP_CLASS_NAME "window"
|
DEF_PROP_OBJ_REF(Window, Bitmap, Windowskin, CSwindowskin)
|
||||||
|
DEF_PROP_OBJ_REF(Window, Bitmap, Contents, CScontents)
|
||||||
DEF_PROP_OBJ_NIL(Window, Bitmap, Windowskin, CSwindowskin)
|
DEF_PROP_OBJ_VAL(Window, Rect, CursorRect, CScursor_rect)
|
||||||
DEF_PROP_OBJ_NIL(Window, Bitmap, Contents, CScontents)
|
|
||||||
DEF_PROP_OBJ(Window, Rect, CursorRect, CScursor_rect)
|
|
||||||
|
|
||||||
DEF_PROP_B(Window, Stretch)
|
DEF_PROP_B(Window, Stretch)
|
||||||
DEF_PROP_B(Window, Active)
|
DEF_PROP_B(Window, Active)
|
||||||
|
@ -73,7 +69,7 @@ DEF_PROP_I(Window, ContentsOpacity)
|
||||||
void
|
void
|
||||||
windowBindingInit(mrb_state *mrb)
|
windowBindingInit(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
RClass *klass = mrb_define_class(mrb, "Window", 0);
|
RClass *klass = defineClass(mrb, "Window");
|
||||||
|
|
||||||
disposableBindingInit <Window>(mrb, klass);
|
disposableBindingInit <Window>(mrb, klass);
|
||||||
viewportElementBindingInit<Window>(mrb, klass);
|
viewportElementBindingInit<Window>(mrb, klass);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
static void nullBindingExecute()
|
static void nullBindingExecute()
|
||||||
{
|
{
|
||||||
Debug() << "The null binding doesn't do anything, so we're done!";
|
Debug() << "The null binding doesn't do anything, so we're done!";
|
||||||
shState->rtData().rqTermAck = true;
|
shState->rtData().rqTermAck.set();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nullBindingTerminate()
|
static void nullBindingTerminate()
|
||||||
|
@ -35,10 +35,16 @@ static void nullBindingTerminate()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nullBindingReset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ScriptBinding scriptBindingImpl =
|
ScriptBinding scriptBindingImpl =
|
||||||
{
|
{
|
||||||
nullBindingExecute,
|
nullBindingExecute,
|
||||||
nullBindingTerminate
|
nullBindingTerminate,
|
||||||
|
nullBindingReset
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
ScriptBinding *scriptBinding = &scriptBindingImpl;
|
||||||
|
|
199
mkxp.conf.sample
199
mkxp.conf.sample
|
@ -1,4 +1,24 @@
|
||||||
# Lines starting with '#' are comments
|
# Lines starting with '#' are comments.
|
||||||
|
#
|
||||||
|
# About filesystem paths specified in this config:
|
||||||
|
# The "gameFolder" path is resolved either relative
|
||||||
|
# to the directory containing the mkxp executable
|
||||||
|
# (the default behavior), or relative to the current
|
||||||
|
# working directory (when compiled with
|
||||||
|
# -DWORKDIR_CURRENT). All other paths are resolved
|
||||||
|
# relative to gameFolder and ignoring both RTPs and
|
||||||
|
# encrypted archives.
|
||||||
|
|
||||||
|
|
||||||
|
# Specify the RGSS version to run under.
|
||||||
|
# Possible values are 0, 1, 2, 3. If set to 0,
|
||||||
|
# mkxp will try to guess the required version
|
||||||
|
# based on the game files found in gameFolder.
|
||||||
|
# If this fails, the version defaults to 1.
|
||||||
|
# (default: 0)
|
||||||
|
#
|
||||||
|
# rgssVersion=1
|
||||||
|
|
||||||
|
|
||||||
# Create a debug context and log
|
# Create a debug context and log
|
||||||
# OpenGL debug information to the console
|
# OpenGL debug information to the console
|
||||||
|
@ -7,6 +27,14 @@
|
||||||
# debugMode=false
|
# debugMode=false
|
||||||
|
|
||||||
|
|
||||||
|
# Continuously print average FPS to console.
|
||||||
|
# This setting does not affect the window title
|
||||||
|
# FPS display toggled via F2
|
||||||
|
# (default: disabled)
|
||||||
|
#
|
||||||
|
# printFPS=false
|
||||||
|
|
||||||
|
|
||||||
# Game window is resizable
|
# Game window is resizable
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
#
|
#
|
||||||
|
@ -29,9 +57,9 @@
|
||||||
|
|
||||||
# Apply linear interpolation when game screen
|
# Apply linear interpolation when game screen
|
||||||
# is upscaled
|
# is upscaled
|
||||||
# (default: disabled)
|
# (default: enabled)
|
||||||
#
|
#
|
||||||
# smoothScaling=false
|
# smoothScaling=true
|
||||||
|
|
||||||
|
|
||||||
# Sync screen redraws to the monitor refresh rate
|
# Sync screen redraws to the monitor refresh rate
|
||||||
|
@ -40,16 +68,30 @@
|
||||||
# vsync=false
|
# vsync=false
|
||||||
|
|
||||||
|
|
||||||
# Create the window with 640 in width at startup
|
# Specify the window width on startup. If set to 0,
|
||||||
|
# it will default to the default resolution width
|
||||||
|
# specific to the RGSS version (640 in RGSS1, 544
|
||||||
|
# in RGSS2 or higher).
|
||||||
|
# (default: 0)
|
||||||
#
|
#
|
||||||
# defScreenW=640
|
# defScreenW=640
|
||||||
|
|
||||||
|
|
||||||
# Create the window with 480 in height at startup
|
# Specify the window height on startup. If set to 0,
|
||||||
|
# it will default to the default resolution height
|
||||||
|
# specific to the RGSS version (480 in RGSS1, 416
|
||||||
|
# in RGSS2 or higher).
|
||||||
|
# (default: 0)
|
||||||
#
|
#
|
||||||
# defScreenH=480
|
# defScreenH=480
|
||||||
|
|
||||||
|
|
||||||
|
# Override the game window title
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# windowTitle=Custom Title
|
||||||
|
|
||||||
|
|
||||||
# Enforce a static frame rate
|
# Enforce a static frame rate
|
||||||
# (0 = disabled)
|
# (0 = disabled)
|
||||||
#
|
#
|
||||||
|
@ -62,12 +104,52 @@
|
||||||
# frameSkip=true
|
# frameSkip=true
|
||||||
|
|
||||||
|
|
||||||
|
# Use a fixed framerate that is approx. equal to the
|
||||||
|
# native screen refresh rate. This is different from
|
||||||
|
# "fixedFramerate" because the actual frame rate is
|
||||||
|
# reported back to the game, ensuring correct timers.
|
||||||
|
# If the screen refresh rate cannot be determined,
|
||||||
|
# this option is force-disabled
|
||||||
|
# (default: disabled)
|
||||||
|
#
|
||||||
|
# syncToRefreshrate=false
|
||||||
|
|
||||||
|
|
||||||
# Don't use alpha blending when rendering text
|
# Don't use alpha blending when rendering text
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
#
|
#
|
||||||
# solidFonts=false
|
# solidFonts=false
|
||||||
|
|
||||||
|
|
||||||
|
# Work around buggy graphics drivers which don't
|
||||||
|
# properly synchronize texture access, most
|
||||||
|
# apparent when text doesn't show up or the map
|
||||||
|
# tileset doesn't render at all
|
||||||
|
# (default: disabled)
|
||||||
|
#
|
||||||
|
# subImageFix=false
|
||||||
|
|
||||||
|
|
||||||
|
# Enable framebuffer blitting if the driver is
|
||||||
|
# capable of it. Some drivers carry buggy
|
||||||
|
# implementations of this functionality, so
|
||||||
|
# disabling it can be used as a workaround
|
||||||
|
# (default: enabled)
|
||||||
|
#
|
||||||
|
# enableBlitting=true
|
||||||
|
|
||||||
|
|
||||||
|
# Limit the maximum size (width, height) of
|
||||||
|
# most textures mkxp will create (exceptions are
|
||||||
|
# rendering backbuffers and similar).
|
||||||
|
# If set to 0, the hardware maximum is used.
|
||||||
|
# This is useful for recording traces that can
|
||||||
|
# be played back on machines with lower specs.
|
||||||
|
# (default: 0)
|
||||||
|
#
|
||||||
|
# maxTextureSize=0
|
||||||
|
|
||||||
|
|
||||||
# Set the base path of the game to '/path/to/game'
|
# Set the base path of the game to '/path/to/game'
|
||||||
# (default: executable directory)
|
# (default: executable directory)
|
||||||
#
|
#
|
||||||
|
@ -81,12 +163,31 @@
|
||||||
# anyAltToggleFS=false
|
# anyAltToggleFS=false
|
||||||
|
|
||||||
|
|
||||||
|
# Enable F12 game reset
|
||||||
|
# (default: enabled)
|
||||||
|
#
|
||||||
|
# enableReset=true
|
||||||
|
|
||||||
|
|
||||||
# Allow symlinks for game assets to be followed
|
# Allow symlinks for game assets to be followed
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
#
|
#
|
||||||
# allowSymlinks=false
|
# allowSymlinks=false
|
||||||
|
|
||||||
|
|
||||||
|
# Organisation / company and application / game
|
||||||
|
# name to build the directory path where mkxp
|
||||||
|
# will store game specific data (eg. key bindings).
|
||||||
|
# If not specified, mkxp will save to a common
|
||||||
|
# directory shared by all games. Note that these
|
||||||
|
# are TWO individual config entries, and both need
|
||||||
|
# to be defined for this to take effect.
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# dataPathOrg=mycompany
|
||||||
|
# dataPathApp=mygame
|
||||||
|
|
||||||
|
|
||||||
# Set the game window icon to 'path/to/icon.png'
|
# Set the game window icon to 'path/to/icon.png'
|
||||||
# (default: none)
|
# (default: none)
|
||||||
#
|
#
|
||||||
|
@ -100,12 +201,21 @@
|
||||||
# customScript=/path/to/script.rb
|
# customScript=/path/to/script.rb
|
||||||
|
|
||||||
|
|
||||||
|
# Define raw scripts to be executed before the
|
||||||
|
# actual Scripts.rxdata execution starts
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# preloadScript=my_win32_wrapper.rb
|
||||||
|
# preloadScript=ruby18_fixes.rb
|
||||||
|
|
||||||
|
|
||||||
# Index all accesible assets via their lower case path
|
# Index all accesible assets via their lower case path
|
||||||
# (emulates windows case insensitivity)
|
# (emulates windows case insensitivity)
|
||||||
# (default: enabled)
|
# (default: enabled)
|
||||||
#
|
#
|
||||||
# pathCache=true
|
# pathCache=true
|
||||||
|
|
||||||
|
|
||||||
# Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
# Add 'rtp1', 'rtp2.zip' and 'game.rgssad' to the
|
||||||
# asset search path (multiple allowed)
|
# asset search path (multiple allowed)
|
||||||
# (default: none)
|
# (default: none)
|
||||||
|
@ -113,3 +223,82 @@
|
||||||
# RTP=/path/to/rtp1
|
# RTP=/path/to/rtp1
|
||||||
# RTP=/path/to/rtp2.zip
|
# RTP=/path/to/rtp2.zip
|
||||||
# RTP=/path/to/game.rgssad
|
# RTP=/path/to/game.rgssad
|
||||||
|
|
||||||
|
|
||||||
|
# Use the script's name as filename in warnings and error messages
|
||||||
|
# (default: disabled)
|
||||||
|
#
|
||||||
|
# useScriptNames=false
|
||||||
|
|
||||||
|
|
||||||
|
# Font substitutions allow drop-in replacements of fonts
|
||||||
|
# to be used without changing the RGSS scripts,
|
||||||
|
# eg. providing 'Open Sans' when the game thinkgs it's
|
||||||
|
# using 'Arial'. Font family to be substituted and
|
||||||
|
# replacement family are separated by one sole '>'.
|
||||||
|
# Be careful not to include any spaces.
|
||||||
|
# This is not connected to the built-in font, which is
|
||||||
|
# always used when a non-existing font family is
|
||||||
|
# requested by RGSS.
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# fontSub=Arial>Open Sans
|
||||||
|
# fontSub=Times New Roman>Liberation Serif
|
||||||
|
|
||||||
|
|
||||||
|
# Because mkxp is usually distributed as a stand alone
|
||||||
|
# build, no predefined load paths are initialized
|
||||||
|
# ($:, $LOAD_PATH) in the MRI backend. With this option,
|
||||||
|
# they can be specified manually (eg. when using a system
|
||||||
|
# libruby.so). It is however recommended to statically
|
||||||
|
# link all required gems into libruby.so.
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# rubyLoadpath=/usr/lib64/ruby/
|
||||||
|
# rubyLoadpath=/usr/local/share/ruby/site_ruby
|
||||||
|
|
||||||
|
|
||||||
|
# SoundFont to use for midi playback (via fluidsynth)
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# midi.soundFont=/usr/share/mysoundfont.sf2
|
||||||
|
|
||||||
|
|
||||||
|
# Activate "chorus" effect for midi playback
|
||||||
|
#
|
||||||
|
# midi.chorus=false
|
||||||
|
|
||||||
|
|
||||||
|
# Activate "reverb" effect for midi playback
|
||||||
|
#
|
||||||
|
# midi.reverb=false
|
||||||
|
|
||||||
|
|
||||||
|
# Number of OpenAL sources to allocate for SE playback.
|
||||||
|
# If there are a lot of sounds playing at the same time
|
||||||
|
# and audibly cutting each other off, try increasing
|
||||||
|
# this number. Maximum: 64.
|
||||||
|
#
|
||||||
|
# SE.sourceCount=6
|
||||||
|
|
||||||
|
|
||||||
|
# The Windows game executable name minus ".exe". By default
|
||||||
|
# this is "Game", but some developers manually rename it.
|
||||||
|
# mkxp needs this name because both the .ini (game
|
||||||
|
# configuration) and .rgssad (encrypted data archive) must
|
||||||
|
# carry the same name minus their extension, and we cannot
|
||||||
|
# guess the executable's name.
|
||||||
|
# You could just as well rename them both to "Game.ini" and
|
||||||
|
# "Game.rgssad", but specifying the executable name here
|
||||||
|
# is a tiny bit less intrusive.
|
||||||
|
#
|
||||||
|
# execName=Game
|
||||||
|
|
||||||
|
|
||||||
|
# Give a hint on which language the game title as
|
||||||
|
# specified in the Game.ini is, useful if the encoding
|
||||||
|
# is being falsely detected. Relevant only if mkxp was
|
||||||
|
# built with automatic encoding conversion (INI_ENCODING).
|
||||||
|
# (default: none)
|
||||||
|
#
|
||||||
|
# titleLanguage=japanese
|
||||||
|
|
106
mkxp.pro
106
mkxp.pro
|
@ -5,10 +5,13 @@ QT =
|
||||||
TARGET = mkxp
|
TARGET = mkxp
|
||||||
DEPENDPATH += src shader assets
|
DEPENDPATH += src shader assets
|
||||||
INCLUDEPATH += . src
|
INCLUDEPATH += . src
|
||||||
LIBS += -lGL
|
|
||||||
|
|
||||||
CONFIG(release, debug|release): DEFINES += NDEBUG
|
CONFIG(release, debug|release): DEFINES += NDEBUG
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
# And for older qmake versions..
|
||||||
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
|
|
||||||
isEmpty(BINDING) {
|
isEmpty(BINDING) {
|
||||||
BINDING = MRI
|
BINDING = MRI
|
||||||
}
|
}
|
||||||
|
@ -40,17 +43,17 @@ contains(BINDING, NULL) {
|
||||||
CONFIG += BINDING_NULL
|
CONFIG += BINDING_NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
RGSS2 {
|
|
||||||
DEFINES += RGSS2
|
|
||||||
}
|
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += sigc++-2.0 glew pixman-1 zlib physfs \
|
PKGCONFIG += sigc++-2.0 pixman-1 zlib physfs vorbisfile \
|
||||||
sdl2 SDL2_image SDL2_ttf SDL_sound openal
|
sdl2 SDL2_image SDL2_ttf SDL_sound openal
|
||||||
|
|
||||||
RGSS2 {
|
SHARED_FLUID {
|
||||||
PKGCONFIG += vorbisfile
|
PKGCONFIG += fluidsynth
|
||||||
|
}
|
||||||
|
|
||||||
|
INI_ENCODING {
|
||||||
|
PKGCONFIG += libguess
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deal with boost paths...
|
# Deal with boost paths...
|
||||||
|
@ -70,7 +73,11 @@ unix {
|
||||||
LIBS += -L$$BOOST_L
|
LIBS += -L$$BOOST_L
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += -lboost_program_options
|
isEmpty(BOOST_LIB_SUFFIX) {
|
||||||
|
BOOST_LIB_SUFFIX = $$(BOOST_LIB_SUFFIX)
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBS += -lboost_program_options$$BOOST_LIB_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
|
@ -86,6 +93,7 @@ HEADERS += \
|
||||||
src/flashable.h \
|
src/flashable.h \
|
||||||
src/font.h \
|
src/font.h \
|
||||||
src/input.h \
|
src/input.h \
|
||||||
|
src/iniconfig.h \
|
||||||
src/plane.h \
|
src/plane.h \
|
||||||
src/scene.h \
|
src/scene.h \
|
||||||
src/sprite.h \
|
src/sprite.h \
|
||||||
|
@ -100,8 +108,9 @@ HEADERS += \
|
||||||
src/glstate.h \
|
src/glstate.h \
|
||||||
src/quad.h \
|
src/quad.h \
|
||||||
src/tilemap.h \
|
src/tilemap.h \
|
||||||
|
src/tilemap-common.h \
|
||||||
src/graphics.h \
|
src/graphics.h \
|
||||||
src/debuglogger.h \
|
src/gl-debug.h \
|
||||||
src/global-ibo.h \
|
src/global-ibo.h \
|
||||||
src/exception.h \
|
src/exception.h \
|
||||||
src/filesystem.h \
|
src/filesystem.h \
|
||||||
|
@ -111,12 +120,27 @@ HEADERS += \
|
||||||
src/gl-util.h \
|
src/gl-util.h \
|
||||||
src/util.h \
|
src/util.h \
|
||||||
src/config.h \
|
src/config.h \
|
||||||
|
src/settingsmenu.h \
|
||||||
|
src/keybindings.h \
|
||||||
src/tileatlas.h \
|
src/tileatlas.h \
|
||||||
src/perftimer.h \
|
|
||||||
src/sharedstate.h \
|
src/sharedstate.h \
|
||||||
src/al-util.h \
|
src/al-util.h \
|
||||||
src/boost-hash.h \
|
src/boost-hash.h \
|
||||||
src/debugwriter.h
|
src/debugwriter.h \
|
||||||
|
src/gl-fun.h \
|
||||||
|
src/gl-meta.h \
|
||||||
|
src/vertex.h \
|
||||||
|
src/soundemitter.h \
|
||||||
|
src/aldatasource.h \
|
||||||
|
src/alstream.h \
|
||||||
|
src/audiostream.h \
|
||||||
|
src/rgssad.h \
|
||||||
|
src/windowvx.h \
|
||||||
|
src/tilemapvx.h \
|
||||||
|
src/tileatlasvx.h \
|
||||||
|
src/sharedmidistate.h \
|
||||||
|
src/fluid-fun.h \
|
||||||
|
src/sdl-util.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
|
@ -126,6 +150,7 @@ SOURCES += \
|
||||||
src/filesystem.cpp \
|
src/filesystem.cpp \
|
||||||
src/font.cpp \
|
src/font.cpp \
|
||||||
src/input.cpp \
|
src/input.cpp \
|
||||||
|
src/iniconfig.cpp \
|
||||||
src/plane.cpp \
|
src/plane.cpp \
|
||||||
src/scene.cpp \
|
src/scene.cpp \
|
||||||
src/sprite.cpp \
|
src/sprite.cpp \
|
||||||
|
@ -139,35 +164,64 @@ SOURCES += \
|
||||||
src/tilemap.cpp \
|
src/tilemap.cpp \
|
||||||
src/autotiles.cpp \
|
src/autotiles.cpp \
|
||||||
src/graphics.cpp \
|
src/graphics.cpp \
|
||||||
src/debuglogger.cpp \
|
src/gl-debug.cpp \
|
||||||
src/etc.cpp \
|
src/etc.cpp \
|
||||||
src/config.cpp \
|
src/config.cpp \
|
||||||
|
src/settingsmenu.cpp \
|
||||||
|
src/keybindings.cpp \
|
||||||
src/tileatlas.cpp \
|
src/tileatlas.cpp \
|
||||||
src/perftimer.cpp \
|
src/sharedstate.cpp \
|
||||||
src/sharedstate.cpp
|
src/gl-fun.cpp \
|
||||||
|
src/gl-meta.cpp \
|
||||||
|
src/vertex.cpp \
|
||||||
|
src/soundemitter.cpp \
|
||||||
|
src/sdlsoundsource.cpp \
|
||||||
|
src/alstream.cpp \
|
||||||
|
src/audiostream.cpp \
|
||||||
|
src/rgssad.cpp \
|
||||||
|
src/bundledfont.cpp \
|
||||||
|
src/vorbissource.cpp \
|
||||||
|
src/windowvx.cpp \
|
||||||
|
src/tilemapvx.cpp \
|
||||||
|
src/tileatlasvx.cpp \
|
||||||
|
src/autotilesvx.cpp \
|
||||||
|
src/midisource.cpp \
|
||||||
|
src/fluid-fun.cpp
|
||||||
|
|
||||||
EMBED = \
|
EMBED = \
|
||||||
|
shader/common.h \
|
||||||
shader/transSimple.frag \
|
shader/transSimple.frag \
|
||||||
shader/trans.frag \
|
shader/trans.frag \
|
||||||
shader/hue.frag \
|
shader/hue.frag \
|
||||||
shader/sprite.frag \
|
shader/sprite.frag \
|
||||||
shader/plane.frag \
|
shader/plane.frag \
|
||||||
|
shader/gray.frag \
|
||||||
shader/bitmapBlit.frag \
|
shader/bitmapBlit.frag \
|
||||||
|
shader/flatColor.frag \
|
||||||
shader/simple.frag \
|
shader/simple.frag \
|
||||||
shader/simpleColor.frag \
|
shader/simpleColor.frag \
|
||||||
shader/simpleAlpha.frag \
|
shader/simpleAlpha.frag \
|
||||||
|
shader/simpleAlphaUni.frag \
|
||||||
shader/flashMap.frag \
|
shader/flashMap.frag \
|
||||||
|
shader/minimal.vert \
|
||||||
shader/simple.vert \
|
shader/simple.vert \
|
||||||
shader/simpleColor.vert \
|
shader/simpleColor.vert \
|
||||||
shader/sprite.vert \
|
shader/sprite.vert \
|
||||||
assets/liberation.ttf
|
shader/tilemap.vert \
|
||||||
|
|
||||||
RGSS2 {
|
|
||||||
EMBED += \
|
|
||||||
shader/blur.frag \
|
shader/blur.frag \
|
||||||
shader/blurH.vert \
|
shader/blurH.vert \
|
||||||
shader/blurV.vert \
|
shader/blurV.vert \
|
||||||
shader/simpleMatrix.vert
|
shader/simpleMatrix.vert \
|
||||||
|
shader/tilemapvx.vert \
|
||||||
|
assets/liberation.ttf \
|
||||||
|
assets/icon.png
|
||||||
|
|
||||||
|
SHARED_FLUID {
|
||||||
|
DEFINES += SHARED_FLUID
|
||||||
|
}
|
||||||
|
|
||||||
|
INI_ENCODING {
|
||||||
|
DEFINES += INI_ENCODING
|
||||||
}
|
}
|
||||||
|
|
||||||
defineReplace(xxdOutput) {
|
defineReplace(xxdOutput) {
|
||||||
|
@ -230,7 +284,11 @@ BINDING_MRUBY {
|
||||||
}
|
}
|
||||||
|
|
||||||
BINDING_MRI {
|
BINDING_MRI {
|
||||||
PKGCONFIG += ruby-2.1
|
isEmpty(MRIVERSION) {
|
||||||
|
MRIVERSION = 2.1
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONFIG += ruby-$$MRIVERSION
|
||||||
DEFINES += BINDING_MRI
|
DEFINES += BINDING_MRI
|
||||||
|
|
||||||
# EMBED2 = binding-mri/module_rpg.rb
|
# EMBED2 = binding-mri/module_rpg.rb
|
||||||
|
@ -266,5 +324,9 @@ BINDING_MRI {
|
||||||
binding-mri/tilemap-binding.cpp \
|
binding-mri/tilemap-binding.cpp \
|
||||||
binding-mri/audio-binding.cpp \
|
binding-mri/audio-binding.cpp \
|
||||||
binding-mri/module_rpg.cpp \
|
binding-mri/module_rpg.cpp \
|
||||||
binding-mri/filesystem-binding.cpp
|
binding-mri/filesystem-binding.cpp \
|
||||||
|
binding-mri/windowvx-binding.cpp \
|
||||||
|
binding-mri/tilemapvx-binding.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OTHER_FILES += $$EMBED
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
diff -r 719dade41745 Makefile.am
|
|
||||||
--- a/Makefile.am Wed Aug 15 23:52:18 2012 -0400
|
|
||||||
+++ b/Makefile.am Thu Nov 28 18:42:40 2013 +0100
|
|
||||||
@@ -1,8 +1,8 @@
|
|
||||||
lib_LTLIBRARIES = libSDL_sound.la
|
|
||||||
|
|
||||||
-SUBDIRS = decoders . playsound
|
|
||||||
+SUBDIRS = decoders .
|
|
||||||
|
|
||||||
-libSDL_soundincludedir = $(includedir)/SDL
|
|
||||||
+libSDL_soundincludedir = $(includedir)/SDL2
|
|
||||||
libSDL_soundinclude_HEADERS = \
|
|
||||||
SDL_sound.h
|
|
||||||
|
|
||||||
@@ -49,3 +49,5 @@
|
|
||||||
echo >> $(distdir)/docs/README
|
|
||||||
rm -rf `find $(distdir) -type d -name ".svn"`
|
|
||||||
|
|
||||||
+pkgconfigdir = $(libdir)/pkgconfig
|
|
||||||
+pkgconfig_DATA = SDL_sound.pc
|
|
||||||
diff -r 719dade41745 SDL_sound.pc.in
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/SDL_sound.pc.in Thu Nov 28 18:42:40 2013 +0100
|
|
||||||
@@ -0,0 +1,11 @@
|
|
||||||
+prefix=@prefix@
|
|
||||||
+exec_prefix=@exec_prefix@
|
|
||||||
+libdir=@libdir@
|
|
||||||
+includedir=@includedir@
|
|
||||||
+
|
|
||||||
+Name: SDL_sound
|
|
||||||
+Description: audio decoding library for Simple DirectMedia Layer
|
|
||||||
+Version: @VERSION@
|
|
||||||
+Requires: sdl2 >= @SDL_VERSION@
|
|
||||||
+Libs: -L${libdir} -lSDL_sound
|
|
||||||
+Cflags: -I${includedir}/SDL2
|
|
||||||
diff -r 719dade41745 configure.in
|
|
||||||
--- a/configure.in Wed Aug 15 23:52:18 2012 -0400
|
|
||||||
+++ b/configure.in Thu Nov 28 18:42:40 2013 +0100
|
|
||||||
@@ -107,7 +107,8 @@
|
|
||||||
dnl ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
dnl Check for SDL
|
|
||||||
-SDL_VERSION=1.2.0
|
|
||||||
+SDL_VERSION=2.0.0
|
|
||||||
+AC_SUBST(SDL_VERSION)
|
|
||||||
AM_PATH_SDL($SDL_VERSION,
|
|
||||||
:,
|
|
||||||
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
|
|
||||||
@@ -339,4 +340,5 @@
|
|
||||||
decoders/timidity/Makefile
|
|
||||||
decoders/libmpg123/Makefile
|
|
||||||
playsound/Makefile
|
|
||||||
+SDL_sound.pc
|
|
||||||
])
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
--- a/common.mk
|
||||||
|
+++ b/common.mk
|
||||||
|
@@ -95,6 +95,7 @@ COMMONOBJS = array.$(OBJEXT) \
|
||||||
|
vm_trace.$(OBJEXT) \
|
||||||
|
thread.$(OBJEXT) \
|
||||||
|
cont.$(OBJEXT) \
|
||||||
|
+ ext/zlib/zlib.$(OBJEXT) \
|
||||||
|
$(BUILTIN_ENCOBJS) \
|
||||||
|
$(BUILTIN_TRANSOBJS) \
|
||||||
|
$(MISSING)
|
||||||
|
diff --git a/ruby-2.1.5.orig/configure b/ruby-2.1.5/configure
|
||||||
|
index d0f1f68..45ab642 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -2838,6 +2838,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+LIBS="$LIBS -lz"
|
||||||
|
+
|
||||||
|
{ # environment section
|
||||||
|
|
||||||
|
|
||||||
|
--- a/configure.in
|
||||||
|
+++ b/configure.in
|
||||||
|
@@ -31,6 +31,8 @@ rm() {
|
||||||
|
}
|
||||||
|
])])])
|
||||||
|
|
||||||
|
+LIBS="$LIBS -lz"
|
||||||
|
+
|
||||||
|
{ # environment section
|
||||||
|
|
||||||
|
AC_ARG_WITH(baseruby,
|
||||||
|
--- a/inits.c
|
||||||
|
+++ b/inits.c
|
||||||
|
@@ -61,5 +61,6 @@ rb_call_inits(void)
|
||||||
|
CALL(Complex);
|
||||||
|
CALL(version);
|
||||||
|
CALL(vm_trace);
|
||||||
|
+ CALL(zlib);
|
||||||
|
}
|
||||||
|
#undef CALL
|
|
@ -6,7 +6,7 @@ uniform sampler2D destination;
|
||||||
|
|
||||||
uniform vec4 subRect;
|
uniform vec4 subRect;
|
||||||
|
|
||||||
uniform float opacity;
|
uniform lowp float opacity;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
@ -20,18 +20,14 @@ void main()
|
||||||
|
|
||||||
vec4 resFrag;
|
vec4 resFrag;
|
||||||
|
|
||||||
float ab = opacity;
|
float co1 = srcFrag.a * opacity;
|
||||||
float as = srcFrag.a;
|
float co2 = dstFrag.a * (1.0 - co1);
|
||||||
float ad = dstFrag.a;
|
resFrag.a = co1 + co2;
|
||||||
|
|
||||||
float at = ab*as;
|
if (resFrag.a == 0.0)
|
||||||
resFrag.a = at + ad - ad*at;
|
|
||||||
|
|
||||||
// Sigh...
|
|
||||||
if (ad == 0.0)
|
|
||||||
resFrag.rgb = srcFrag.rgb;
|
resFrag.rgb = srcFrag.rgb;
|
||||||
else
|
else
|
||||||
resFrag.rgb = as*srcFrag.rgb + (1.0-at) * ad * dstFrag.rgb;
|
resFrag.rgb = (co1*srcFrag.rgb + co2*dstFrag.rgb) / resFrag.a;
|
||||||
|
|
||||||
gl_FragColor = resFrag;
|
gl_FragColor = resFrag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ varying vec2 v_blurCoord[2];
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = vec4(0, 0, 0, 0);
|
lowp vec4 frag = vec4(0, 0, 0, 0);
|
||||||
|
|
||||||
frag += texture2D(texture, v_texCoord);
|
frag += texture2D(texture, v_texCoord);
|
||||||
frag += texture2D(texture, v_blurCoord[0]);
|
frag += texture2D(texture, v_blurCoord[0]);
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifdef GLSLES
|
||||||
|
|
||||||
|
#ifdef FRAGMENT_SHADER
|
||||||
|
/* Only the fragment shader has no default float precision */
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Desktop GLSL doesn't know about these */
|
||||||
|
#define highp
|
||||||
|
#define mediump
|
||||||
|
#define lowp
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
uniform float alpha;
|
uniform lowp float alpha;
|
||||||
|
|
||||||
varying vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
uniform lowp vec4 color;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
uniform lowp float gray;
|
||||||
|
|
||||||
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
/* Sample source color */
|
||||||
|
vec4 frag = texture2D(texture, v_texCoord);
|
||||||
|
|
||||||
|
/* Apply gray */
|
||||||
|
float luma = dot(frag.rgb, lumaF);
|
||||||
|
frag.rgb = mix(frag.rgb, vec3(luma), gray);
|
||||||
|
|
||||||
|
gl_FragColor = frag;
|
||||||
|
}
|
|
@ -1,44 +1,40 @@
|
||||||
|
|
||||||
uniform sampler2D inputTexture;
|
uniform sampler2D texture;
|
||||||
uniform float hueAdjust;
|
uniform mediump float hueAdjust;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
/* Source: gamedev.stackexchange.com/a/59808/24839 */
|
||||||
|
vec3 rgb2hsv(vec3 c)
|
||||||
|
{
|
||||||
|
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||||
|
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||||
|
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||||
|
|
||||||
|
float d = q.x - min(q.w, q.y);
|
||||||
|
|
||||||
|
/* Avoid divide-by-zero situations by adding a very tiny delta.
|
||||||
|
* Since we always deal with underlying 8-Bit color values, this
|
||||||
|
* should never mask a real value */
|
||||||
|
const float eps = 1.0e-10;
|
||||||
|
|
||||||
|
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps)), d / (q.x + eps), q.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hsv2rgb(vec3 c)
|
||||||
|
{
|
||||||
|
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||||
|
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||||
|
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||||
|
}
|
||||||
|
|
||||||
void main ()
|
void main ()
|
||||||
{
|
{
|
||||||
const vec4 kRGBToYPrime = vec4 (0.299, 0.587, 0.114, 0.0);
|
vec4 color = texture2D (texture, v_texCoord.xy);
|
||||||
const vec4 kRGBToI = vec4 (0.596, -0.275, -0.321, 0.0);
|
vec3 hsv = rgb2hsv(color.rgb);
|
||||||
const vec4 kRGBToQ = vec4 (0.212, -0.523, 0.311, 0.0);
|
|
||||||
|
|
||||||
const vec4 kYIQToR = vec4 (1.0, 0.956, 0.621, 0.0);
|
hsv.x += hueAdjust;
|
||||||
const vec4 kYIQToG = vec4 (1.0, -0.272, -0.647, 0.0);
|
color.rgb = hsv2rgb(hsv);
|
||||||
const vec4 kYIQToB = vec4 (1.0, -1.107, 1.704, 0.0);
|
|
||||||
|
|
||||||
/* Sample the input pixel */
|
|
||||||
vec4 color = texture2D (inputTexture, v_texCoord.xy);
|
|
||||||
|
|
||||||
/* Convert to YIQ */
|
|
||||||
float YPrime = dot (color, kRGBToYPrime);
|
|
||||||
float I = dot (color, kRGBToI);
|
|
||||||
float Q = dot (color, kRGBToQ);
|
|
||||||
|
|
||||||
/* Calculate the hue and chroma */
|
|
||||||
float hue = atan (Q, I);
|
|
||||||
float chroma = sqrt (I * I + Q * Q);
|
|
||||||
|
|
||||||
/* Make the user's adjustments */
|
|
||||||
hue += hueAdjust;
|
|
||||||
|
|
||||||
// Convert back to YIQ
|
|
||||||
Q = chroma * sin (hue);
|
|
||||||
I = chroma * cos (hue);
|
|
||||||
|
|
||||||
/* Convert back to RGB */
|
|
||||||
vec4 yIQ = vec4 (YPrime, I, Q, 0.0);
|
|
||||||
color.r = dot (yIQ, kYIQToR);
|
|
||||||
color.g = dot (yIQ, kYIQToG);
|
|
||||||
color.b = dot (yIQ, kYIQToB);
|
|
||||||
|
|
||||||
/* Save the result */
|
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
uniform mat4 projMat;
|
||||||
|
attribute vec2 position;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = projMat * vec4(position, 0, 1);
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
uniform vec4 tone;
|
uniform lowp vec4 tone;
|
||||||
|
|
||||||
uniform float opacity;
|
uniform lowp float opacity;
|
||||||
uniform vec4 color;
|
uniform lowp vec4 color;
|
||||||
uniform vec4 flash;
|
uniform lowp vec4 flash;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
varying vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
uniform lowp float alpha;
|
||||||
|
|
||||||
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = texture2D(texture, v_texCoord);
|
||||||
|
gl_FragColor.a *= alpha;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
varying vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,10 +6,10 @@ uniform vec2 translation;
|
||||||
|
|
||||||
attribute vec2 position;
|
attribute vec2 position;
|
||||||
attribute vec2 texCoord;
|
attribute vec2 texCoord;
|
||||||
attribute vec4 color;
|
attribute lowp vec4 color;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
varying vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,10 +6,10 @@ uniform vec2 texSizeInv;
|
||||||
|
|
||||||
attribute vec2 position;
|
attribute vec2 position;
|
||||||
attribute vec2 texCoord;
|
attribute vec2 texCoord;
|
||||||
attribute vec4 color;
|
attribute lowp vec4 color;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
varying vec4 v_color;
|
varying lowp vec4 v_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
uniform sampler2D texture;
|
uniform sampler2D texture;
|
||||||
|
|
||||||
uniform vec4 tone;
|
uniform lowp vec4 tone;
|
||||||
|
|
||||||
uniform float opacity;
|
uniform lowp float opacity;
|
||||||
uniform vec4 color;
|
uniform lowp vec4 color;
|
||||||
|
|
||||||
uniform float bushDepth;
|
uniform float bushDepth;
|
||||||
uniform float bushOpacity;
|
uniform lowp float bushOpacity;
|
||||||
|
|
||||||
varying vec2 v_texCoord;
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ void main()
|
||||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||||
|
|
||||||
/* Apply bush alpha by mathematical if */
|
/* Apply bush alpha by mathematical if */
|
||||||
float underBush = float(v_texCoord.y < bushDepth);
|
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||||
|
|
||||||
gl_FragColor = frag;
|
gl_FragColor = frag;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
uniform mat4 projMat;
|
||||||
|
|
||||||
|
uniform vec2 texSizeInv;
|
||||||
|
uniform vec2 translation;
|
||||||
|
|
||||||
|
uniform float aniIndex;
|
||||||
|
|
||||||
|
attribute vec2 position;
|
||||||
|
attribute vec2 texCoord;
|
||||||
|
|
||||||
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
const float atAreaW = 96.0;
|
||||||
|
const float atAreaH = 128.0*7.0;
|
||||||
|
const float atAniOffset = 32.0*3.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 tex = texCoord;
|
||||||
|
|
||||||
|
lowp float pred = float(tex.x <= atAreaW && tex.y <= atAreaH);
|
||||||
|
tex.x += aniIndex * atAniOffset * pred;
|
||||||
|
|
||||||
|
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||||
|
|
||||||
|
v_texCoord = tex * texSizeInv;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
uniform mat4 projMat;
|
||||||
|
|
||||||
|
uniform vec2 texSizeInv;
|
||||||
|
uniform vec2 translation;
|
||||||
|
|
||||||
|
uniform vec2 aniOffset;
|
||||||
|
|
||||||
|
attribute vec2 position;
|
||||||
|
attribute vec2 texCoord;
|
||||||
|
|
||||||
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
const vec2 atAreaA = vec2(9.0*32.0, 12.0*32.0);
|
||||||
|
const float atAreaCX = 12.0*32.0;
|
||||||
|
const float atAreaCW = 4.0*32.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 tex = texCoord;
|
||||||
|
lowp float pred;
|
||||||
|
|
||||||
|
/* Type A autotiles shift horizontally */
|
||||||
|
pred = float(tex.x <= atAreaA.x && tex.y <= atAreaA.y);
|
||||||
|
tex.x += aniOffset.x * pred;
|
||||||
|
|
||||||
|
/* Type C autotiles shift vertically */
|
||||||
|
pred = float(tex.x >= atAreaCX && tex.x <= (atAreaCX+atAreaCW) && tex.y <= atAreaA.y);
|
||||||
|
tex.y += aniOffset.y * pred;
|
||||||
|
|
||||||
|
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||||
|
|
||||||
|
v_texCoord = tex * texSizeInv;
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ void main()
|
||||||
{
|
{
|
||||||
float transV = texture2D(transMap, v_texCoord).r;
|
float transV = texture2D(transMap, v_texCoord).r;
|
||||||
float cTransV = clamp(transV, prog, prog+vague);
|
float cTransV = clamp(transV, prog, prog+vague);
|
||||||
float alpha = (cTransV - prog) / vague;
|
lowp float alpha = (cTransV - prog) / vague;
|
||||||
|
|
||||||
vec4 newFrag = texture2D(currentScene, v_texCoord);
|
vec4 newFrag = texture2D(currentScene, v_texCoord);
|
||||||
vec4 oldFrag = texture2D(frozenScene, v_texCoord);
|
vec4 oldFrag = texture2D(frozenScene, v_texCoord);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,7 +23,8 @@
|
||||||
#define ALUTIL_H
|
#define ALUTIL_H
|
||||||
|
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alext.h>
|
#include <SDL_audio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
namespace AL
|
namespace AL
|
||||||
{
|
{
|
||||||
|
@ -132,6 +133,11 @@ namespace Source
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void clearQueue(Source::ID id)
|
||||||
|
{
|
||||||
|
attachBuffer(id, Buffer::ID(0));
|
||||||
|
}
|
||||||
|
|
||||||
inline ALint getInteger(Source::ID id, ALenum prop)
|
inline ALint getInteger(Source::ID id, ALenum prop)
|
||||||
{
|
{
|
||||||
ALint value;
|
ALint value;
|
||||||
|
@ -186,4 +192,52 @@ namespace Source
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint8_t formatSampleSize(int sdlFormat)
|
||||||
|
{
|
||||||
|
switch (sdlFormat)
|
||||||
|
{
|
||||||
|
case AUDIO_U8 :
|
||||||
|
case AUDIO_S8 :
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case AUDIO_U16LSB :
|
||||||
|
case AUDIO_U16MSB :
|
||||||
|
case AUDIO_S16LSB :
|
||||||
|
case AUDIO_S16MSB :
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
default :
|
||||||
|
assert(!"Unhandled sample format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ALenum chooseALFormat(int sampleSize, int channelCount)
|
||||||
|
{
|
||||||
|
switch (sampleSize)
|
||||||
|
{
|
||||||
|
case 1 :
|
||||||
|
switch (channelCount)
|
||||||
|
{
|
||||||
|
case 1 : return AL_FORMAT_MONO8;
|
||||||
|
case 2 : return AL_FORMAT_STEREO8;
|
||||||
|
}
|
||||||
|
case 2 :
|
||||||
|
switch (channelCount)
|
||||||
|
{
|
||||||
|
case 1 : return AL_FORMAT_MONO16;
|
||||||
|
case 2 : return AL_FORMAT_STEREO16;
|
||||||
|
}
|
||||||
|
default :
|
||||||
|
assert(!"Unhandled sample size / channel count");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define AUDIO_SLEEP 10
|
||||||
|
#define STREAM_BUF_SIZE 32768
|
||||||
|
#define GLOBAL_VOLUME 0.8f
|
||||||
|
|
||||||
#endif // ALUTIL_H
|
#endif // ALUTIL_H
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
** aldatasource.h
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ALDATASOURCE_H
|
||||||
|
#define ALDATASOURCE_H
|
||||||
|
|
||||||
|
#include "al-util.h"
|
||||||
|
|
||||||
|
struct ALDataSource
|
||||||
|
{
|
||||||
|
enum Status
|
||||||
|
{
|
||||||
|
NoError,
|
||||||
|
EndOfStream,
|
||||||
|
WrapAround,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual ~ALDataSource() {}
|
||||||
|
|
||||||
|
/* Read/process next chunk of data, and attach it
|
||||||
|
* to provided AL buffer */
|
||||||
|
virtual Status fillBuffer(AL::Buffer::ID alBuffer) = 0;
|
||||||
|
|
||||||
|
virtual int sampleRate() = 0;
|
||||||
|
|
||||||
|
/* If the source doesn't support seeking, it will
|
||||||
|
* reset back to the beginning */
|
||||||
|
virtual void seekToOffset(float seconds) = 0;
|
||||||
|
|
||||||
|
/* The frame count right after wrap around */
|
||||||
|
virtual uint32_t loopStartFrames() = 0;
|
||||||
|
|
||||||
|
/* Returns false if not supported */
|
||||||
|
virtual bool setPitch(float value) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
ALDataSource *createSDLSource(SDL_RWops &ops,
|
||||||
|
const char *extension,
|
||||||
|
uint32_t maxBufSize,
|
||||||
|
bool looped);
|
||||||
|
|
||||||
|
ALDataSource *createVorbisSource(SDL_RWops &ops,
|
||||||
|
bool looped);
|
||||||
|
|
||||||
|
ALDataSource *createMidiSource(SDL_RWops &ops,
|
||||||
|
bool looped);
|
||||||
|
|
||||||
|
#endif // ALDATASOURCE_H
|
|
@ -0,0 +1,479 @@
|
||||||
|
/*
|
||||||
|
** alstream.cpp
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "alstream.h"
|
||||||
|
|
||||||
|
#include "sharedstate.h"
|
||||||
|
#include "sharedmidistate.h"
|
||||||
|
#include "eventthread.h"
|
||||||
|
#include "filesystem.h"
|
||||||
|
#include "exception.h"
|
||||||
|
#include "aldatasource.h"
|
||||||
|
#include "fluid-fun.h"
|
||||||
|
#include "sdl-util.h"
|
||||||
|
#include "debugwriter.h"
|
||||||
|
|
||||||
|
#include <SDL_mutex.h>
|
||||||
|
#include <SDL_thread.h>
|
||||||
|
#include <SDL_timer.h>
|
||||||
|
|
||||||
|
ALStream::ALStream(LoopMode loopMode,
|
||||||
|
const std::string &threadId)
|
||||||
|
: looped(loopMode == Looped),
|
||||||
|
state(Closed),
|
||||||
|
source(0),
|
||||||
|
thread(0),
|
||||||
|
preemptPause(false),
|
||||||
|
pitch(1.0f)
|
||||||
|
{
|
||||||
|
alSrc = AL::Source::gen();
|
||||||
|
|
||||||
|
AL::Source::setVolume(alSrc, 1.0f);
|
||||||
|
AL::Source::setPitch(alSrc, 1.0f);
|
||||||
|
AL::Source::detachBuffer(alSrc);
|
||||||
|
|
||||||
|
for (int i = 0; i < STREAM_BUFS; ++i)
|
||||||
|
alBuf[i] = AL::Buffer::gen();
|
||||||
|
|
||||||
|
pauseMut = SDL_CreateMutex();
|
||||||
|
|
||||||
|
threadName = std::string("al_stream (") + threadId + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
ALStream::~ALStream()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
|
||||||
|
AL::Source::clearQueue(alSrc);
|
||||||
|
AL::Source::del(alSrc);
|
||||||
|
|
||||||
|
for (int i = 0; i < STREAM_BUFS; ++i)
|
||||||
|
AL::Buffer::del(alBuf[i]);
|
||||||
|
|
||||||
|
SDL_DestroyMutex(pauseMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::close()
|
||||||
|
{
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Playing:
|
||||||
|
case Paused:
|
||||||
|
stopStream();
|
||||||
|
case Stopped:
|
||||||
|
closeSource();
|
||||||
|
state = Closed;
|
||||||
|
case Closed:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::open(const std::string &filename)
|
||||||
|
{
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Playing:
|
||||||
|
case Paused:
|
||||||
|
stopStream();
|
||||||
|
case Stopped:
|
||||||
|
closeSource();
|
||||||
|
case Closed:
|
||||||
|
openSource(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
state = Stopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::stop()
|
||||||
|
{
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Closed:
|
||||||
|
case Stopped:
|
||||||
|
return;
|
||||||
|
case Playing:
|
||||||
|
case Paused:
|
||||||
|
stopStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
state = Stopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::play(float offset)
|
||||||
|
{
|
||||||
|
if (!source)
|
||||||
|
return;
|
||||||
|
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Closed:
|
||||||
|
case Playing:
|
||||||
|
return;
|
||||||
|
case Stopped:
|
||||||
|
startStream(offset);
|
||||||
|
break;
|
||||||
|
case Paused :
|
||||||
|
resumeStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
state = Playing;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::pause()
|
||||||
|
{
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Closed:
|
||||||
|
case Stopped:
|
||||||
|
case Paused:
|
||||||
|
return;
|
||||||
|
case Playing:
|
||||||
|
pauseStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
state = Paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::setVolume(float value)
|
||||||
|
{
|
||||||
|
AL::Source::setVolume(alSrc, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::setPitch(float value)
|
||||||
|
{
|
||||||
|
/* If the source supports setting pitch natively,
|
||||||
|
* we don't have to do it via OpenAL */
|
||||||
|
if (source && source->setPitch(value))
|
||||||
|
AL::Source::setPitch(alSrc, 1.0f);
|
||||||
|
else
|
||||||
|
AL::Source::setPitch(alSrc, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ALStream::State ALStream::queryState()
|
||||||
|
{
|
||||||
|
checkStopped();
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ALStream::queryOffset()
|
||||||
|
{
|
||||||
|
if (state == Closed)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
float procOffset = static_cast<float>(procFrames) / source->sampleRate();
|
||||||
|
|
||||||
|
return procOffset + AL::Source::getSecOffset(alSrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::closeSource()
|
||||||
|
{
|
||||||
|
delete source;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ALStreamOpenHandler : FileSystem::OpenHandler
|
||||||
|
{
|
||||||
|
SDL_RWops *srcOps;
|
||||||
|
bool looped;
|
||||||
|
ALDataSource *source;
|
||||||
|
std::string errorMsg;
|
||||||
|
|
||||||
|
ALStreamOpenHandler(SDL_RWops &srcOps, bool looped)
|
||||||
|
: srcOps(&srcOps), looped(looped), source(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool tryRead(SDL_RWops &ops, const char *ext)
|
||||||
|
{
|
||||||
|
/* Copy this because we need to keep it around,
|
||||||
|
* as we will continue reading data from it later */
|
||||||
|
*srcOps = ops;
|
||||||
|
|
||||||
|
/* Try to read ogg file signature */
|
||||||
|
char sig[5] = { 0 };
|
||||||
|
SDL_RWread(srcOps, sig, 1, 4);
|
||||||
|
SDL_RWseek(srcOps, 0, RW_SEEK_SET);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!strcmp(sig, "OggS"))
|
||||||
|
{
|
||||||
|
source = createVorbisSource(*srcOps, looped);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(sig, "MThd"))
|
||||||
|
{
|
||||||
|
shState->midiState().initIfNeeded(shState->config());
|
||||||
|
|
||||||
|
if (HAVE_FLUID)
|
||||||
|
{
|
||||||
|
source = createMidiSource(*srcOps, looped);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
source = createSDLSource(*srcOps, ext, STREAM_BUF_SIZE, looped);
|
||||||
|
}
|
||||||
|
catch (const Exception &e)
|
||||||
|
{
|
||||||
|
/* All source constructors will close the passed ops
|
||||||
|
* before throwing errors */
|
||||||
|
errorMsg = e.msg;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void ALStream::openSource(const std::string &filename)
|
||||||
|
{
|
||||||
|
ALStreamOpenHandler handler(srcOps, looped);
|
||||||
|
shState->fileSystem().openRead(handler, filename.c_str());
|
||||||
|
source = handler.source;
|
||||||
|
needsRewind.clear();
|
||||||
|
|
||||||
|
if (!source)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
|
||||||
|
filename.c_str(), handler.errorMsg.c_str());
|
||||||
|
|
||||||
|
Debug() << buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::stopStream()
|
||||||
|
{
|
||||||
|
threadTermReq.set();
|
||||||
|
|
||||||
|
if (thread)
|
||||||
|
{
|
||||||
|
SDL_WaitThread(thread, 0);
|
||||||
|
thread = 0;
|
||||||
|
needsRewind.set();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Need to stop the source _after_ the thread has terminated,
|
||||||
|
* because it might have accidentally started it again before
|
||||||
|
* seeing the term request */
|
||||||
|
AL::Source::stop(alSrc);
|
||||||
|
|
||||||
|
procFrames = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::startStream(float offset)
|
||||||
|
{
|
||||||
|
AL::Source::clearQueue(alSrc);
|
||||||
|
|
||||||
|
preemptPause = false;
|
||||||
|
streamInited.clear();
|
||||||
|
sourceExhausted.clear();
|
||||||
|
threadTermReq.clear();
|
||||||
|
|
||||||
|
startOffset = offset;
|
||||||
|
procFrames = offset * source->sampleRate();
|
||||||
|
|
||||||
|
thread = createSDLThread
|
||||||
|
<ALStream, &ALStream::streamData>(this, threadName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::pauseStream()
|
||||||
|
{
|
||||||
|
SDL_LockMutex(pauseMut);
|
||||||
|
|
||||||
|
if (AL::Source::getState(alSrc) != AL_PLAYING)
|
||||||
|
preemptPause = true;
|
||||||
|
else
|
||||||
|
AL::Source::pause(alSrc);
|
||||||
|
|
||||||
|
SDL_UnlockMutex(pauseMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::resumeStream()
|
||||||
|
{
|
||||||
|
SDL_LockMutex(pauseMut);
|
||||||
|
|
||||||
|
if (preemptPause)
|
||||||
|
preemptPause = false;
|
||||||
|
else
|
||||||
|
AL::Source::play(alSrc);
|
||||||
|
|
||||||
|
SDL_UnlockMutex(pauseMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALStream::checkStopped()
|
||||||
|
{
|
||||||
|
/* This only concerns the scenario where
|
||||||
|
* state is still 'Playing', but the stream
|
||||||
|
* has already ended on its own (EOF, Error) */
|
||||||
|
if (state != Playing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If streaming thread hasn't queued up
|
||||||
|
* buffers yet there's not point in querying
|
||||||
|
* the AL source */
|
||||||
|
if (!streamInited)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If alSrc isn't playing, but we haven't
|
||||||
|
* exhausted the data source yet, we're just
|
||||||
|
* having a buffer underrun */
|
||||||
|
if (!sourceExhausted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AL::Source::getState(alSrc) == AL_PLAYING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stopStream();
|
||||||
|
state = Stopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* thread func */
|
||||||
|
void ALStream::streamData()
|
||||||
|
{
|
||||||
|
/* Fill up queue */
|
||||||
|
bool firstBuffer = true;
|
||||||
|
ALDataSource::Status status;
|
||||||
|
|
||||||
|
if (threadTermReq)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (needsRewind)
|
||||||
|
{
|
||||||
|
source->seekToOffset(startOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < STREAM_BUFS; ++i)
|
||||||
|
{
|
||||||
|
if (threadTermReq)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AL::Buffer::ID buf = alBuf[i];
|
||||||
|
|
||||||
|
status = source->fillBuffer(buf);
|
||||||
|
|
||||||
|
if (status == ALDataSource::Error)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AL::Source::queueBuffer(alSrc, buf);
|
||||||
|
|
||||||
|
if (firstBuffer)
|
||||||
|
{
|
||||||
|
resumeStream();
|
||||||
|
|
||||||
|
firstBuffer = false;
|
||||||
|
streamInited.set();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (threadTermReq)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (status == ALDataSource::EndOfStream)
|
||||||
|
{
|
||||||
|
sourceExhausted.set();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for buffers to be consumed, then
|
||||||
|
* refill and queue them up again */
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
shState->rtData().syncPoint.passSecondarySync();
|
||||||
|
|
||||||
|
ALint procBufs = AL::Source::getProcBufferCount(alSrc);
|
||||||
|
|
||||||
|
while (procBufs--)
|
||||||
|
{
|
||||||
|
if (threadTermReq)
|
||||||
|
break;
|
||||||
|
|
||||||
|
AL::Buffer::ID buf = AL::Source::unqueueBuffer(alSrc);
|
||||||
|
|
||||||
|
/* If something went wrong, try again later */
|
||||||
|
if (buf == AL::Buffer::ID(0))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (buf == lastBuf)
|
||||||
|
{
|
||||||
|
/* Reset the processed sample count so
|
||||||
|
* querying the playback offset returns 0.0 again */
|
||||||
|
procFrames = source->loopStartFrames();
|
||||||
|
lastBuf = AL::Buffer::ID(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Add the frame count contained in this
|
||||||
|
* buffer to the total count */
|
||||||
|
ALint bits = AL::Buffer::getBits(buf);
|
||||||
|
ALint size = AL::Buffer::getSize(buf);
|
||||||
|
ALint chan = AL::Buffer::getChannels(buf);
|
||||||
|
|
||||||
|
if (bits != 0 && chan != 0)
|
||||||
|
procFrames += ((size / (bits / 8)) / chan);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceExhausted)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
status = source->fillBuffer(buf);
|
||||||
|
|
||||||
|
if (status == ALDataSource::Error)
|
||||||
|
{
|
||||||
|
sourceExhausted.set();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AL::Source::queueBuffer(alSrc, buf);
|
||||||
|
|
||||||
|
/* In case of buffer underrun,
|
||||||
|
* start playing again */
|
||||||
|
if (AL::Source::getState(alSrc) == AL_STOPPED)
|
||||||
|
AL::Source::play(alSrc);
|
||||||
|
|
||||||
|
/* If this was the last buffer before the data
|
||||||
|
* source loop wrapped around again, mark it as
|
||||||
|
* such so we can catch it and reset the processed
|
||||||
|
* sample count once it gets unqueued */
|
||||||
|
if (status == ALDataSource::WrapAround)
|
||||||
|
lastBuf = buf;
|
||||||
|
|
||||||
|
if (status == ALDataSource::EndOfStream)
|
||||||
|
sourceExhausted.set();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (threadTermReq)
|
||||||
|
break;
|
||||||
|
|
||||||
|
SDL_Delay(AUDIO_SLEEP);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
** alstream.h
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ALSTREAM_H
|
||||||
|
#define ALSTREAM_H
|
||||||
|
|
||||||
|
#include "al-util.h"
|
||||||
|
#include "sdl-util.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <SDL_rwops.h>
|
||||||
|
|
||||||
|
struct ALDataSource;
|
||||||
|
|
||||||
|
#define STREAM_BUFS 3
|
||||||
|
|
||||||
|
/* State-machine like audio playback stream.
|
||||||
|
* This class is NOT thread safe */
|
||||||
|
struct ALStream
|
||||||
|
{
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Closed,
|
||||||
|
Stopped,
|
||||||
|
Playing,
|
||||||
|
Paused
|
||||||
|
};
|
||||||
|
|
||||||
|
bool looped;
|
||||||
|
State state;
|
||||||
|
|
||||||
|
ALDataSource *source;
|
||||||
|
SDL_Thread *thread;
|
||||||
|
|
||||||
|
std::string threadName;
|
||||||
|
|
||||||
|
SDL_mutex *pauseMut;
|
||||||
|
bool preemptPause;
|
||||||
|
|
||||||
|
/* When this flag isn't set and alSrc is
|
||||||
|
* in 'STOPPED' state, stream isn't over
|
||||||
|
* (it just hasn't started yet) */
|
||||||
|
AtomicFlag streamInited;
|
||||||
|
AtomicFlag sourceExhausted;
|
||||||
|
|
||||||
|
AtomicFlag threadTermReq;
|
||||||
|
|
||||||
|
AtomicFlag needsRewind;
|
||||||
|
float startOffset;
|
||||||
|
|
||||||
|
float pitch;
|
||||||
|
|
||||||
|
AL::Source::ID alSrc;
|
||||||
|
AL::Buffer::ID alBuf[STREAM_BUFS];
|
||||||
|
|
||||||
|
uint64_t procFrames;
|
||||||
|
AL::Buffer::ID lastBuf;
|
||||||
|
|
||||||
|
SDL_RWops srcOps;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ALenum format;
|
||||||
|
ALsizei freq;
|
||||||
|
} stream;
|
||||||
|
|
||||||
|
enum LoopMode
|
||||||
|
{
|
||||||
|
Looped,
|
||||||
|
NotLooped
|
||||||
|
};
|
||||||
|
|
||||||
|
ALStream(LoopMode loopMode,
|
||||||
|
const std::string &threadId);
|
||||||
|
~ALStream();
|
||||||
|
|
||||||
|
void close();
|
||||||
|
void open(const std::string &filename);
|
||||||
|
void stop();
|
||||||
|
void play(float offset = 0);
|
||||||
|
void pause();
|
||||||
|
|
||||||
|
void setVolume(float value);
|
||||||
|
void setPitch(float value);
|
||||||
|
State queryState();
|
||||||
|
float queryOffset();
|
||||||
|
bool queryNativePitch();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void closeSource();
|
||||||
|
void openSource(const std::string &filename);
|
||||||
|
|
||||||
|
void stopStream();
|
||||||
|
void startStream(float offset);
|
||||||
|
void pauseStream();
|
||||||
|
void resumeStream();
|
||||||
|
|
||||||
|
void checkStopped();
|
||||||
|
|
||||||
|
/* thread func */
|
||||||
|
void streamData();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ALSTREAM_H
|
1537
src/audio.cpp
1537
src/audio.cpp
File diff suppressed because it is too large
Load Diff
23
src/audio.h
23
src/audio.h
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -33,27 +33,22 @@
|
||||||
* quite make out their meaning yet) */
|
* quite make out their meaning yet) */
|
||||||
|
|
||||||
struct AudioPrivate;
|
struct AudioPrivate;
|
||||||
|
struct RGSSThreadData;
|
||||||
|
|
||||||
class Audio
|
class Audio
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void bgmPlay(const char *filename,
|
void bgmPlay(const char *filename,
|
||||||
int volume = 100,
|
int volume = 100,
|
||||||
int pitch = 100
|
int pitch = 100,
|
||||||
#ifdef RGSS3
|
float pos = 0);
|
||||||
,float pos = 0
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
void bgmStop();
|
void bgmStop();
|
||||||
void bgmFade(int time);
|
void bgmFade(int time);
|
||||||
|
|
||||||
void bgsPlay(const char *filename,
|
void bgsPlay(const char *filename,
|
||||||
int volume = 100,
|
int volume = 100,
|
||||||
int pitch = 100
|
int pitch = 100,
|
||||||
#ifdef RGSS3
|
float pos = 0);
|
||||||
,float pos = 0
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
void bgsStop();
|
void bgsStop();
|
||||||
void bgsFade(int time);
|
void bgsFade(int time);
|
||||||
|
|
||||||
|
@ -68,14 +63,14 @@ public:
|
||||||
int pitch = 100);
|
int pitch = 100);
|
||||||
void seStop();
|
void seStop();
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
void setupMidi();
|
void setupMidi();
|
||||||
float bgmPos();
|
float bgmPos();
|
||||||
float bgsPos();
|
float bgsPos();
|
||||||
#endif
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Audio();
|
Audio(RGSSThreadData &rtData);
|
||||||
~Audio();
|
~Audio();
|
||||||
|
|
||||||
friend struct SharedStatePrivate;
|
friend struct SharedStatePrivate;
|
||||||
|
|
|
@ -0,0 +1,365 @@
|
||||||
|
/*
|
||||||
|
** audiostream.cpp
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "audiostream.h"
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
#include "exception.h"
|
||||||
|
|
||||||
|
#include <SDL_mutex.h>
|
||||||
|
#include <SDL_thread.h>
|
||||||
|
#include <SDL_timer.h>
|
||||||
|
|
||||||
|
AudioStream::AudioStream(ALStream::LoopMode loopMode,
|
||||||
|
const std::string &threadId)
|
||||||
|
: extPaused(false),
|
||||||
|
noResumeStop(false),
|
||||||
|
stream(loopMode, threadId)
|
||||||
|
{
|
||||||
|
current.volume = 1.0f;
|
||||||
|
current.pitch = 1.0f;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||||
|
volumes[i] = 1.0f;
|
||||||
|
|
||||||
|
fade.thread = 0;
|
||||||
|
fade.threadName = std::string("audio_fadeout (") + threadId + ")";
|
||||||
|
|
||||||
|
fadeIn.thread = 0;
|
||||||
|
fadeIn.threadName = std::string("audio_fadein (") + threadId + ")";
|
||||||
|
|
||||||
|
streamMut = SDL_CreateMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioStream::~AudioStream()
|
||||||
|
{
|
||||||
|
if (fade.thread)
|
||||||
|
{
|
||||||
|
fade.reqTerm.set();
|
||||||
|
SDL_WaitThread(fade.thread, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fadeIn.thread)
|
||||||
|
{
|
||||||
|
fadeIn.rqTerm.set();
|
||||||
|
SDL_WaitThread(fadeIn.thread, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
stream.stop();
|
||||||
|
stream.close();
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
SDL_DestroyMutex(streamMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::play(const std::string &filename,
|
||||||
|
int volume,
|
||||||
|
int pitch,
|
||||||
|
float offset)
|
||||||
|
{
|
||||||
|
finiFadeOutInt();
|
||||||
|
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
||||||
|
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
||||||
|
|
||||||
|
ALStream::State sState = stream.queryState();
|
||||||
|
|
||||||
|
/* If all parameters match the current ones and we're
|
||||||
|
* still playing, there's nothing to do */
|
||||||
|
if (filename == current.filename
|
||||||
|
&& _volume == current.volume
|
||||||
|
&& _pitch == current.pitch
|
||||||
|
&& (sState == ALStream::Playing || sState == ALStream::Paused))
|
||||||
|
{
|
||||||
|
unlockStream();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If all parameters except volume match the current ones,
|
||||||
|
* we update the volume and continue streaming */
|
||||||
|
if (filename == current.filename
|
||||||
|
&& _pitch == current.pitch
|
||||||
|
&& (sState == ALStream::Playing || sState == ALStream::Paused))
|
||||||
|
{
|
||||||
|
setVolume(Base, _volume);
|
||||||
|
current.volume = _volume;
|
||||||
|
unlockStream();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Requested audio file is different from current one */
|
||||||
|
bool diffFile = (filename != current.filename);
|
||||||
|
|
||||||
|
switch (sState)
|
||||||
|
{
|
||||||
|
case ALStream::Paused :
|
||||||
|
case ALStream::Playing :
|
||||||
|
stream.stop();
|
||||||
|
case ALStream::Stopped :
|
||||||
|
if (diffFile)
|
||||||
|
stream.close();
|
||||||
|
case ALStream::Closed :
|
||||||
|
if (diffFile)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/* This will throw on errors while
|
||||||
|
* opening the data source */
|
||||||
|
stream.open(filename);
|
||||||
|
}
|
||||||
|
catch (const Exception &e)
|
||||||
|
{
|
||||||
|
unlockStream();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVolume(Base, _volume);
|
||||||
|
stream.setPitch(_pitch);
|
||||||
|
|
||||||
|
if (offset > 0)
|
||||||
|
{
|
||||||
|
setVolume(FadeIn, 0);
|
||||||
|
startFadeIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
current.filename = filename;
|
||||||
|
current.volume = _volume;
|
||||||
|
current.pitch = _pitch;
|
||||||
|
|
||||||
|
if (!extPaused)
|
||||||
|
stream.play(offset);
|
||||||
|
else
|
||||||
|
noResumeStop = false;
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::stop()
|
||||||
|
{
|
||||||
|
finiFadeOutInt();
|
||||||
|
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
noResumeStop = true;
|
||||||
|
|
||||||
|
stream.stop();
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::fadeOut(int duration)
|
||||||
|
{
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
ALStream::State sState = stream.queryState();
|
||||||
|
noResumeStop = true;
|
||||||
|
|
||||||
|
if (fade.active)
|
||||||
|
{
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sState == ALStream::Paused)
|
||||||
|
{
|
||||||
|
stream.stop();
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sState != ALStream::Playing)
|
||||||
|
{
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fade.thread)
|
||||||
|
{
|
||||||
|
fade.reqFini.set();
|
||||||
|
SDL_WaitThread(fade.thread, 0);
|
||||||
|
fade.thread = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fade.active.set();
|
||||||
|
fade.msStep = 1.0f / duration;
|
||||||
|
fade.reqFini.clear();
|
||||||
|
fade.reqTerm.clear();
|
||||||
|
fade.startTicks = SDL_GetTicks();
|
||||||
|
|
||||||
|
fade.thread = createSDLThread
|
||||||
|
<AudioStream, &AudioStream::fadeOutThread>(this, fade.threadName);
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Any access to this classes 'stream' member,
|
||||||
|
* whether state query or modification, must be
|
||||||
|
* protected by a 'lock'/'unlock' pair */
|
||||||
|
void AudioStream::lockStream()
|
||||||
|
{
|
||||||
|
SDL_LockMutex(streamMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::unlockStream()
|
||||||
|
{
|
||||||
|
SDL_UnlockMutex(streamMut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::setVolume(VolumeType type, float value)
|
||||||
|
{
|
||||||
|
volumes[type] = value;
|
||||||
|
updateVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
float AudioStream::getVolume(VolumeType type)
|
||||||
|
{
|
||||||
|
return volumes[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
float AudioStream::playingOffset()
|
||||||
|
{
|
||||||
|
return stream.queryOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::updateVolume()
|
||||||
|
{
|
||||||
|
float vol = GLOBAL_VOLUME;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||||
|
vol *= volumes[i];
|
||||||
|
|
||||||
|
stream.setVolume(vol);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::finiFadeOutInt()
|
||||||
|
{
|
||||||
|
if (fade.thread)
|
||||||
|
{
|
||||||
|
fade.reqFini.set();
|
||||||
|
SDL_WaitThread(fade.thread, 0);
|
||||||
|
fade.thread = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fadeIn.thread)
|
||||||
|
{
|
||||||
|
fadeIn.rqFini.set();
|
||||||
|
SDL_WaitThread(fadeIn.thread, 0);
|
||||||
|
fadeIn.thread = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::startFadeIn()
|
||||||
|
{
|
||||||
|
/* Previous fadein should always be terminated in play() */
|
||||||
|
assert(!fadeIn.thread);
|
||||||
|
|
||||||
|
fadeIn.rqFini.clear();
|
||||||
|
fadeIn.rqTerm.clear();
|
||||||
|
fadeIn.startTicks = SDL_GetTicks();
|
||||||
|
|
||||||
|
fadeIn.thread = createSDLThread
|
||||||
|
<AudioStream, &AudioStream::fadeInThread>(this, fadeIn.threadName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::fadeOutThread()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
/* Just immediately terminate on request */
|
||||||
|
if (fade.reqTerm)
|
||||||
|
break;
|
||||||
|
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
uint32_t curDur = SDL_GetTicks() - fade.startTicks;
|
||||||
|
float resVol = 1.0f - (curDur*fade.msStep);
|
||||||
|
|
||||||
|
ALStream::State state = stream.queryState();
|
||||||
|
|
||||||
|
if (state != ALStream::Playing
|
||||||
|
|| resVol < 0
|
||||||
|
|| fade.reqFini)
|
||||||
|
{
|
||||||
|
if (state != ALStream::Paused)
|
||||||
|
stream.stop();
|
||||||
|
|
||||||
|
setVolume(FadeOut, 1.0f);
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVolume(FadeOut, resVol);
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
SDL_Delay(AUDIO_SLEEP);
|
||||||
|
}
|
||||||
|
|
||||||
|
fade.active.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioStream::fadeInThread()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (fadeIn.rqTerm)
|
||||||
|
break;
|
||||||
|
|
||||||
|
lockStream();
|
||||||
|
|
||||||
|
/* Fade in duration is always 1 second */
|
||||||
|
uint32_t cur = SDL_GetTicks() - fadeIn.startTicks;
|
||||||
|
float prog = cur / 1000.0f;
|
||||||
|
|
||||||
|
ALStream::State state = stream.queryState();
|
||||||
|
|
||||||
|
if (state != ALStream::Playing
|
||||||
|
|| prog >= 1.0f
|
||||||
|
|| fadeIn.rqFini)
|
||||||
|
{
|
||||||
|
setVolume(FadeIn, 1.0f);
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quadratic increase (not really the same as
|
||||||
|
* in RMVXA, but close enough) */
|
||||||
|
setVolume(FadeIn, prog*prog);
|
||||||
|
|
||||||
|
unlockStream();
|
||||||
|
|
||||||
|
SDL_Delay(AUDIO_SLEEP);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
** audiostream.h
|
||||||
|
**
|
||||||
|
** This file is part of mkxp.
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
|
**
|
||||||
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUDIOSTREAM_H
|
||||||
|
#define AUDIOSTREAM_H
|
||||||
|
|
||||||
|
#include "al-util.h"
|
||||||
|
#include "alstream.h"
|
||||||
|
#include "sdl-util.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct AudioStream
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
std::string filename;
|
||||||
|
float volume;
|
||||||
|
float pitch;
|
||||||
|
} current;
|
||||||
|
|
||||||
|
/* Volumes set by external threads,
|
||||||
|
* such as for fade-in/out.
|
||||||
|
* Multiplied together for final
|
||||||
|
* playback volume. Used with setVolume().
|
||||||
|
* Base is set by play().
|
||||||
|
* External is used by MeWatch */
|
||||||
|
enum VolumeType
|
||||||
|
{
|
||||||
|
Base = 0,
|
||||||
|
FadeOut,
|
||||||
|
FadeIn,
|
||||||
|
External,
|
||||||
|
|
||||||
|
VolumeTypeCount
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Note that 'extPaused' and 'noResumeStop' are
|
||||||
|
* effectively only used with the AudioStream
|
||||||
|
* instance representing the BGM.
|
||||||
|
* They are not AtomicFlags because they're regarded
|
||||||
|
* as part of the underlying stream state, and
|
||||||
|
* always accessed with the stream lock held */
|
||||||
|
|
||||||
|
/* Flag indicating that the MeWatch paused this
|
||||||
|
* (BGM) stream because a ME started playing.
|
||||||
|
* While this flag is set, calls to 'play()'
|
||||||
|
* might open another file, but will not start
|
||||||
|
* the playback stream (the MeWatch will start
|
||||||
|
* it as soon as the ME finished playing). */
|
||||||
|
bool extPaused;
|
||||||
|
|
||||||
|
/* Flag indicating that this stream shouldn't be
|
||||||
|
* started by the MeWatch when it is in stopped
|
||||||
|
* state (eg. because the BGM stream was explicitly
|
||||||
|
* stopped by the user script while the ME was playing.
|
||||||
|
* When a new BGM is started (via 'play()') while an ME
|
||||||
|
* is playing, the file will be loaded without starting
|
||||||
|
* the stream, but we want the MeWatch to start it as
|
||||||
|
* soon as the ME ends, so we unset this flag. */
|
||||||
|
bool noResumeStop;
|
||||||
|
|
||||||
|
ALStream stream;
|
||||||
|
SDL_mutex *streamMut;
|
||||||
|
|
||||||
|
/* Fade out */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* Fade out is in progress */
|
||||||
|
AtomicFlag active;
|
||||||
|
|
||||||
|
/* Request fade thread to finish and
|
||||||
|
* cleanup (like it normally would) */
|
||||||
|
AtomicFlag reqFini;
|
||||||
|
|
||||||
|
/* Request fade thread to terminate
|
||||||
|
* immediately */
|
||||||
|
AtomicFlag reqTerm;
|
||||||
|
|
||||||
|
SDL_Thread *thread;
|
||||||
|
std::string threadName;
|
||||||
|
|
||||||
|
/* Amount of reduced absolute volume
|
||||||
|
* per ms of fade time */
|
||||||
|
float msStep;
|
||||||
|
|
||||||
|
/* Ticks at start of fade */
|
||||||
|
uint32_t startTicks;
|
||||||
|
} fade;
|
||||||
|
|
||||||
|
/* Fade in */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
AtomicFlag rqFini;
|
||||||
|
AtomicFlag rqTerm;
|
||||||
|
|
||||||
|
SDL_Thread *thread;
|
||||||
|
std::string threadName;
|
||||||
|
|
||||||
|
uint32_t startTicks;
|
||||||
|
} fadeIn;
|
||||||
|
|
||||||
|
AudioStream(ALStream::LoopMode loopMode,
|
||||||
|
const std::string &threadId);
|
||||||
|
~AudioStream();
|
||||||
|
|
||||||
|
void play(const std::string &filename,
|
||||||
|
int volume,
|
||||||
|
int pitch,
|
||||||
|
float offset = 0);
|
||||||
|
void stop();
|
||||||
|
void fadeOut(int duration);
|
||||||
|
|
||||||
|
/* Any access to this classes 'stream' member,
|
||||||
|
* whether state query or modification, must be
|
||||||
|
* protected by a 'lock'/'unlock' pair */
|
||||||
|
void lockStream();
|
||||||
|
void unlockStream();
|
||||||
|
|
||||||
|
void setVolume(VolumeType type, float value);
|
||||||
|
float getVolume(VolumeType type);
|
||||||
|
|
||||||
|
float playingOffset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
float volumes[VolumeTypeCount];
|
||||||
|
void updateVolume();
|
||||||
|
|
||||||
|
void finiFadeOutInt();
|
||||||
|
void startFadeIn();
|
||||||
|
|
||||||
|
void fadeOutThread();
|
||||||
|
void fadeInThread();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // AUDIOSTREAM_H
|
|
@ -4,196 +4,196 @@ extern const StaticRect autotileRects[] =
|
||||||
{
|
{
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 32.5, 80.5, 15, 15 },
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 64.5, 15, 15 },
|
{ 48.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 32.5, 64.5, 15, 15 },
|
{ 32.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 0.5, 64.5, 15, 15 },
|
{ 0.5, 64.5, 15, 15 },
|
||||||
{ 16.5, 64.5, 15, 15 },
|
{ 16.5, 64.5, 15, 15 },
|
||||||
{ 16.5, 80.5, 15, 15 },
|
|
||||||
{ 0.5, 80.5, 15, 15 },
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
{ 0.5, 64.5, 15, 15 },
|
{ 0.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 16.5, 80.5, 15, 15 },
|
|
||||||
{ 0.5, 80.5, 15, 15 },
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
{ 0.5, 64.5, 15, 15 },
|
{ 0.5, 64.5, 15, 15 },
|
||||||
{ 16.5, 64.5, 15, 15 },
|
{ 16.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 0.5, 80.5, 15, 15 },
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 0.5, 64.5, 15, 15 },
|
{ 0.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 0.5, 80.5, 15, 15 },
|
{ 0.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 32.5, 15, 15 },
|
|
||||||
{ 48.5, 32.5, 15, 15 },
|
|
||||||
{ 48.5, 48.5, 15, 15 },
|
|
||||||
{ 32.5, 48.5, 15, 15 },
|
|
||||||
{ 32.5, 32.5, 15, 15 },
|
|
||||||
{ 48.5, 32.5, 15, 15 },
|
|
||||||
{ 80.5, 16.5, 15, 15 },
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 32.5, 48.5, 15, 15 },
|
|
||||||
{ 32.5, 32.5, 15, 15 },
|
{ 32.5, 32.5, 15, 15 },
|
||||||
{ 48.5, 32.5, 15, 15 },
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
{ 48.5, 48.5, 15, 15 },
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
{ 32.5, 32.5, 15, 15 },
|
{ 32.5, 32.5, 15, 15 },
|
||||||
{ 48.5, 32.5, 15, 15 },
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 64.5, 16.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 32.5, 48.5, 15, 15 },
|
|
||||||
{ 64.5, 64.5, 15, 15 },
|
{ 64.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 64.5, 15, 15 },
|
{ 80.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 80.5, 15, 15 },
|
{ 64.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 64.5, 15, 15 },
|
{ 64.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 64.5, 15, 15 },
|
{ 80.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 64.5, 15, 15 },
|
{ 80.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 80.5, 15, 15 },
|
{ 64.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 80.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 64.5, 15, 15 },
|
{ 80.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 80.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 96.5, 15, 15 },
|
{ 32.5, 96.5, 15, 15 },
|
||||||
{ 48.5, 96.5, 15, 15 },
|
{ 48.5, 96.5, 15, 15 },
|
||||||
{ 48.5, 112.5, 15, 15 },
|
|
||||||
{ 32.5, 112.5, 15, 15 },
|
{ 32.5, 112.5, 15, 15 },
|
||||||
|
{ 48.5, 112.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 96.5, 15, 15 },
|
{ 48.5, 96.5, 15, 15 },
|
||||||
{ 48.5, 112.5, 15, 15 },
|
|
||||||
{ 32.5, 112.5, 15, 15 },
|
{ 32.5, 112.5, 15, 15 },
|
||||||
|
{ 48.5, 112.5, 15, 15 },
|
||||||
{ 32.5, 96.5, 15, 15 },
|
{ 32.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 112.5, 15, 15 },
|
|
||||||
{ 32.5, 112.5, 15, 15 },
|
{ 32.5, 112.5, 15, 15 },
|
||||||
|
{ 48.5, 112.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 48.5, 112.5, 15, 15 },
|
|
||||||
{ 32.5, 112.5, 15, 15 },
|
{ 32.5, 112.5, 15, 15 },
|
||||||
|
{ 48.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 64.5, 15, 15 },
|
{ 0.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 64.5, 15, 15 },
|
{ 80.5, 64.5, 15, 15 },
|
||||||
{ 80.5, 80.5, 15, 15 },
|
|
||||||
{ 0.5, 80.5, 15, 15 },
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 80.5, 80.5, 15, 15 },
|
||||||
{ 32.5, 32.5, 15, 15 },
|
{ 32.5, 32.5, 15, 15 },
|
||||||
{ 48.5, 32.5, 15, 15 },
|
{ 48.5, 32.5, 15, 15 },
|
||||||
{ 48.5, 112.5, 15, 15 },
|
|
||||||
{ 32.5, 112.5, 15, 15 },
|
{ 32.5, 112.5, 15, 15 },
|
||||||
|
{ 48.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 32.5, 15, 15 },
|
{ 0.5, 32.5, 15, 15 },
|
||||||
{ 16.5, 32.5, 15, 15 },
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
{ 16.5, 48.5, 15, 15 },
|
{ 16.5, 48.5, 15, 15 },
|
||||||
{ 0.5, 48.5, 15, 15 },
|
|
||||||
{ 0.5, 32.5, 15, 15 },
|
{ 0.5, 32.5, 15, 15 },
|
||||||
{ 16.5, 32.5, 15, 15 },
|
{ 16.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 16.5, 15, 15 },
|
|
||||||
{ 0.5, 48.5, 15, 15 },
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 80.5, 16.5, 15, 15 },
|
||||||
{ 64.5, 32.5, 15, 15 },
|
{ 64.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 32.5, 15, 15 },
|
{ 80.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 48.5, 15, 15 },
|
|
||||||
{ 64.5, 48.5, 15, 15 },
|
{ 64.5, 48.5, 15, 15 },
|
||||||
|
{ 80.5, 48.5, 15, 15 },
|
||||||
{ 64.5, 32.5, 15, 15 },
|
{ 64.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 32.5, 15, 15 },
|
{ 80.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 48.5, 15, 15 },
|
|
||||||
{ 64.5, 16.5, 15, 15 },
|
{ 64.5, 16.5, 15, 15 },
|
||||||
|
{ 80.5, 48.5, 15, 15 },
|
||||||
{ 64.5, 96.5, 15, 15 },
|
{ 64.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 96.5, 15, 15 },
|
{ 80.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 112.5, 15, 15 },
|
|
||||||
{ 64.5, 112.5, 15, 15 },
|
{ 64.5, 112.5, 15, 15 },
|
||||||
|
{ 80.5, 112.5, 15, 15 },
|
||||||
{ 64.5, 0.5, 15, 15 },
|
{ 64.5, 0.5, 15, 15 },
|
||||||
{ 80.5, 96.5, 15, 15 },
|
{ 80.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 112.5, 15, 15 },
|
|
||||||
{ 64.5, 112.5, 15, 15 },
|
{ 64.5, 112.5, 15, 15 },
|
||||||
|
{ 80.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 96.5, 15, 15 },
|
{ 0.5, 96.5, 15, 15 },
|
||||||
{ 16.5, 96.5, 15, 15 },
|
{ 16.5, 96.5, 15, 15 },
|
||||||
{ 16.5, 112.5, 15, 15 },
|
|
||||||
{ 0.5, 112.5, 15, 15 },
|
{ 0.5, 112.5, 15, 15 },
|
||||||
|
{ 16.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 96.5, 15, 15 },
|
{ 0.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 0.5, 15, 15 },
|
{ 80.5, 0.5, 15, 15 },
|
||||||
{ 16.5, 112.5, 15, 15 },
|
|
||||||
{ 0.5, 112.5, 15, 15 },
|
{ 0.5, 112.5, 15, 15 },
|
||||||
|
{ 16.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 32.5, 15, 15 },
|
{ 0.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 32.5, 15, 15 },
|
{ 80.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 48.5, 15, 15 },
|
|
||||||
{ 0.5, 48.5, 15, 15 },
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 80.5, 48.5, 15, 15 },
|
||||||
{ 0.5, 32.5, 15, 15 },
|
{ 0.5, 32.5, 15, 15 },
|
||||||
{ 16.5, 32.5, 15, 15 },
|
{ 16.5, 32.5, 15, 15 },
|
||||||
{ 16.5, 112.5, 15, 15 },
|
|
||||||
{ 0.5, 112.5, 15, 15 },
|
{ 0.5, 112.5, 15, 15 },
|
||||||
|
{ 16.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 96.5, 15, 15 },
|
{ 0.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 96.5, 15, 15 },
|
{ 80.5, 96.5, 15, 15 },
|
||||||
{ 80.5, 112.5, 15, 15 },
|
|
||||||
{ 0.5, 112.5, 15, 15 },
|
{ 0.5, 112.5, 15, 15 },
|
||||||
|
{ 80.5, 112.5, 15, 15 },
|
||||||
{ 64.5, 32.5, 15, 15 },
|
{ 64.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 32.5, 15, 15 },
|
{ 80.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 112.5, 15, 15 },
|
|
||||||
{ 64.5, 112.5, 15, 15 },
|
{ 64.5, 112.5, 15, 15 },
|
||||||
|
{ 80.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 32.5, 15, 15 },
|
{ 0.5, 32.5, 15, 15 },
|
||||||
{ 80.5, 32.5, 15, 15 },
|
{ 80.5, 32.5, 15, 15 },
|
||||||
{ 16.5, 112.5, 15, 15 },
|
{ 0.5, 112.5, 15, 15 },
|
||||||
{ 64.5, 112.5, 15, 15 },
|
{ 80.5, 112.5, 15, 15 },
|
||||||
{ 0.5, 0.5, 15, 15 },
|
{ 0.5, 0.5, 15, 15 },
|
||||||
{ 16.5, 0.5, 15, 15 },
|
{ 16.5, 0.5, 15, 15 },
|
||||||
{ 16.5, 16.5, 15, 15 },
|
{ 0.5, 16.5, 15, 15 },
|
||||||
{ 0.5, 16.5, 15, 15 }
|
{ 16.5, 16.5, 15, 15 }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const int autotileRectsN = sizeof(autotileRects) / sizeof(autotileRects[0]);
|
extern const int autotileRectsN = sizeof(autotileRects) / sizeof(autotileRects[0]);
|
||||||
|
|
|
@ -0,0 +1,615 @@
|
||||||
|
struct StaticRect { float x, y, w, h; };
|
||||||
|
|
||||||
|
extern const StaticRect autotileVXRectsA[] =
|
||||||
|
{
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 }
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const int autotileVXRectsAN = sizeof(autotileVXRectsA) / sizeof(autotileVXRectsA[0]);
|
||||||
|
|
||||||
|
extern const StaticRect autotileVXRectsA2[] =
|
||||||
|
{
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 32.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 16.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 0, 0 },
|
||||||
|
{ 16.5, 16.5, 0, 0 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 16.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 64.5, 15, 15 },
|
||||||
|
{ 48.5, 64.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 80.5, 15, 15 },
|
||||||
|
{ 48.5, 80.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 }
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const int autotileVXRectsA2N = sizeof(autotileVXRectsA2) / sizeof(autotileVXRectsA2[0]);
|
||||||
|
|
||||||
|
extern const float autotileVXRectsA2Sizes[] =
|
||||||
|
{
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 0.0, 0.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0,
|
||||||
|
16.0, 16.0, 16.0, 16.0, 16.0, 16.0
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const StaticRect autotileVXRectsB[] =
|
||||||
|
{
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 16.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 16.5, 15, 15 },
|
||||||
|
{ 48.5, 16.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 16.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 16.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 16.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 32.5, 15, 15 },
|
||||||
|
{ 48.5, 32.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 32.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 32.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 },
|
||||||
|
{ 0.5, 0.5, 15, 15 },
|
||||||
|
{ 48.5, 0.5, 15, 15 },
|
||||||
|
{ 0.5, 48.5, 15, 15 },
|
||||||
|
{ 48.5, 48.5, 15, 15 }
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const int autotileVXRectsBN = sizeof(autotileVXRectsB) / sizeof(autotileVXRectsB[0]);
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -35,6 +35,10 @@ struct ScriptBinding
|
||||||
* function will perform a longjmp instead of returning,
|
* function will perform a longjmp instead of returning,
|
||||||
* so be careful about any variables with local storage */
|
* so be careful about any variables with local storage */
|
||||||
void (*terminate) (void);
|
void (*terminate) (void);
|
||||||
|
|
||||||
|
/* Instructs the binding to issue a game reset.
|
||||||
|
* Same conditions as for terminate apply */
|
||||||
|
void (*reset) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* VTable defined in the binding source */
|
/* VTable defined in the binding source */
|
||||||
|
|
640
src/bitmap.cpp
640
src/bitmap.cpp
File diff suppressed because it is too large
Load Diff
24
src/bitmap.h
24
src/bitmap.h
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -49,7 +49,7 @@ public:
|
||||||
IntRect rect() const;
|
IntRect rect() const;
|
||||||
|
|
||||||
void blt(int x, int y,
|
void blt(int x, int y,
|
||||||
const Bitmap &source, const IntRect &rect,
|
const Bitmap &source, IntRect rect,
|
||||||
int opacity = 255);
|
int opacity = 255);
|
||||||
|
|
||||||
void stretchBlt(const IntRect &destRect,
|
void stretchBlt(const IntRect &destRect,
|
||||||
|
@ -61,7 +61,6 @@ public:
|
||||||
const Vec4 &color);
|
const Vec4 &color);
|
||||||
void fillRect(const IntRect &rect, const Vec4 &color);
|
void fillRect(const IntRect &rect, const Vec4 &color);
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
void gradientFillRect(int x, int y,
|
void gradientFillRect(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
const Vec4 &color1, const Vec4 &color2,
|
const Vec4 &color1, const Vec4 &color2,
|
||||||
|
@ -75,14 +74,12 @@ public:
|
||||||
void clearRect(const IntRect &rect);
|
void clearRect(const IntRect &rect);
|
||||||
|
|
||||||
void blur();
|
void blur();
|
||||||
|
|
||||||
void radialBlur(int angle, int divisions);
|
void radialBlur(int angle, int divisions);
|
||||||
#endif
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
Vec4 getPixel(int x, int y) const;
|
Color getPixel(int x, int y) const;
|
||||||
void setPixel(int x, int y, const Vec4 &color);
|
void setPixel(int x, int y, const Color &color);
|
||||||
|
|
||||||
void hueChange(int hue);
|
void hueChange(int hue);
|
||||||
|
|
||||||
|
@ -102,12 +99,13 @@ public:
|
||||||
|
|
||||||
IntRect textSize(const char *str);
|
IntRect textSize(const char *str);
|
||||||
|
|
||||||
DECL_ATTR(Font, Font*)
|
DECL_ATTR(Font, Font&)
|
||||||
|
|
||||||
|
/* Sets initial reference without copying by value,
|
||||||
|
* use at construction */
|
||||||
|
void setInitFont(Font *value);
|
||||||
|
|
||||||
/* <internal> */
|
/* <internal> */
|
||||||
/* Warning: Flushing might change the current
|
|
||||||
* FBO binding (so don't call it during 'draw()' routines */
|
|
||||||
void flush() const;
|
|
||||||
TEXFBO &getGLTypes();
|
TEXFBO &getGLTypes();
|
||||||
SDL_Surface *megaSurface() const;
|
SDL_Surface *megaSurface() const;
|
||||||
void ensureNonMega() const;
|
void ensureNonMega() const;
|
||||||
|
@ -116,10 +114,14 @@ public:
|
||||||
* texture size uniform in shader */
|
* texture size uniform in shader */
|
||||||
void bindTex(ShaderBase &shader);
|
void bindTex(ShaderBase &shader);
|
||||||
|
|
||||||
|
/* Adds 'rect' to tainted area */
|
||||||
|
void taintArea(const IntRect &rect);
|
||||||
|
|
||||||
sigc::signal<void> modified;
|
sigc::signal<void> modified;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void releaseResources();
|
void releaseResources();
|
||||||
|
const char *klassName() const { return "bitmap"; }
|
||||||
|
|
||||||
BitmapPrivate *p;
|
BitmapPrivate *p;
|
||||||
};
|
};
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue