├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── bin └── torch.gb ├── info ├── torch_effect_anim.gif ├── torch_effect_scx_mod_8.gif ├── torch_effect_sprites_anim.gif ├── torch_effect_sprites_off.png ├── torch_effect_window_only.png └── torch_gb.png ├── res ├── calc │ └── radius_lut.xls ├── circle grid preview.xcf ├── circle_large.gbm ├── circle_large.gbm.tiles.gbr ├── circle_large.xcf ├── circle_large_tiles.c ├── circle_large_tiles.h ├── circle_small.gbm ├── circle_small.gbm.tiles.gbr ├── circle_small.xcf ├── circle_small_tiles.c ├── circle_small_tiles.h ├── dungeon_32x32.gbm ├── dungeon_32x32.gbr ├── dungeon_32x32.png ├── dungeon_map.c ├── dungeon_map.h ├── dungeon_tiles.c ├── dungeon_tiles.h ├── dungeon_tiles.png ├── sondanielson.itch.io.xcf ├── sprite.gbm ├── sprite.gbr ├── sprite.png ├── sprite_map.txt ├── sprite_tiles.c └── sprite_tiles.h ├── shintendo-method ├── Makefile ├── bin │ └── torch.gb ├── res │ ├── dungeon.c │ ├── dungeon.h │ ├── dungeon.png │ ├── sprite.c │ ├── sprite.h │ ├── sprite.png │ └── sprite_small.png ├── src │ ├── common.c │ ├── common.h │ └── main.c ├── torch.gif ├── torch_flicker.gif └── torch_gbdk_shintendo_method.gif └── src ├── common.c ├── common.h ├── lcd_isr.s ├── main.c ├── torch_sprite_data.c ├── torch_sprite_data.h ├── torch_win_data.c └── torch_win_data.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.lst 3 | *.o 4 | *.map 5 | *.cdb 6 | *.noi 7 | *.asm 8 | *.sym 9 | *.ihx 10 | *.gb 11 | *.zip 12 | archive/* 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | CC-BY-NC-SA: Attribution Non-Commercial Share Alike Creative Commons 3 | Attribution-NonCommercial-ShareAlike 4.0 International License 4 | 5 | See: http://creativecommons.org/licenses/by-nc-sa/4.0/ 6 | 7 | For the purposes of this project "Share Alike" shall also include 8 | distribution of the source code and any changes to it. 9 | 10 | ----------------------------------------------------- 11 | 12 | You are free to: * Share — copy and redistribute the material in any medium or 13 | format * Adapt — remix, transform, and build upon the material 14 | 15 | Under the following terms: * Attribution — You must give appropriate credit, 16 | provide a link to the license, and indicate if changes were made. You may do so 17 | in any reasonable manner, but not in any way that suggests the licensor endorses 18 | you or your use. 19 | 20 | * NonCommercial — You may not use the material for commercial purposes. 21 | 22 | * ShareAlike — If you remix, transform, or build upon the material, you must 23 | * distribute your contributions under the same license as the original. 24 | 25 | * No additional restrictions — You may not apply legal terms or technological 26 | * measures that legally restrict others from doing anything the license permits. 27 | 28 | 29 | No warranties are given. The license may not give you all of the permissions 30 | necessary for your intended use. 31 | 32 | 33 | ----------------------------------------------------- 34 | 35 | Creative Commons Corporation (“Creative Commons”) is not a law firm and does not 36 | provide legal services or legal advice. Distribution of Creative Commons public 37 | licenses does not create a lawyer-client or other relationship. Creative Commons 38 | makes its licenses and related information available on an “as-is” basis. 39 | Creative Commons gives no warranties regarding its licenses, any material 40 | licensed under their terms and conditions, or any related information. Creative 41 | Commons disclaims all liability for damages resulting from their use to the 42 | fullest extent possible. 43 | 44 | Using Creative Commons Public Licenses 45 | 46 | Creative Commons public licenses provide a standard set of terms and conditions 47 | that creators and other rights holders may use to share original works of 48 | authorship and other material subject to copyright and certain other rights 49 | specified in the public license below. The following considerations are for 50 | informational purposes only, are not exhaustive, and do not form part of our 51 | licenses. 52 | 53 | Considerations for licensors: Our public licenses are intended for use by those 54 | authorized to give the public permission to use material in ways otherwise 55 | restricted by copyright and certain other rights. Our licenses are irrevocable. 56 | Licensors should read and understand the terms and conditions of the license 57 | they choose before applying it. Licensors should also secure all rights 58 | necessary before applying our licenses so that the public can reuse the material 59 | as expected. Licensors should clearly mark any material not subject to the 60 | license. This includes other CC-licensed material, or material used under an 61 | exception or limitation to copyright. More considerations for licensors. 62 | 63 | 64 | Considerations for the public: By using one of our public licenses, a licensor 65 | grants the public permission to use the licensed material under specified terms 66 | and conditions. If the licensor’s permission is not necessary for any reason–for 67 | example, because of any applicable exception or limitation to copyright–then 68 | that use is not regulated by the license. Our licenses grant only permissions 69 | under copyright and certain other rights that a licensor has authority to grant. 70 | Use of the licensed material may still be restricted for other reasons, 71 | including because others have copyright or other rights in the material. A 72 | licensor may make special requests, such as asking that all changes be marked or 73 | described. Although not required by our licenses, you are encouraged to respect 74 | those requests where reasonable. More considerations for the public. 75 | 76 | 77 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public 78 | License By exercising the Licensed Rights (defined below), You accept and agree 79 | to be bound by the terms and conditions of this Creative Commons 80 | Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public 81 | License"). To the extent this Public License may be interpreted as a contract, 82 | You are granted the Licensed Rights in consideration of Your acceptance of these 83 | terms and conditions, and the Licensor grants You such rights in consideration 84 | of benefits the Licensor receives from making the Licensed Material available 85 | under these terms and conditions. 86 | 87 | Section 1 – Definitions. 88 | 89 | Adapted Material means material subject to Copyright and Similar Rights that is 90 | derived from or based upon the Licensed Material and in which the Licensed 91 | Material is translated, altered, arranged, transformed, or otherwise modified in 92 | a manner requiring permission under the Copyright and Similar Rights held by the 93 | Licensor. For purposes of this Public License, where the Licensed Material is a 94 | musical work, performance, or sound recording, Adapted Material is always 95 | produced where the Licensed Material is synched in timed relation with a moving 96 | image. Adapter's License means the license You apply to Your Copyright and 97 | Similar Rights in Your contributions to Adapted Material in accordance with the 98 | terms and conditions of this Public License. BY-NC-SA Compatible License means a 99 | license listed at creativecommons.org/compatiblelicenses, approved by Creative 100 | Commons as essentially the equivalent of this Public License. Copyright and 101 | Similar Rights means copyright and/or similar rights closely related to 102 | copyright including, without limitation, performance, broadcast, sound 103 | recording, and Sui Generis Database Rights, without regard to how the rights are 104 | labeled or categorized. For purposes of this Public License, the rights 105 | specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. Effective 106 | Technological Measures means those measures that, in the absence of proper 107 | authority, may not be circumvented under laws fulfilling obligations under 108 | Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or 109 | similar international agreements. Exceptions and Limitations means fair use, 110 | fair dealing, and/or any other exception or limitation to Copyright and Similar 111 | Rights that applies to Your use of the Licensed Material. License Elements means 112 | the license attributes listed in the name of a Creative Commons Public License. 113 | The License Elements of this Public License are Attribution, NonCommercial, and 114 | ShareAlike. Licensed Material means the artistic or literary work, database, or 115 | other material to which the Licensor applied this Public License. Licensed 116 | Rights means the rights granted to You subject to the terms and conditions of 117 | this Public License, which are limited to all Copyright and Similar Rights that 118 | apply to Your use of the Licensed Material and that the Licensor has authority 119 | to license. Licensor means the individual(s) or entity(ies) granting rights 120 | under this Public License. NonCommercial means not primarily intended for or 121 | directed towards commercial advantage or monetary compensation. For purposes of 122 | this Public License, the exchange of the Licensed Material for other material 123 | subject to Copyright and Similar Rights by digital file-sharing or similar means 124 | is NonCommercial provided there is no payment of monetary compensation in 125 | connection with the exchange. Share means to provide material to the public by 126 | any means or process that requires permission under the Licensed Rights, such as 127 | reproduction, public display, public performance, distribution, dissemination, 128 | communication, or importation, and to make material available to the public 129 | including in ways that members of the public may access the material from a 130 | place and at a time individually chosen by them. Sui Generis Database Rights 131 | means rights other than copyright resulting from Directive 96/9/EC of the 132 | European Parliament and of the Council of 11 March 1996 on the legal protection 133 | of databases, as amended and/or succeeded, as well as other essentially 134 | equivalent rights anywhere in the world. You means the individual or entity 135 | exercising the Licensed Rights under this Public License. Your has a 136 | corresponding meaning. Section 2 – Scope. 137 | 138 | License grant. Subject to the terms and conditions of this Public License, the 139 | Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, 140 | non-exclusive, irrevocable license to exercise the Licensed Rights in the 141 | Licensed Material to: reproduce and Share the Licensed Material, in whole or in 142 | part, for NonCommercial purposes only; and produce, reproduce, and Share Adapted 143 | Material for NonCommercial purposes only. Exceptions and Limitations. For the 144 | avoidance of doubt, where Exceptions and Limitations apply to Your use, this 145 | Public License does not apply, and You do not need to comply with its terms and 146 | conditions. Term. The term of this Public License is specified in Section 6(a). 147 | Media and formats; technical modifications allowed. The Licensor authorizes You 148 | to exercise the Licensed Rights in all media and formats whether now known or 149 | hereafter created, and to make technical modifications necessary to do so. The 150 | Licensor waives and/or agrees not to assert any right or authority to forbid You 151 | from making technical modifications necessary to exercise the Licensed Rights, 152 | including technical modifications necessary to circumvent Effective 153 | Technological Measures. For purposes of this Public License, simply making 154 | modifications authorized by this Section 2(a)(4) never produces Adapted 155 | Material. Downstream recipients. Offer from the Licensor – Licensed Material. 156 | Every recipient of the Licensed Material automatically receives an offer from 157 | the Licensor to exercise the Licensed Rights under the terms and conditions of 158 | this Public License. Additional offer from the Licensor – Adapted Material. 159 | Every recipient of Adapted Material from You automatically receives an offer 160 | from the Licensor to exercise the Licensed Rights in the Adapted Material under 161 | the conditions of the Adapter’s License You apply. No downstream restrictions. 162 | You may not offer or impose any additional or different terms or conditions on, 163 | or apply any Effective Technological Measures to, the Licensed Material if doing 164 | so restricts exercise of the Licensed Rights by any recipient of the Licensed 165 | Material. No endorsement. Nothing in this Public License constitutes or may be 166 | construed as permission to assert or imply that You are, or that Your use of the 167 | Licensed Material is, connected with, or sponsored, endorsed, or granted 168 | official status by, the Licensor or others designated to receive attribution as 169 | provided in Section 3(a)(1)(A)(i). Other rights. 170 | 171 | Moral rights, such as the right of integrity, are not licensed under this Public 172 | License, nor are publicity, privacy, and/or other similar personality rights; 173 | however, to the extent possible, the Licensor waives and/or agrees not to assert 174 | any such rights held by the Licensor to the limited extent necessary to allow 175 | You to exercise the Licensed Rights, but not otherwise. Patent and trademark 176 | rights are not licensed under this Public License. To the extent possible, the 177 | Licensor waives any right to collect royalties from You for the exercise of the 178 | Licensed Rights, whether directly or through a collecting society under any 179 | voluntary or waivable statutory or compulsory licensing scheme. In all other 180 | cases the Licensor expressly reserves any right to collect such royalties, 181 | including when the Licensed Material is used other than for NonCommercial 182 | purposes. Section 3 – License Conditions. 183 | 184 | Your exercise of the Licensed Rights is expressly made subject to the following 185 | conditions. 186 | 187 | Attribution. 188 | 189 | If You Share the Licensed Material (including in modified form), You must: 190 | 191 | retain the following if it is supplied by the Licensor with the Licensed 192 | Material: identification of the creator(s) of the Licensed Material and any 193 | others designated to receive attribution, in any reasonable manner requested by 194 | the Licensor (including by pseudonym if designated); a copyright notice; a 195 | notice that refers to this Public License; a notice that refers to the 196 | disclaimer of warranties; a URI or hyperlink to the Licensed Material to the 197 | extent reasonably practicable; indicate if You modified the Licensed Material 198 | and retain an indication of any previous modifications; and indicate the 199 | Licensed Material is licensed under this Public License, and include the text 200 | of, or the URI or hyperlink to, this Public License. You may satisfy the 201 | conditions in Section 3(a)(1) in any reasonable manner based on the medium, 202 | means, and context in which You Share the Licensed Material. For example, it may 203 | be reasonable to satisfy the conditions by providing a URI or hyperlink to a 204 | resource that includes the required information. If requested by the Licensor, 205 | You must remove any of the information required by Section 3(a)(1)(A) to the 206 | extent reasonably practicable. ShareAlike. In addition to the conditions in 207 | Section 3(a), if You Share Adapted Material You produce, the following 208 | conditions also apply. 209 | 210 | The Adapter’s License You apply must be a Creative Commons license with the same 211 | License Elements, this version or later, or a BY-NC-SA Compatible License. You 212 | must include the text of, or the URI or hyperlink to, the Adapter's License You 213 | apply. You may satisfy this condition in any reasonable manner based on the 214 | medium, means, and context in which You Share Adapted Material. You may not 215 | offer or impose any additional or different terms or conditions on, or apply any 216 | Effective Technological Measures to, Adapted Material that restrict exercise of 217 | the rights granted under the Adapter's License You apply. Section 4 – Sui 218 | Generis Database Rights. 219 | 220 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your 221 | use of the Licensed Material: 222 | 223 | for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, 224 | reuse, reproduce, and Share all or a substantial portion of the contents of the 225 | database for NonCommercial purposes only; if You include all or a substantial 226 | portion of the database contents in a database in which You have Sui Generis 227 | Database Rights, then the database in which You have Sui Generis Database Rights 228 | (but not its individual contents) is Adapted Material, including for purposes of 229 | Section 3(b); and You must comply with the conditions in Section 3(a) if You 230 | Share all or a substantial portion of the contents of the database. For the 231 | avoidance of doubt, this Section 4 supplements and does not replace Your 232 | obligations under this Public License where the Licensed Rights include other 233 | Copyright and Similar Rights. Section 5 – Disclaimer of Warranties and 234 | Limitation of Liability. 235 | 236 | Unless otherwise separately undertaken by the Licensor, to the extent possible, 237 | the Licensor offers the Licensed Material as-is and as-available, and makes no 238 | representations or warranties of any kind concerning the Licensed Material, 239 | whether express, implied, statutory, or other. This includes, without 240 | limitation, warranties of title, merchantability, fitness for a particular 241 | purpose, non-infringement, absence of latent or other defects, accuracy, or the 242 | presence or absence of errors, whether or not known or discoverable. Where 243 | disclaimers of warranties are not allowed in full or in part, this disclaimer 244 | may not apply to You. To the extent possible, in no event will the Licensor be 245 | liable to You on any legal theory (including, without limitation, negligence) or 246 | otherwise for any direct, special, indirect, incidental, consequential, 247 | punitive, exemplary, or other losses, costs, expenses, or damages arising out of 248 | this Public License or use of the Licensed Material, even if the Licensor has 249 | been advised of the possibility of such losses, costs, expenses, or damages. 250 | Where a limitation of liability is not allowed in full or in part, this 251 | limitation may not apply to You. The disclaimer of warranties and limitation of 252 | liability provided above shall be interpreted in a manner that, to the extent 253 | possible, most closely approximates an absolute disclaimer and waiver of all 254 | liability. Section 6 – Term and Termination. 255 | 256 | This Public License applies for the term of the Copyright and Similar Rights 257 | licensed here. However, if You fail to comply with this Public License, then 258 | Your rights under this Public License terminate automatically. Where Your right 259 | to use the Licensed Material has terminated under Section 6(a), it reinstates: 260 | 261 | automatically as of the date the violation is cured, provided it is cured within 262 | 30 days of Your discovery of the violation; or upon express reinstatement by the 263 | Licensor. For the avoidance of doubt, this Section 6(b) does not affect any 264 | right the Licensor may have to seek remedies for Your violations of this Public 265 | License. For the avoidance of doubt, the Licensor may also offer the Licensed 266 | Material under separate terms or conditions or stop distributing the Licensed 267 | Material at any time; however, doing so will not terminate this Public License. 268 | Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 269 | – Other Terms and Conditions. 270 | 271 | The Licensor shall not be bound by any additional or different terms or 272 | conditions communicated by You unless expressly agreed. Any arrangements, 273 | understandings, or agreements regarding the Licensed Material not stated herein 274 | are separate from and independent of the terms and conditions of this Public 275 | License. Section 8 – Interpretation. 276 | 277 | For the avoidance of doubt, this Public License does not, and shall not be 278 | interpreted to, reduce, limit, restrict, or impose conditions on any use of the 279 | Licensed Material that could lawfully be made without permission under this 280 | Public License. To the extent possible, if any provision of this Public License 281 | is deemed unenforceable, it shall be automatically reformed to the minimum 282 | extent necessary to make it enforceable. If the provision cannot be reformed, it 283 | shall be severed from this Public License without affecting the enforceability 284 | of the remaining terms and conditions. No term or condition of this Public 285 | License will be waived and no failure to comply consented to unless expressly 286 | agreed to by the Licensor. Nothing in this Public License constitutes or may be 287 | interpreted as a limitation upon, or waiver of, any privileges and immunities 288 | that apply to the Licensor or You, including from the legal processes of any 289 | jurisdiction or authority. Creative Commons is not a party to its public 290 | licenses. Notwithstanding, Creative Commons may elect to apply one of its public 291 | licenses to material it publishes and in those instances will be considered the 292 | “Licensor.” The text of the Creative Commons public licenses is dedicated to the 293 | public domain under the CC0 Public Domain Dedication. Except for the limited 294 | purpose of indicating that material is shared under a Creative Commons public 295 | license or as otherwise permitted by the Creative Commons policies published at 296 | creativecommons.org/policies, Creative Commons does not authorize the use of the 297 | trademark “Creative Commons” or any other trademark or logo of Creative Commons 298 | without its prior written consent including, without limitation, in connection 299 | with any unauthorized modifications to any of its public licenses or any other 300 | arrangements, understandings, or agreements concerning use of licensed material. 301 | For the avoidance of doubt, this paragraph does not form part of the public 302 | licenses. 303 | 304 | Creative Commons may be contacted at creativecommons.org. 305 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GBDK_HOME="../../gbdk2020/gbdk-2020-git/build/gbdk/" 2 | export BGB="../../tools/bgbw64-1.5.8/bgb64.exe" 3 | 4 | LCC = $(GBDK_HOME)bin/lcc -Wa-l -Wl-m -Wl-j -Wl-y -v -Wl-b_CODE=0x0300 5 | 6 | # CFLAGS = -DGBDK_2_COMPAT 7 | 8 | OBJDIR = obj 9 | SRCDIR = src 10 | BINS = torch.gb 11 | CSOURCES := $(wildcard $(SRCDIR)/*.c) $(wildcard res/*.c) 12 | ASMSOURCES := $(wildcard $(SRCDIR)/*.s) 13 | # OBJS = $(CSOURCES:%.c=%.o) $(ASMSOURCES:%.s=%.o) 14 | OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o) 15 | 16 | all: $(BINS) 17 | 18 | make.bat: Makefile 19 | @echo "REM Automatically generated from Makefile" > make.bat 20 | @make -sn | sed y/\\//\\\\/ | grep -v make >> make.bat 21 | 22 | $(OBJDIR)/%.o: %.c 23 | $(LCC) $(CFLAGS) -c -o $@ $< 24 | 25 | $(OBJDIR)/res/%.o: %.c 26 | $(LCC) $(CFLAGS) -c -o $@ $< 27 | 28 | 29 | $(OBJDIR)/%.o: %.s 30 | $(LCC) $(CFLAGS) -c -o $@ $< 31 | 32 | %.s: %.c 33 | $(LCC) $(CFLAGS) -S -o $@ $< 34 | 35 | # Link the compiled object files into a autobanks.gb ROM file 36 | $(BINS): $(OBJS) 37 | $(LCC) $(CFLAGS) -o $(BINS) $(OBJS) 38 | 39 | clean: 40 | rm -f *.gb *.ihx *.cdb *.adb *.noi *.map 41 | rm -f $(OBJDIR)/*.* $(OBJDIR)/res/*.* 42 | 43 | usage: 44 | ../../tools/romusage/romusage torch.noi -a -g 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Spotlight / Torch effect Demo for the Game Boy 3 | ============================================== 4 | 5 | This demo shows small circles of a background map visible among a larger dark area, while still allowing the background map to scroll freely. Temporal blending of alternating frames creates the semi-transparent effect for the medium sized circle. 6 | 7 | It looks like a simple, yet it's not a straightforward effect given the limited graphics abilities of the Game Boy. I learned a lot in the process of making this. 8 | 9 | ![Game Boy video of torch effect demo](/info/torch_effect_anim.gif) 10 | 11 | The demo works in emulators and on actual hardware. 12 | See releases for a ROM file. 13 | 14 | # Alternate Method 15 | 16 | [Shintendo](https://twitter.com/shintendoYT) made a demo using a different method using Background / Object priority and Palettes. 17 | 18 | Related tweet: https://twitter.com/shintendoYT/status/1620576705139314695 19 | 20 | * Entire background palette is black (or a dimmed version of the palette) 21 | * The torch circle and player are a large metasprite (composed of multiple sprites) 22 | * Priority is set so the sprite is behind the background (transparent parts show as background black) 23 | 24 | The player and torch circle will show through wherever color 0 is used in the background. This approach has the benefit of being much easier to actually use though the background is effectively 2 colors only. There is a GBDK version of this in the `shintendo-method` folder. 25 | 26 | Example using GBDK and similar assets to above: 27 | ![Shintendo's method of a torch effect](/shintendo-method/torch_gbdk_shintendo_method.gif) 28 | 29 | 30 | # My Implementation 31 | 32 | There are two background maps: 33 | * One is a dungeon tileset and map 34 | * Another is a map filled with all-black tiles 35 | 36 | Above and Below the torch area: 37 | * The background map is set to all-black one 38 | 39 | Left edge curve mask: 40 | * The background map swaps (~ 1/4 through the scanline) from all-black to the dungeon map 41 | * Some sprites are used to create the arc shape and cover some background (X scroll % 8) behavior (see below) 42 | 43 | Right edge curve mask: 44 | * The X start location of the Window layer is moved based on the current scanline using a Look-up-Table (LUT) 45 | 46 | A scanline ISR is set to fire when it reaches the top of the torch area 47 | * It waits for the end of H-Blank and then starts a loop that's timed to exactly match the duration of each scanline. The loop exits when the bottom of the torch area is reached 48 | * In each iteration of the loop 49 | * H-Blank: Load the new Window layer X start location 50 | * Switch the background map to all-black 51 | * Wait a while then switch from the background map to the dungeon map 52 | 53 | Every other frame a larger or smaller circle is displayed 54 | * A couple of the Left masking sprites are swapped 55 | * A different Window X start Look-up-Table is selected 56 | 57 | 58 | # Additional Details 59 | 60 | The left edge sprite layout: 61 | (The left most column of masking sprites has since been removed) 62 | 63 | ![Masking Sprite layout](/info/torch_effect_sprites_anim.gif) 64 | 65 | 66 | And with sprites turned off: 67 | 68 | ![Sprites Off](/info/torch_effect_sprites_off.png) 69 | 70 | 71 | Why are there extra sprites as a column mask on the Left in addition to the ones used for the arc shape? 72 | 73 | When the background map is swapped mid-scanline, the pixel that change takes effect on will vary based on the background map X scroll register modulo 8. This is due to how the Game Boy implements X scrolling with the LCD. 74 | 75 | With the sprite masking turned off the offset is visible. The extra column of sprites are used to hide this variability. 76 | 77 | ![Window Masking](/info/torch_effect_scx_mod_8.gif) 78 | 79 | 80 | Here, to show the Window layer masking, the sprites are off *AND* the background set to a solid color instead of the dungeon map. 81 | 82 | The dark part is the Window layer. Two different arc shapes are visible since there is a different one for each alternating frame. The horizontal line at the top of the arcs is ~when the ISR starts for a given arc size. 83 | 84 | ![Window Masking](/info/torch_effect_window_only.png) 85 | 86 | 87 | 88 | # Limitations 89 | * Right now the demo only works when the sprite is centered in the screen. Adding support for moving the torch area vertically would probably not be too hard. Horizontal movement of the torch area may be possible but would require careful timing adjustments of the left edge as it moved back and forth. 90 | 91 | 92 | # Credits: 93 | * The dungeon tileset and sprite are from - https://sondanielson.itch.io/gameboy-simple-rpg-tileset 94 | * A very readable description of Game Boy render and LCD timing behavior - http://blog.kevtris.org/blogfiles/Nitty%20Gritty%20Gameboy%20VRAM%20Timing.txt 95 | * Pandocs info on rendering - https://gbdev.io/pandocs/pixel_fifo.html 96 | 97 | 98 | # Tools 99 | * Built with GBDK-2020 - https://github.com/gbdk-2020/gbdk-2020 100 | * Emulicious emulator - https://emulicious.net/ 101 | * BGB emulator - https://bgb.bircd.org/ 102 | * GIMP TileMap GB - https://github.com/bbbbbr/gimp-tilemap 103 | * Game Boy Tile Designer / Map Builder - https://github.com/gbdk-2020/GBTD_GBMB 104 | 105 | -------------------------------------------------------------------------------- /bin/torch.gb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/bin/torch.gb -------------------------------------------------------------------------------- /info/torch_effect_anim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_effect_anim.gif -------------------------------------------------------------------------------- /info/torch_effect_scx_mod_8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_effect_scx_mod_8.gif -------------------------------------------------------------------------------- /info/torch_effect_sprites_anim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_effect_sprites_anim.gif -------------------------------------------------------------------------------- /info/torch_effect_sprites_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_effect_sprites_off.png -------------------------------------------------------------------------------- /info/torch_effect_window_only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_effect_window_only.png -------------------------------------------------------------------------------- /info/torch_gb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/info/torch_gb.png -------------------------------------------------------------------------------- /res/calc/radius_lut.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/calc/radius_lut.xls -------------------------------------------------------------------------------- /res/circle grid preview.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle grid preview.xcf -------------------------------------------------------------------------------- /res/circle_large.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_large.gbm -------------------------------------------------------------------------------- /res/circle_large.gbm.tiles.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_large.gbm.tiles.gbr -------------------------------------------------------------------------------- /res/circle_large.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_large.xcf -------------------------------------------------------------------------------- /res/circle_large_tiles.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | CIRCLE_LARGE_TILES.C 4 | 5 | Tile Source File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 16 13 | Tiles : 0 to 5 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | /* Start of tile array. */ 26 | const unsigned char circle_large_tiles[] = 27 | { 28 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 29 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 30 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 31 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 32 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 33 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 34 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 35 | 0xFF,0xFF,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8, 36 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 37 | 0xFF,0xFF,0xFE,0xFE,0xFC,0xFC,0xF8,0xF8, 38 | 0xE0,0xE0,0xC0,0xC0,0x80,0x80,0x00,0x00, 39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 40 | 0xFF,0xFF,0xFF,0xFF,0xF8,0xF8,0xE0,0xE0, 41 | 0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 42 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 43 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 44 | 0xFF,0xFF,0x80,0x80,0x00,0x00,0x00,0x00, 45 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 47 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 48 | 0xF8,0xF8,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0, 49 | 0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0, 50 | 0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80, 51 | 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 52 | }; 53 | 54 | /* End of CIRCLE_LARGE_TILES.C */ 55 | -------------------------------------------------------------------------------- /res/circle_large_tiles.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | CIRCLE_LARGE_TILES.H 4 | 5 | Include File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 16 13 | Tiles : 0 to 5 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | #ifndef __circle_large_tiles_h_INCLUDE 26 | #define __circle_large_tiles_h_INCLUDE 27 | 28 | /* Bank of tiles. */ 29 | #define circle_large_tilesBank 0 30 | 31 | /* Super Gameboy palette 0 */ 32 | #define circle_large_tilesSGBPal0c0 0 33 | #define circle_large_tilesSGBPal0c1 19744 34 | #define circle_large_tilesSGBPal0c2 26640 35 | #define circle_large_tilesSGBPal0c3 15 36 | 37 | /* Super Gameboy palette 1 */ 38 | #define circle_large_tilesSGBPal1c0 6076 39 | #define circle_large_tilesSGBPal1c1 8935 40 | #define circle_large_tilesSGBPal1c2 6596 41 | #define circle_large_tilesSGBPal1c3 5344 42 | 43 | /* Super Gameboy palette 2 */ 44 | #define circle_large_tilesSGBPal2c0 6076 45 | #define circle_large_tilesSGBPal2c1 8935 46 | #define circle_large_tilesSGBPal2c2 6596 47 | #define circle_large_tilesSGBPal2c3 5344 48 | 49 | /* Super Gameboy palette 3 */ 50 | #define circle_large_tilesSGBPal3c0 6076 51 | #define circle_large_tilesSGBPal3c1 8935 52 | #define circle_large_tilesSGBPal3c2 6596 53 | #define circle_large_tilesSGBPal3c3 5344 54 | 55 | /* Gameboy Color palette 0 */ 56 | #define circle_large_tilesCGBPal0c0 5383 57 | #define circle_large_tilesCGBPal0c1 16085 58 | #define circle_large_tilesCGBPal0c2 22396 59 | #define circle_large_tilesCGBPal0c3 31743 60 | 61 | /* Gameboy Color palette 1 */ 62 | #define circle_large_tilesCGBPal1c0 18960 63 | #define circle_large_tilesCGBPal1c1 10503 64 | #define circle_large_tilesCGBPal1c2 0 65 | #define circle_large_tilesCGBPal1c3 531 66 | 67 | /* Gameboy Color palette 2 */ 68 | #define circle_large_tilesCGBPal2c0 506 69 | #define circle_large_tilesCGBPal2c1 14752 70 | #define circle_large_tilesCGBPal2c2 8436 71 | #define circle_large_tilesCGBPal2c3 10 72 | 73 | /* Gameboy Color palette 3 */ 74 | #define circle_large_tilesCGBPal3c0 17309 75 | #define circle_large_tilesCGBPal3c1 16192 76 | #define circle_large_tilesCGBPal3c2 4096 77 | #define circle_large_tilesCGBPal3c3 22549 78 | 79 | /* Gameboy Color palette 4 */ 80 | #define circle_large_tilesCGBPal4c0 2 81 | #define circle_large_tilesCGBPal4c1 21632 82 | #define circle_large_tilesCGBPal4c2 32448 83 | #define circle_large_tilesCGBPal4c3 15 84 | 85 | /* Gameboy Color palette 5 */ 86 | #define circle_large_tilesCGBPal5c0 20940 87 | #define circle_large_tilesCGBPal5c1 10503 88 | #define circle_large_tilesCGBPal5c2 16384 89 | #define circle_large_tilesCGBPal5c3 7760 90 | 91 | /* Gameboy Color palette 6 */ 92 | #define circle_large_tilesCGBPal6c0 328 93 | #define circle_large_tilesCGBPal6c1 0 94 | #define circle_large_tilesCGBPal6c2 0 95 | #define circle_large_tilesCGBPal6c3 0 96 | 97 | /* Gameboy Color palette 7 */ 98 | #define circle_large_tilesCGBPal7c0 21566 99 | #define circle_large_tilesCGBPal7c1 10503 100 | #define circle_large_tilesCGBPal7c2 0 101 | #define circle_large_tilesCGBPal7c3 0 102 | /* Start of tile array. */ 103 | extern const unsigned char circle_large_tiles[]; 104 | 105 | #endif 106 | 107 | /* End of CIRCLE_LARGE_TILES.H */ 108 | -------------------------------------------------------------------------------- /res/circle_small.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_small.gbm -------------------------------------------------------------------------------- /res/circle_small.gbm.tiles.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_small.gbm.tiles.gbr -------------------------------------------------------------------------------- /res/circle_small.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/circle_small.xcf -------------------------------------------------------------------------------- /res/circle_small_tiles.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | CIRCLE_SMALL_TILES.C 4 | 5 | Tile Source File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 16 13 | Tiles : 0 to 2 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | /* Start of tile array. */ 26 | const unsigned char circle_small_tiles[] = 27 | { 28 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 29 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 30 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 31 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 32 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE, 33 | 0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0, 34 | 0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0x80,0x80, 35 | 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 36 | 0xFF,0xFF,0xE0,0xE0,0x80,0x80,0x00,0x00, 37 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 38 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 40 | }; 41 | 42 | /* End of CIRCLE_SMALL_TILES.C */ 43 | -------------------------------------------------------------------------------- /res/circle_small_tiles.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | CIRCLE_SMALL_TILES.H 4 | 5 | Include File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 16 13 | Tiles : 0 to 2 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | #ifndef __circle_small_tiles_h_INCLUDE 26 | #define __circle_small_tiles_h_INCLUDE 27 | 28 | /* Bank of tiles. */ 29 | #define circle_small_tilesBank 0 30 | 31 | /* Super Gameboy palette 0 */ 32 | #define circle_small_tilesSGBPal0c0 0 33 | #define circle_small_tilesSGBPal0c1 15648 34 | #define circle_small_tilesSGBPal0c2 16082 35 | #define circle_small_tilesSGBPal0c3 15 36 | 37 | /* Super Gameboy palette 1 */ 38 | #define circle_small_tilesSGBPal1c0 6076 39 | #define circle_small_tilesSGBPal1c1 8935 40 | #define circle_small_tilesSGBPal1c2 6596 41 | #define circle_small_tilesSGBPal1c3 5344 42 | 43 | /* Super Gameboy palette 2 */ 44 | #define circle_small_tilesSGBPal2c0 6076 45 | #define circle_small_tilesSGBPal2c1 8935 46 | #define circle_small_tilesSGBPal2c2 6596 47 | #define circle_small_tilesSGBPal2c3 5344 48 | 49 | /* Super Gameboy palette 3 */ 50 | #define circle_small_tilesSGBPal3c0 6076 51 | #define circle_small_tilesSGBPal3c1 8935 52 | #define circle_small_tilesSGBPal3c2 6596 53 | #define circle_small_tilesSGBPal3c3 5344 54 | 55 | /* Gameboy Color palette 0 */ 56 | #define circle_small_tilesCGBPal0c0 5383 57 | #define circle_small_tilesCGBPal0c1 16085 58 | #define circle_small_tilesCGBPal0c2 22396 59 | #define circle_small_tilesCGBPal0c3 31743 60 | 61 | /* Gameboy Color palette 1 */ 62 | #define circle_small_tilesCGBPal1c0 9936 63 | #define circle_small_tilesCGBPal1c1 11096 64 | #define circle_small_tilesCGBPal1c2 0 65 | #define circle_small_tilesCGBPal1c3 23119 66 | 67 | /* Gameboy Color palette 2 */ 68 | #define circle_small_tilesCGBPal2c0 495 69 | #define circle_small_tilesCGBPal2c1 32160 70 | #define circle_small_tilesCGBPal2c2 27403 71 | #define circle_small_tilesCGBPal2c3 10 72 | 73 | /* Gameboy Color palette 3 */ 74 | #define circle_small_tilesCGBPal3c0 19229 75 | #define circle_small_tilesCGBPal3c1 15862 76 | #define circle_small_tilesCGBPal3c2 10240 77 | #define circle_small_tilesCGBPal3c3 10439 78 | 79 | /* Gameboy Color palette 4 */ 80 | #define circle_small_tilesCGBPal4c0 2 81 | #define circle_small_tilesCGBPal4c1 7488 82 | #define circle_small_tilesCGBPal4c2 32070 83 | #define circle_small_tilesCGBPal4c3 15 84 | 85 | /* Gameboy Color palette 5 */ 86 | #define circle_small_tilesCGBPal5c0 12268 87 | #define circle_small_tilesCGBPal5c1 11096 88 | #define circle_small_tilesCGBPal5c2 16384 89 | #define circle_small_tilesCGBPal5c3 24886 90 | 91 | /* Gameboy Color palette 6 */ 92 | #define circle_small_tilesCGBPal6c0 346 93 | #define circle_small_tilesCGBPal6c1 0 94 | #define circle_small_tilesCGBPal6c2 0 95 | #define circle_small_tilesCGBPal6c3 0 96 | 97 | /* Gameboy Color palette 7 */ 98 | #define circle_small_tilesCGBPal7c0 13094 99 | #define circle_small_tilesCGBPal7c1 11096 100 | #define circle_small_tilesCGBPal7c2 0 101 | #define circle_small_tilesCGBPal7c3 0 102 | /* Start of tile array. */ 103 | extern const unsigned char circle_small_tiles[]; 104 | 105 | #endif 106 | 107 | /* End of CIRCLE_SMALL_TILES.H */ 108 | -------------------------------------------------------------------------------- /res/dungeon_32x32.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/dungeon_32x32.gbm -------------------------------------------------------------------------------- /res/dungeon_32x32.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/dungeon_32x32.gbr -------------------------------------------------------------------------------- /res/dungeon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/dungeon_32x32.png -------------------------------------------------------------------------------- /res/dungeon_map.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | DUNGEON_MAP.C 4 | 5 | Map Source File. 6 | 7 | Info: 8 | Section : 9 | Bank : 0 10 | Map size : 32 x 32 11 | Tile set : dungeon_32x32.gbr 12 | Plane count : 1 plane (8 bits) 13 | Plane order : Planes are continues 14 | Tile offset : 0 15 | Split data : No 16 | 17 | This file was generated by GBMB v1.8 18 | 19 | */ 20 | 21 | #define dungeon_mapWidth 32 22 | #define dungeon_mapHeight 32 23 | #define dungeon_mapBank 0 24 | 25 | #define dungeon_map dungeon_mapPLN0 26 | const unsigned char dungeon_mapPLN0[] = 27 | { 28 | 0x0A,0x0B,0x07,0x05,0x06,0x04,0x07,0x03,0x04,0x07, 29 | 0x03,0x04,0x07,0x08,0x09,0x01,0x0A,0x0B,0x07,0x07, 30 | 0x03,0x04,0x07,0x03,0x04,0x07,0x03,0x04,0x03,0x0C, 31 | 0x08,0x09,0x0D,0x0E,0x0F,0x12,0x13,0x11,0x0F,0x10, 32 | 0x11,0x0F,0x10,0x11,0x0F,0x14,0x15,0x01,0x0D,0x0E, 33 | 0x0F,0x0F,0x10,0x11,0x0F,0x10,0x11,0x0F,0x10,0x11, 34 | 0x10,0x16,0x14,0x15,0x17,0x18,0x00,0x00,0x00,0x00, 35 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x1A,0x01, 36 | 0x1B,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 37 | 0x00,0x00,0x00,0x00,0x1D,0x1E,0x1F,0x1C,0x00,0x00, 38 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19, 39 | 0x1A,0x01,0x1F,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, 40 | 0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x1A,0x1B,0x20, 41 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 42 | 0x00,0x21,0x22,0x01,0x1F,0x1C,0x00,0x00,0x00,0x00, 43 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x22, 44 | 0x1F,0x1C,0x00,0x00,0x00,0x23,0x24,0x25,0x24,0x26, 45 | 0x00,0x00,0x00,0x27,0x28,0x01,0x17,0x18,0x00,0x00, 46 | 0x00,0x23,0x24,0x25,0x24,0x26,0x00,0x00,0x00,0x00, 47 | 0x27,0x28,0x17,0x18,0x00,0x00,0x00,0x19,0x2B,0x2C, 48 | 0x2D,0x20,0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C, 49 | 0x00,0x00,0x00,0x19,0x2B,0x2C,0x2D,0x20,0x00,0x00, 50 | 0x00,0x00,0x19,0x1A,0x1F,0x1C,0x00,0x00,0x00,0x21, 51 | 0x22,0x01,0x1F,0x1C,0x00,0x00,0x00,0x21,0x15,0x01, 52 | 0x0D,0x1C,0x00,0x00,0x00,0x21,0x22,0x01,0x1F,0x1C, 53 | 0x00,0x00,0x00,0x00,0x21,0x22,0x1B,0x20,0x00,0x00, 54 | 0x00,0x27,0x28,0x01,0x17,0x18,0x00,0x00,0x00,0x30, 55 | 0x31,0x32,0x33,0x20,0x00,0x00,0x00,0x21,0x22,0x01, 56 | 0x1F,0x1C,0x00,0x00,0x00,0x00,0x19,0x1A,0x1F,0x1C, 57 | 0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C,0x00,0x00, 58 | 0x00,0x34,0x35,0x0F,0x10,0x36,0x00,0x00,0x00,0x27, 59 | 0x28,0x01,0x17,0x18,0x00,0x00,0x00,0x00,0x21,0x22, 60 | 0x1F,0x1C,0x00,0x00,0x00,0x21,0x22,0x01,0x1B,0x20, 61 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 62 | 0x00,0x19,0x1A,0x01,0x1F,0x1C,0x00,0x00,0x00,0x00, 63 | 0x19,0x1A,0x1F,0x1C,0x00,0x00,0x00,0x19,0x1A,0x01, 64 | 0x1F,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 65 | 0x00,0x00,0x00,0x21,0x22,0x01,0x1B,0x20,0x00,0x00, 66 | 0x00,0x00,0x21,0x22,0x1B,0x20,0x00,0x00,0x00,0x21, 67 | 0x22,0x01,0x1F,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, 68 | 0x00,0x00,0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C, 69 | 0x00,0x00,0x00,0x00,0x27,0x28,0x1F,0x1C,0x00,0x00, 70 | 0x00,0x19,0x1A,0x01,0x37,0x38,0x24,0x26,0x00,0x00, 71 | 0x00,0x23,0x24,0x24,0x25,0x24,0x39,0x3A,0x3B,0x01, 72 | 0x1F,0x1C,0x00,0x00,0x00,0x00,0x19,0x1A,0x1B,0x20, 73 | 0x00,0x00,0x00,0x21,0x22,0x01,0x3C,0x3D,0x2D,0x20, 74 | 0x00,0x00,0x00,0x19,0x2B,0x3E,0x3F,0x3E,0x40,0x41, 75 | 0x42,0x01,0x1B,0x20,0x00,0x00,0x00,0x00,0x21,0x22, 76 | 0x1F,0x1C,0x00,0x00,0x00,0x27,0x15,0x01,0x01,0x01, 77 | 0x1F,0x1C,0x00,0x00,0x00,0x21,0x22,0x01,0x01,0x01, 78 | 0x01,0x01,0x01,0x01,0x0D,0x20,0x00,0x00,0x00,0x00, 79 | 0x19,0x1A,0x1F,0x1C,0x00,0x00,0x00,0x30,0x31,0x0B, 80 | 0x03,0x07,0x33,0x20,0x00,0x00,0x00,0x30,0x31,0x08, 81 | 0x09,0x01,0x0A,0x0B,0x07,0x0B,0x33,0x20,0x00,0x00, 82 | 0x00,0x00,0x21,0x22,0x1F,0x1C,0x00,0x00,0x00,0x34, 83 | 0x35,0x0F,0x10,0x0F,0x10,0x36,0x00,0x00,0x00,0x34, 84 | 0x35,0x14,0x15,0x01,0x0D,0x0E,0x0F,0x0F,0x10,0x36, 85 | 0x00,0x00,0x00,0x00,0x19,0x22,0x29,0x2A,0x00,0x00, 86 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 87 | 0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C,0x00,0x00, 88 | 0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x44,0x2E,0x2F, 89 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 90 | 0x00,0x00,0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C, 91 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x45,0x46, 92 | 0x1B,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 93 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x31,0x32, 94 | 0x33,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 95 | 0x21,0x22,0x37,0x38,0x24,0x24,0x24,0x24,0x24,0x25, 96 | 0x24,0x39,0x24,0x25,0x24,0x26,0x00,0x00,0x00,0x34, 97 | 0x35,0x0F,0x10,0x36,0x00,0x00,0x00,0x23,0x24,0x24, 98 | 0x24,0x24,0x3A,0x3B,0x3C,0x3D,0x3E,0x3E,0x3E,0x3E, 99 | 0x3E,0x3F,0x3E,0x40,0x3E,0x2C,0x2D,0x20,0x00,0x00, 100 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19, 101 | 0x2B,0x41,0x3E,0x3E,0x41,0x42,0x01,0x01,0x01,0x01, 102 | 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x1F,0x1C, 103 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 104 | 0x00,0x21,0x22,0x01,0x01,0x01,0x01,0x01,0x0A,0x0B, 105 | 0x07,0x03,0x07,0x03,0x04,0x07,0x03,0x04,0x0B,0x0B, 106 | 0x33,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 107 | 0x00,0x00,0x00,0x30,0x31,0x0B,0x07,0x03,0x08,0x09, 108 | 0x0D,0x0E,0x0F,0x10,0x0F,0x10,0x11,0x0F,0x10,0x11, 109 | 0x10,0x0F,0x10,0x36,0x00,0x00,0x00,0x23,0x24,0x25, 110 | 0x24,0x26,0x00,0x00,0x00,0x34,0x35,0x10,0x0F,0x10, 111 | 0x14,0x15,0x1F,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, 112 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19, 113 | 0x2B,0x2C,0x2D,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 114 | 0x00,0x00,0x27,0x28,0x1F,0x1C,0x00,0x00,0x00,0x00, 115 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 116 | 0x00,0x27,0x28,0x01,0x17,0x18,0x00,0x00,0x00,0x00, 117 | 0x00,0x00,0x00,0x00,0x19,0x1A,0x1B,0x20,0x00,0x00, 118 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 119 | 0x00,0x00,0x00,0x19,0x1A,0x01,0x1F,0x1C,0x00,0x00, 120 | 0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x22,0x47,0x48, 121 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 122 | 0x00,0x00,0x00,0x00,0x00,0x21,0x22,0x01,0x1B,0x20, 123 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0x22, 124 | 0x37,0x38,0x49,0x4A,0x4B,0x24,0x39,0x24,0x24,0x24, 125 | 0x25,0x24,0x39,0x24,0x24,0x39,0x25,0x3A,0x3B,0x01, 126 | 0x37,0x38,0x24,0x25,0x24,0x39,0x24,0x25,0x24,0x39, 127 | 0x3A,0x3B,0x3C,0x3D,0x4C,0x4D,0x4E,0x3E,0x40,0x3E, 128 | 0x3E,0x3E,0x3F,0x3E,0x40,0x3E,0x3E,0x40,0x3F,0x41, 129 | 0x42,0x01,0x3C,0x3D,0x3E,0x3F,0x3E,0x40,0x3E,0x3F, 130 | 0x3E,0x40,0x41,0x42 131 | }; 132 | 133 | /* End of DUNGEON_MAP.C */ 134 | -------------------------------------------------------------------------------- /res/dungeon_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | DUNGEON_MAP.H 4 | 5 | Map Include File. 6 | 7 | Info: 8 | Section : 9 | Bank : 0 10 | Map size : 32 x 32 11 | Tile set : dungeon_32x32.gbr 12 | Plane count : 1 plane (8 bits) 13 | Plane order : Planes are continues 14 | Tile offset : 0 15 | Split data : No 16 | 17 | This file was generated by GBMB v1.8 18 | 19 | */ 20 | 21 | #define dungeon_mapWidth 32 22 | #define dungeon_mapHeight 32 23 | #define dungeon_mapBank 0 24 | 25 | #define dungeon_map dungeon_mapPLN0 26 | extern const unsigned char dungeon_mapPLN0[]; 27 | 28 | /* End of DUNGEON_MAP.H */ 29 | -------------------------------------------------------------------------------- /res/dungeon_tiles.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | DUNGEON_TILES.C 4 | 5 | Tile Source File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 8 13 | Tiles : 0 to 78 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | /* Start of tile array. */ 26 | const unsigned char dungeon_tiles[] = 27 | { 28 | 0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF, 29 | 0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF, 30 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 31 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 32 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 33 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 34 | 0xFF,0xFF,0x08,0x08,0x08,0x08,0xEB,0x1C, 35 | 0xFF,0xFF,0x80,0x80,0xFF,0x80,0xFF,0x80, 36 | 0xFF,0xFF,0x10,0x10,0x10,0x10,0xD7,0x38, 37 | 0xFF,0xFF,0x00,0x00,0xFF,0x00,0xFF,0x00, 38 | 0xFF,0xFF,0x78,0x37,0xF3,0x6F,0x67,0xDF, 39 | 0xCF,0xFF,0x4F,0x7F,0xDF,0x7F,0xDF,0x7F, 40 | 0xFF,0xFF,0x1E,0xEC,0xCF,0xF6,0xE6,0xFB, 41 | 0xF3,0xFF,0xF2,0xFE,0xFB,0xFE,0xFB,0xFE, 42 | 0xFF,0xFF,0x90,0x90,0x90,0x90,0xD7,0xB8, 43 | 0xFF,0xFF,0x80,0x80,0xFF,0x80,0xFF,0x80, 44 | 0xFF,0xFF,0x00,0x00,0x00,0x00,0x7F,0x80, 45 | 0xFF,0xFF,0x00,0x00,0xFF,0x00,0xFF,0x00, 46 | 0xFF,0xFF,0x03,0x03,0x05,0x05,0xE9,0x19, 47 | 0xF1,0xF9,0x39,0x31,0xD9,0x51,0xD9,0x91, 48 | 0xFF,0xFF,0xC0,0xC0,0xA0,0xA0,0x97,0x98, 49 | 0x8F,0x9F,0x9C,0x8C,0x9B,0x8A,0x9B,0x89, 50 | 0xFF,0xFF,0x00,0x00,0x00,0x00,0xFE,0x01, 51 | 0xFF,0xFF,0x00,0x00,0xFF,0x00,0xFF,0x00, 52 | 0xFF,0xFF,0x09,0x09,0x09,0x09,0xEB,0x1D, 53 | 0xFF,0xFF,0x81,0x81,0xFF,0x81,0xFF,0x81, 54 | 0x9B,0x88,0x9B,0x88,0x9B,0x88,0x9B,0x88, 55 | 0x9B,0x88,0x9B,0x88,0x9B,0x88,0x8B,0x98, 56 | 0x80,0xFF,0x61,0xFF,0x7F,0xFF,0x3F,0xF0, 57 | 0x38,0xEF,0x34,0xEF,0x33,0xEF,0x73,0xEF, 58 | 0x80,0xFF,0xC1,0xFF,0xFF,0xFF,0xFF,0x88, 59 | 0x88,0xFF,0x88,0xFF,0xCC,0xFF,0xFF,0xFF, 60 | 0x80,0xFF,0xC0,0xFF,0xFF,0xFF,0xFF,0x20, 61 | 0x20,0xFF,0x20,0xFF,0x70,0xFF,0xFF,0xFF, 62 | 0x00,0xFF,0x01,0xFF,0xFF,0xFF,0xFF,0x08, 63 | 0x08,0xFF,0x08,0xFF,0x1C,0xFF,0xFF,0xFF, 64 | 0xDF,0x7F,0x5F,0xFF,0xD5,0xFF,0x5F,0x7F, 65 | 0xDA,0x7F,0xD5,0x7F,0x5F,0xFF,0xE0,0xDF, 66 | 0xFB,0xFE,0xFA,0xFF,0x5B,0xFF,0xFA,0xFE, 67 | 0xAB,0xFE,0x5B,0xFE,0xFA,0xFF,0x07,0xFB, 68 | 0x01,0xFF,0x86,0xFF,0xFE,0xFF,0xFC,0x0F, 69 | 0x1C,0xF7,0x2C,0xF7,0xCC,0xF7,0xCE,0xF7, 70 | 0xD9,0x11,0xD9,0x11,0xD9,0x11,0xD9,0x11, 71 | 0xD9,0x11,0xD9,0x11,0xD9,0x11,0xD1,0x19, 72 | 0x81,0xFF,0xC3,0xFF,0xFF,0xFF,0xFF,0x21, 73 | 0x21,0xFF,0x21,0xFF,0x73,0xFF,0xFF,0xFF, 74 | 0xFF,0xFF,0x9B,0x88,0x8B,0x98,0xFB,0xF8, 75 | 0x8B,0x98,0x9B,0x88,0x9B,0x88,0x9F,0x8F, 76 | 0xFF,0xFF,0x73,0xEF,0x31,0xEF,0x31,0xEF, 77 | 0x33,0xEF,0x3F,0xFF,0x73,0xEF,0xF1,0xEF, 78 | 0x8F,0xF7,0xCE,0xF7,0xFC,0xFF,0xCC,0xF7, 79 | 0x8C,0xF7,0x8C,0xF7,0x8C,0xF7,0x8C,0xF7, 80 | 0xF9,0xF1,0xD9,0x11,0xD9,0x11,0xD1,0x19, 81 | 0xDF,0x1F,0xD1,0x19,0xD9,0x11,0xD9,0x11, 82 | 0x9B,0x88,0x9B,0x88,0x8B,0x98,0xFB,0xF8, 83 | 0x8B,0x98,0x9B,0x88,0x9B,0x88,0x9F,0x8F, 84 | 0x71,0xEF,0x31,0xEF,0x33,0xEF,0x3F,0xFF, 85 | 0x33,0xEF,0x31,0xEF,0x31,0xEF,0x31,0xEF, 86 | 0xFF,0xFF,0xCE,0xF7,0x8C,0xF7,0x8C,0xF7, 87 | 0xFC,0xFF,0xCC,0xF7,0x8C,0xF7,0x8E,0xF7, 88 | 0xFF,0xFF,0xD9,0x11,0xD1,0x19,0xDF,0x1F, 89 | 0xD1,0x19,0xD9,0x11,0xD9,0x11,0xD9,0x11, 90 | 0x9B,0x88,0x9B,0x88,0x9B,0x88,0x8B,0x98, 91 | 0xFB,0xF8,0x8B,0x98,0x9B,0x88,0x9B,0x88, 92 | 0x31,0xEF,0x31,0xEF,0x31,0xEF,0x31,0xEF, 93 | 0x33,0xEF,0x3F,0xFF,0x73,0xEF,0xF1,0xEF, 94 | 0x8C,0xF7,0x8C,0xF7,0x8C,0xF7,0xCC,0xF7, 95 | 0xFC,0xFF,0xCC,0xF7,0x8C,0xF7,0x8E,0xF7, 96 | 0xD9,0x11,0xD9,0x11,0xD1,0x19,0xDF,0x1F, 97 | 0xD1,0x19,0xD9,0x11,0xD9,0x11,0xD9,0x11, 98 | 0xFF,0xFF,0xC0,0xFF,0xA0,0xFF,0x90,0xFF, 99 | 0x8F,0xF8,0x8F,0xF7,0x8E,0xF7,0x8D,0xF7, 100 | 0xFF,0xFF,0x0E,0xFF,0x04,0xFF,0x04,0xFF, 101 | 0xFF,0x04,0xFF,0xFF,0x03,0xFF,0x01,0xFF, 102 | 0xFF,0xFF,0x38,0xFF,0x10,0xFF,0x10,0xFF, 103 | 0xFF,0x10,0xFF,0xFF,0x80,0xFF,0x00,0xFF, 104 | 0xFF,0xFF,0x03,0xFF,0x05,0xFF,0x09,0xFF, 105 | 0xF1,0x1F,0xF1,0xEF,0x71,0xEF,0xB1,0xEF, 106 | 0x8F,0xF7,0xCE,0xF7,0xFC,0xFF,0xCC,0xF7, 107 | 0x8C,0xF7,0x8C,0xF7,0xCE,0xF7,0xFF,0xFF, 108 | 0xF9,0xF1,0xD9,0x11,0xD9,0x11,0xD1,0x19, 109 | 0xDF,0x1F,0xD1,0x19,0xD9,0x11,0xFF,0xFF, 110 | 0xAB,0x98,0xFF,0xBF,0xF0,0xEF,0xE3,0xDF, 111 | 0xCF,0xBF,0x9F,0xFF,0xBF,0xFF,0xBF,0xFF, 112 | 0xAD,0x63,0xFF,0xFF,0x01,0xFE,0xFE,0xFF, 113 | 0xF6,0xFF,0xDA,0xFF,0xF6,0xFF,0xDA,0xFF, 114 | 0xFF,0x80,0xFF,0x40,0xE0,0x20,0xDF,0x1F, 115 | 0xDF,0x18,0xDC,0x14,0xDA,0x12,0xD9,0x11, 116 | 0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0xFF, 117 | 0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF, 118 | 0xFF,0x01,0xFF,0x02,0x07,0x04,0xFB,0xF8, 119 | 0xFB,0x18,0x3B,0x28,0x5B,0x48,0x9B,0x88, 120 | 0xBF,0xFF,0xBF,0xFF,0x9F,0xFF,0xCF,0xBF, 121 | 0xE3,0xDF,0xF0,0xEF,0xFF,0xBF,0xAB,0x98, 122 | 0xF6,0xFF,0xDA,0xFF,0xF6,0xFF,0xDA,0xFF, 123 | 0xFE,0xFF,0x01,0xFE,0xFF,0xFF,0xAD,0x63, 124 | 0x8C,0xF7,0x8C,0xF7,0x8C,0xF7,0x8C,0xF7, 125 | 0xCC,0xF7,0xFC,0xFF,0xCE,0xF7,0x8F,0xF7, 126 | 0xD9,0x11,0xDA,0x12,0xDC,0x14,0xDF,0x18, 127 | 0xDF,0x1F,0xE0,0x20,0xFF,0x40,0xFF,0x80, 128 | 0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00, 129 | 0xFF,0xFF,0x00,0x00,0xFF,0x00,0xFF,0x00, 130 | 0x9B,0x88,0x5B,0x48,0x3B,0x28,0xFB,0x18, 131 | 0xFB,0xF8,0x07,0x04,0xFF,0x02,0xFF,0x01, 132 | 0x8D,0xF7,0x8E,0xF7,0x8F,0xF7,0x8F,0xF8, 133 | 0x90,0xFF,0xA0,0xFF,0xC0,0xFF,0xFF,0xFF, 134 | 0x01,0xFF,0x03,0xFF,0xFF,0xFF,0xFF,0x04, 135 | 0x04,0xFF,0x04,0xFF,0x0E,0xFF,0xFF,0xFF, 136 | 0xB1,0xEF,0x71,0xEF,0xF1,0xEF,0xF1,0x1F, 137 | 0x09,0xFF,0x05,0xFF,0x03,0xFF,0xFF,0xFF, 138 | 0x8B,0x98,0x9B,0x88,0x9B,0x88,0x9B,0x88, 139 | 0x9B,0x88,0x9B,0x88,0x9B,0x88,0x9B,0x88, 140 | 0x73,0xEF,0x33,0xEF,0x34,0xEF,0x38,0xEF, 141 | 0x3F,0xF0,0x7F,0xFF,0x61,0xFF,0x80,0xFF, 142 | 0xFF,0xFF,0x33,0xFF,0x11,0xFF,0x11,0xFF, 143 | 0xFF,0x11,0xFF,0xFF,0x83,0xFF,0x01,0xFF, 144 | 0xCE,0xF7,0xCC,0xF7,0x2C,0xF7,0x1C,0xF7, 145 | 0xFC,0x0F,0xFE,0xFF,0x86,0xFF,0x01,0xFF, 146 | 0xD1,0x19,0xD9,0x11,0xD9,0x11,0xD9,0x11, 147 | 0xD9,0x11,0xD9,0x11,0xD9,0x11,0xD9,0x11, 148 | 0x9B,0x89,0x9B,0x8A,0x9C,0x8C,0x8F,0x9F, 149 | 0x97,0x98,0xA0,0xA0,0xC0,0xC0,0xFF,0xFF, 150 | 0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0xFF, 151 | 0xFE,0x01,0x00,0x00,0x00,0x00,0xFF,0xFF, 152 | 0xFF,0x01,0xFF,0x01,0x01,0x01,0xFF,0xFF, 153 | 0xD7,0x38,0x10,0x10,0x10,0x10,0xFF,0xFF, 154 | 0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0xFF, 155 | 0xEB,0x1C,0x08,0x08,0x08,0x08,0xFF,0xFF, 156 | 0xFF,0x01,0xFF,0x01,0x01,0x01,0xFF,0xFF, 157 | 0xEB,0x1D,0x09,0x09,0x09,0x09,0xFF,0xFF, 158 | 0xFF,0x00,0xFF,0x00,0x00,0x00,0xFF,0xFF, 159 | 0x7F,0x80,0x00,0x00,0x00,0x00,0xFF,0xFF, 160 | 0xD9,0x91,0xD9,0x51,0x39,0x31,0xF1,0xF9, 161 | 0xE9,0x19,0x05,0x05,0x03,0x03,0xFF,0xFF, 162 | 0xB5,0xC6,0xFF,0xFF,0x80,0x7F,0x7F,0xFF, 163 | 0x5B,0xFF,0x6F,0xFF,0x5B,0xFF,0x6F,0xFF, 164 | 0xD5,0x19,0xFF,0xFD,0x0F,0xF7,0xC7,0xFB, 165 | 0xF3,0xFD,0xF9,0xFF,0xFD,0xFF,0xFD,0xFF, 166 | 0x5B,0xFF,0x6F,0xFF,0x5B,0xFF,0x6F,0xFF, 167 | 0x7F,0xFF,0x80,0x7F,0xFF,0xFF,0xB5,0xC6, 168 | 0xFD,0xFF,0xFD,0xFF,0xF9,0xFF,0xF3,0xFD, 169 | 0xC7,0xFB,0x0F,0xF7,0xFF,0xFD,0xD5,0x19, 170 | 0x9B,0x88,0x9B,0x88,0x9B,0x88,0x8B,0x98, 171 | 0xFB,0xF8,0x8B,0x98,0x9B,0x88,0xFF,0xFF, 172 | 0x71,0xEF,0x31,0xEF,0x33,0xEF,0x3F,0xFF, 173 | 0x31,0xEF,0x31,0xEF,0x73,0xEF,0xFF,0xFF, 174 | 0xFF,0xFF,0xCE,0xFF,0x84,0xFF,0x84,0xFF, 175 | 0xFF,0x84,0xFF,0xFF,0xC3,0xFF,0x81,0xFF, 176 | 0xE0,0xDF,0x5F,0xFF,0xDA,0x7F,0xD5,0x7F, 177 | 0x5F,0x7F,0xDA,0xFF,0x5F,0xFF,0xDF,0x7F, 178 | 0x07,0xFB,0xFA,0xFF,0xAB,0xFE,0x5B,0xFE, 179 | 0xFA,0xFE,0xAB,0xFF,0xFA,0xFF,0xFB,0xFE, 180 | 0xFF,0x81,0xFF,0x81,0x81,0x81,0xFF,0xFF, 181 | 0xD7,0xB8,0x90,0x90,0x90,0x90,0xFF,0xFF, 182 | 0xDF,0x7F,0xDF,0x7F,0x4F,0x7F,0xCF,0xFF, 183 | 0x67,0xDF,0xF3,0x6F,0x78,0x37,0xFF,0xFF, 184 | 0xFB,0xFE,0xFB,0xFE,0xF2,0xFE,0xF3,0xFF, 185 | 0xE6,0xFB,0xCF,0xF6,0x1E,0xEC,0xFF,0xFF 186 | }; 187 | 188 | /* End of DUNGEON_TILES.C */ 189 | -------------------------------------------------------------------------------- /res/dungeon_tiles.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | DUNGEON_TILES.H 4 | 5 | Include File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 8 x 8 13 | Tiles : 0 to 78 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | 26 | /* Bank of tiles. */ 27 | #define dungeon_tilesBank 0 28 | 29 | /* Super Gameboy palette 0 */ 30 | #define dungeon_tilesSGBPal0c0 0 31 | #define dungeon_tilesSGBPal0c1 0 32 | #define dungeon_tilesSGBPal0c2 22528 33 | #define dungeon_tilesSGBPal0c3 44 34 | 35 | /* Super Gameboy palette 1 */ 36 | #define dungeon_tilesSGBPal1c0 6076 37 | #define dungeon_tilesSGBPal1c1 8935 38 | #define dungeon_tilesSGBPal1c2 6596 39 | #define dungeon_tilesSGBPal1c3 5344 40 | 41 | /* Super Gameboy palette 2 */ 42 | #define dungeon_tilesSGBPal2c0 6076 43 | #define dungeon_tilesSGBPal2c1 8935 44 | #define dungeon_tilesSGBPal2c2 6596 45 | #define dungeon_tilesSGBPal2c3 5344 46 | 47 | /* Super Gameboy palette 3 */ 48 | #define dungeon_tilesSGBPal3c0 6076 49 | #define dungeon_tilesSGBPal3c1 8935 50 | #define dungeon_tilesSGBPal3c2 6596 51 | #define dungeon_tilesSGBPal3c3 5344 52 | 53 | /* Gameboy Color palette 0 */ 54 | #define dungeon_tilesCGBPal0c0 26620 55 | #define dungeon_tilesCGBPal0c1 14096 56 | #define dungeon_tilesCGBPal0c2 10662 57 | #define dungeon_tilesCGBPal0c3 2112 58 | 59 | /* Gameboy Color palette 1 */ 60 | #define dungeon_tilesCGBPal1c0 6076 61 | #define dungeon_tilesCGBPal1c1 8935 62 | #define dungeon_tilesCGBPal1c2 6596 63 | #define dungeon_tilesCGBPal1c3 5344 64 | 65 | /* Gameboy Color palette 2 */ 66 | #define dungeon_tilesCGBPal2c0 6076 67 | #define dungeon_tilesCGBPal2c1 8935 68 | #define dungeon_tilesCGBPal2c2 6596 69 | #define dungeon_tilesCGBPal2c3 5344 70 | 71 | /* Gameboy Color palette 3 */ 72 | #define dungeon_tilesCGBPal3c0 6076 73 | #define dungeon_tilesCGBPal3c1 8935 74 | #define dungeon_tilesCGBPal3c2 6596 75 | #define dungeon_tilesCGBPal3c3 5344 76 | 77 | /* Gameboy Color palette 4 */ 78 | #define dungeon_tilesCGBPal4c0 6076 79 | #define dungeon_tilesCGBPal4c1 8935 80 | #define dungeon_tilesCGBPal4c2 6596 81 | #define dungeon_tilesCGBPal4c3 5344 82 | 83 | /* Gameboy Color palette 5 */ 84 | #define dungeon_tilesCGBPal5c0 6076 85 | #define dungeon_tilesCGBPal5c1 8935 86 | #define dungeon_tilesCGBPal5c2 6596 87 | #define dungeon_tilesCGBPal5c3 5344 88 | 89 | /* Gameboy Color palette 6 */ 90 | #define dungeon_tilesCGBPal6c0 6076 91 | #define dungeon_tilesCGBPal6c1 8935 92 | #define dungeon_tilesCGBPal6c2 6596 93 | #define dungeon_tilesCGBPal6c3 5344 94 | 95 | /* Gameboy Color palette 7 */ 96 | #define dungeon_tilesCGBPal7c0 6076 97 | #define dungeon_tilesCGBPal7c1 8935 98 | #define dungeon_tilesCGBPal7c2 6596 99 | #define dungeon_tilesCGBPal7c3 5344 100 | /* Start of tile array. */ 101 | extern const const unsigned char dungeon_tiles[]; 102 | 103 | /* End of DUNGEON_TILES.H */ 104 | -------------------------------------------------------------------------------- /res/dungeon_tiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/dungeon_tiles.png -------------------------------------------------------------------------------- /res/sondanielson.itch.io.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/sondanielson.itch.io.xcf -------------------------------------------------------------------------------- /res/sprite.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/sprite.gbm -------------------------------------------------------------------------------- /res/sprite.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/sprite.gbr -------------------------------------------------------------------------------- /res/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/res/sprite.png -------------------------------------------------------------------------------- /res/sprite_map.txt: -------------------------------------------------------------------------------- 1 | large 2 | 3 | * = changes between frames 4 | - = same between frames (even if an arc tile, background color change will hide) 5 | x = hide/no sprite 6 | 7 | + 0 1 2 3 4 8 | ----------------- 9 | 0 0 1 2 3 4 10 | 1 0 *5 *x *x *x 11 | 2 0 *5v *x *x *x 12 | 3 0 1v 2v 3v 4v 13 | 14 | 15 | Small circle is inset by 2 extra 8 pixel columns 16 | 17 | 18 | + 0 1 2 3 4 19 | ----------------- 20 | 0 - - - - - 21 | 1 - *0 *0 *1 *2 22 | 2 - *0 *0 *1v *2v 23 | 3 - - - - - 24 | 25 | 26 | V2 - 6 columns 27 | 28 | 29 | + 0 1 2 3 4 5 30 | --------------------- 31 | 0 0 0 1 2 3 4 32 | 1 0 0 *5 *x *x *x 33 | 2 0 0 *5v *x *x *x 34 | 3 0 0 1v 2v 3v 4v 35 | 36 | 37 | Small circle is inset by 2 extra 8 pixel columns 38 | 39 | 40 | + 0 1 2 3 4 5 41 | --------------------- 42 | 0 - - - - - - 43 | 1 - - *0 *0 *1 *2 44 | 2 - - *0 *0 *1v *2v 45 | 3 - - - - - - 46 | 47 | 48 | -------------------------------------------------------------------------------- /res/sprite_tiles.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SPRITE_TILES.C 4 | 5 | Tile Source File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 16 x 16 13 | Tiles : 0 to 7 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | /* Start of tile array. */ 26 | const unsigned char sprite_tiles[] = 27 | { 28 | 0x07,0x07,0x0B,0x0C,0x17,0x18,0x33,0x2C, 29 | 0x3F,0x3E,0x5B,0x6C,0x6E,0x71,0x1D,0x12, 30 | 0x20,0x3F,0x3F,0x3F,0x0F,0x0B,0x0A,0x0F, 31 | 0x0B,0x0E,0x07,0x07,0x0E,0x0D,0x0F,0x0F, 32 | 0xE0,0xE0,0x90,0x70,0xEE,0x1E,0xDE,0x32, 33 | 0xB4,0x6C,0x28,0xF8,0xD0,0x30,0xA0,0x60, 34 | 0xF0,0xF0,0xB0,0xD0,0xE8,0x98,0x68,0x98, 35 | 0x58,0xB8,0xB0,0xF0,0xE0,0x20,0xE0,0xE0, 36 | 0x00,0x00,0x07,0x07,0x0B,0x0C,0x17,0x18, 37 | 0x33,0x2C,0x3F,0x3E,0x5B,0x6C,0x6E,0x71, 38 | 0x1D,0x12,0x20,0x3F,0x3F,0x3F,0x1C,0x17, 39 | 0x16,0x1D,0x1F,0x1F,0x37,0x29,0x3F,0x3F, 40 | 0x00,0x00,0xE0,0xE0,0x90,0x70,0xEE,0x1E, 41 | 0xDE,0x32,0xB4,0x6C,0x28,0xF8,0xD0,0x30, 42 | 0xB0,0x70,0xD0,0xF0,0xA8,0xD8,0xE8,0x18, 43 | 0xCC,0x3C,0x34,0xFC,0xEC,0xD4,0xFC,0xFC, 44 | 0x03,0x03,0x04,0x07,0xFB,0xFC,0xEF,0x98, 45 | 0x6B,0x5C,0x4B,0x7C,0x37,0x38,0x1D,0x1E, 46 | 0x3F,0x3F,0x5F,0x73,0x58,0x77,0x39,0x3E, 47 | 0x3B,0x3F,0x1E,0x1F,0x3F,0x3F,0x1F,0x1F, 48 | 0xC0,0xC0,0x20,0xE0,0xDF,0x3F,0xF7,0x19, 49 | 0xD6,0x3A,0xD2,0x3E,0xEC,0x1C,0xB8,0x78, 50 | 0xFC,0xFC,0xFE,0xCE,0x1D,0xEF,0x9D,0x7F, 51 | 0xDE,0xFE,0x78,0xF8,0xE4,0xFC,0xF8,0xF8, 52 | 0x00,0x00,0x03,0x03,0x04,0x07,0xFB,0xFC, 53 | 0xEF,0x98,0x6B,0x5C,0x4B,0x7C,0x37,0x38, 54 | 0x3D,0x3E,0x7F,0x7F,0xBF,0xF3,0xB8,0xF7, 55 | 0x79,0x7E,0x1B,0x1F,0x26,0x3F,0x1F,0x1F, 56 | 0x00,0x00,0xC0,0xC0,0x20,0xE0,0xDF,0x3F, 57 | 0xF7,0x19,0xD6,0x3A,0xD2,0x3E,0xEC,0x1C, 58 | 0xBC,0x7C,0xFA,0xFE,0xFA,0xCE,0x3C,0xCC, 59 | 0x9C,0x7C,0xD8,0xF8,0x7C,0xFC,0xF8,0xF8, 60 | 0x07,0x07,0x09,0x0E,0x77,0x78,0x7B,0x4C, 61 | 0x2D,0x36,0x14,0x1F,0x0B,0x0C,0x05,0x06, 62 | 0x0F,0x0F,0x0D,0x0B,0x17,0x19,0x16,0x19, 63 | 0x1A,0x1D,0x0D,0x0F,0x07,0x04,0x07,0x07, 64 | 0xE0,0xE0,0xD0,0x30,0xE8,0x18,0xCC,0x34, 65 | 0xFC,0x7C,0xDA,0x36,0x76,0x8E,0xB8,0x48, 66 | 0x04,0xFC,0xFC,0xFC,0xF0,0xD0,0x50,0xF0, 67 | 0xD0,0x70,0xE0,0xE0,0x70,0xB0,0xF0,0xF0, 68 | 0x00,0x00,0x07,0x07,0x09,0x0E,0x77,0x78, 69 | 0x7B,0x4C,0x2D,0x36,0x14,0x1F,0x0B,0x0C, 70 | 0x0D,0x0E,0x0B,0x0F,0x15,0x1B,0x17,0x18, 71 | 0x33,0x3C,0x2C,0x3F,0x37,0x2B,0x3F,0x3F, 72 | 0x00,0x00,0xE0,0xE0,0xD0,0x30,0xE8,0x18, 73 | 0xCC,0x34,0xFC,0x7C,0xDA,0x36,0x76,0x8E, 74 | 0xB8,0x48,0x04,0xFC,0xFC,0xFC,0x38,0xE8, 75 | 0x68,0xB8,0xF8,0xF8,0xEC,0x94,0xFC,0xFC, 76 | 0x00,0x00,0x07,0x07,0x0B,0x0C,0xF7,0xF8, 77 | 0xF3,0x8C,0x65,0x5E,0x5E,0x67,0x2E,0x31, 78 | 0x17,0x18,0x78,0x7F,0x9F,0xF7,0xB8,0xDF, 79 | 0x73,0x7C,0x3D,0x26,0x25,0x3F,0x1F,0x1F, 80 | 0x00,0x00,0xE0,0xE0,0xD0,0x30,0xEF,0x1F, 81 | 0xCF,0x31,0xA6,0x7A,0x7A,0xE6,0x74,0x8C, 82 | 0xEE,0x1E,0x19,0xFF,0xFD,0xEB,0x1E,0xFE, 83 | 0xFC,0x3C,0xA4,0x7C,0xB8,0xF8,0xF8,0xF8, 84 | 0x07,0x07,0x0B,0x0C,0xF7,0xF8,0xF3,0x8C, 85 | 0x65,0x5E,0x5E,0x67,0x2E,0x31,0x17,0x18, 86 | 0x78,0x7F,0x9F,0xFF,0xBC,0xD7,0x7B,0x7C, 87 | 0x3D,0x3E,0x25,0x3F,0x1F,0x1F,0x1F,0x1F, 88 | 0xE0,0xE0,0xD0,0x30,0xEF,0x1F,0xCF,0x31, 89 | 0xA6,0x7A,0x7A,0xE6,0x74,0x8C,0xE8,0x18, 90 | 0x18,0xF8,0xFE,0xFE,0x39,0xEF,0xDD,0x3B, 91 | 0x8E,0x7E,0xBC,0xE4,0xE4,0xFC,0xF8,0xF8 92 | }; 93 | 94 | /* End of SPRITE_TILES.C */ 95 | -------------------------------------------------------------------------------- /res/sprite_tiles.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SPRITE_TILES.H 4 | 5 | Include File. 6 | 7 | Info: 8 | Form : All tiles as one unit. 9 | Format : Gameboy 4 color. 10 | Compression : None. 11 | Counter : None. 12 | Tile size : 16 x 16 13 | Tiles : 0 to 7 14 | 15 | Palette colors : Included. 16 | SGB Palette : None. 17 | CGB Palette : None. 18 | 19 | Convert to metatiles : No. 20 | 21 | This file was generated by GBTD v2.2 22 | 23 | */ 24 | 25 | 26 | /* Bank of tiles. */ 27 | #define sprite_tilesBank 0 28 | 29 | /* Super Gameboy palette 0 */ 30 | #define sprite_tilesSGBPal0c0 0 31 | #define sprite_tilesSGBPal0c1 0 32 | #define sprite_tilesSGBPal0c2 10240 33 | #define sprite_tilesSGBPal0c3 979 34 | 35 | /* Super Gameboy palette 1 */ 36 | #define sprite_tilesSGBPal1c0 6076 37 | #define sprite_tilesSGBPal1c1 8935 38 | #define sprite_tilesSGBPal1c2 6596 39 | #define sprite_tilesSGBPal1c3 5344 40 | 41 | /* Super Gameboy palette 2 */ 42 | #define sprite_tilesSGBPal2c0 6076 43 | #define sprite_tilesSGBPal2c1 8935 44 | #define sprite_tilesSGBPal2c2 6596 45 | #define sprite_tilesSGBPal2c3 5344 46 | 47 | /* Super Gameboy palette 3 */ 48 | #define sprite_tilesSGBPal3c0 6076 49 | #define sprite_tilesSGBPal3c1 8935 50 | #define sprite_tilesSGBPal3c2 6596 51 | #define sprite_tilesSGBPal3c3 5344 52 | 53 | /* Gameboy Color palette 0 */ 54 | #define sprite_tilesCGBPal0c0 10661 55 | #define sprite_tilesCGBPal0c1 26588 56 | #define sprite_tilesCGBPal0c2 14096 57 | #define sprite_tilesCGBPal0c3 2112 58 | 59 | /* Gameboy Color palette 1 */ 60 | #define sprite_tilesCGBPal1c0 6076 61 | #define sprite_tilesCGBPal1c1 8935 62 | #define sprite_tilesCGBPal1c2 6596 63 | #define sprite_tilesCGBPal1c3 5344 64 | 65 | /* Gameboy Color palette 2 */ 66 | #define sprite_tilesCGBPal2c0 6076 67 | #define sprite_tilesCGBPal2c1 8935 68 | #define sprite_tilesCGBPal2c2 6596 69 | #define sprite_tilesCGBPal2c3 5344 70 | 71 | /* Gameboy Color palette 3 */ 72 | #define sprite_tilesCGBPal3c0 6076 73 | #define sprite_tilesCGBPal3c1 8935 74 | #define sprite_tilesCGBPal3c2 6596 75 | #define sprite_tilesCGBPal3c3 5344 76 | 77 | /* Gameboy Color palette 4 */ 78 | #define sprite_tilesCGBPal4c0 6076 79 | #define sprite_tilesCGBPal4c1 8935 80 | #define sprite_tilesCGBPal4c2 6596 81 | #define sprite_tilesCGBPal4c3 5344 82 | 83 | /* Gameboy Color palette 5 */ 84 | #define sprite_tilesCGBPal5c0 6076 85 | #define sprite_tilesCGBPal5c1 8935 86 | #define sprite_tilesCGBPal5c2 6596 87 | #define sprite_tilesCGBPal5c3 5344 88 | 89 | /* Gameboy Color palette 6 */ 90 | #define sprite_tilesCGBPal6c0 6076 91 | #define sprite_tilesCGBPal6c1 8935 92 | #define sprite_tilesCGBPal6c2 6596 93 | #define sprite_tilesCGBPal6c3 5344 94 | 95 | /* Gameboy Color palette 7 */ 96 | #define sprite_tilesCGBPal7c0 6076 97 | #define sprite_tilesCGBPal7c1 8935 98 | #define sprite_tilesCGBPal7c2 6596 99 | #define sprite_tilesCGBPal7c3 5344 100 | /* Start of tile array. */ 101 | extern const unsigned char sprite_tiles[]; 102 | 103 | /* End of SPRITE_TILES.H */ 104 | -------------------------------------------------------------------------------- /shintendo-method/Makefile: -------------------------------------------------------------------------------- 1 | GBDK_HOME="../../../gbdk2020/gbdk-2020-git/build/gbdk/" 2 | 3 | PNG2ASSET = $(GBDK_HOME)bin/png2asset 4 | LCC = $(GBDK_HOME)bin/lcc -Wa-l -Wl-m -Wl-j -Wl-y -v 5 | 6 | 7 | OBJDIR = obj 8 | SRCDIR = src 9 | BINS = torch.gb 10 | CSOURCES := $(wildcard $(SRCDIR)/*.c) $(wildcard res/*.c) 11 | ASMSOURCES := $(wildcard $(SRCDIR)/*.s) 12 | OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o) 13 | 14 | all: $(BINS) 15 | 16 | make.bat: Makefile 17 | @echo "REM Automatically generated from Makefile" > make.bat 18 | @make -sn | sed y/\\//\\\\/ | grep -v make >> make.bat 19 | 20 | $(OBJDIR)/%.o: %.c 21 | $(LCC) $(CFLAGS) -c -o $@ $< 22 | 23 | $(OBJDIR)/res/%.o: %.c 24 | $(LCC) $(CFLAGS) -c -o $@ $< 25 | 26 | 27 | $(OBJDIR)/%.o: %.s 28 | $(LCC) $(CFLAGS) -c -o $@ $< 29 | 30 | %.s: %.c 31 | $(LCC) $(CFLAGS) -S -o $@ $< 32 | 33 | # Link the compiled object files into a autobanks.gb ROM file 34 | $(BINS): $(OBJS) 35 | $(LCC) $(CFLAGS) -o $(BINS) $(OBJS) 36 | 37 | clean: 38 | rm -f *.gb *.ihx *.cdb *.adb *.noi *.map 39 | rm -f $(OBJDIR)/*.* $(OBJDIR)/res/*.* 40 | 41 | assets: 42 | # Set Priority flag so sprite is under BG & Window except for BG Color 0 43 | # -sp flag is temproarily broken in GBDK-2020 4.1.1-post-release png2asset 44 | # so need to manually edit sprite.c to OR in the S_PRIORITY flag 45 | $(PNG2ASSET) res/sprite.png -spr8x16 -sw 48 -sh 48 -sp 80 -keep_palette_order 46 | $(PNG2ASSET) res/dungeon.png -map -noflip -keep_palette_order 47 | 48 | 49 | -------------------------------------------------------------------------------- /shintendo-method/bin/torch.gb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/bin/torch.gb -------------------------------------------------------------------------------- /shintendo-method/res/dungeon.c: -------------------------------------------------------------------------------- 1 | //AUTOGENERATED FILE FROM png2asset 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | BANKREF(dungeon) 8 | 9 | const palette_color_t dungeon_palettes[4] = { 10 | RGB8(224,248,207), RGB8(134,192,108), RGB8( 48,104, 80), RGB8( 5, 16, 22) 11 | 12 | }; 13 | 14 | const uint8_t dungeon_tiles[1136] = { 15 | 0xff,0xff,0xc0,0xc0, 16 | 0xa0,0xa0,0x90,0x90, 17 | 0x8f,0x8f,0x8c,0x8c, 18 | 0x8a,0x8a,0x89,0x89, 19 | 0xff,0xff,0x00,0x00, 20 | 0x00,0x00,0x00,0x00, 21 | 0xff,0xff,0x00,0x00, 22 | 0x00,0x00,0x00,0x00, 23 | 0xff,0xff,0x90,0x90, 24 | 0x90,0x90,0x90,0x90, 25 | 0xff,0xff,0x80,0x80, 26 | 0x80,0x80,0x80,0x80, 27 | 0xff,0xff,0x30,0x30, 28 | 0x63,0x63,0x47,0x47, 29 | 0xcf,0xcf,0x4f,0x4f, 30 | 0x5f,0x5f,0x5f,0x5f, 31 | 0xff,0xff,0x0c,0x0c, 32 | 0xc6,0xc6,0xe2,0xe2, 33 | 0xf3,0xf3,0xf2,0xf2, 34 | 0xfa,0xfa,0xfa,0xfa, 35 | 0xff,0xff,0x10,0x10, 36 | 0x10,0x10,0x10,0x10, 37 | 0xff,0xff,0x00,0x00, 38 | 0x00,0x00,0x00,0x00, 39 | 0xff,0xff,0x08,0x08, 40 | 0x08,0x08,0x08,0x08, 41 | 0xff,0xff,0x80,0x80, 42 | 0x80,0x80,0x80,0x80, 43 | 0xff,0xff,0x03,0x03, 44 | 0x05,0x05,0x09,0x09, 45 | 0xf1,0xf1,0x31,0x31, 46 | 0x51,0x51,0x91,0x91, 47 | 0x00,0x00,0x00,0x00, 48 | 0x00,0x00,0x00,0x00, 49 | 0x00,0x00,0x00,0x00, 50 | 0x00,0x00,0x00,0x00, 51 | 0xff,0xff,0x09,0x09, 52 | 0x09,0x09,0x09,0x09, 53 | 0xff,0xff,0x81,0x81, 54 | 0x81,0x81,0x81,0x81, 55 | 0x88,0x88,0x88,0x88, 56 | 0x88,0x88,0x88,0x88, 57 | 0x88,0x88,0x88,0x88, 58 | 0x88,0x88,0x88,0x88, 59 | 0x80,0x80,0x61,0x61, 60 | 0x7f,0x7f,0x30,0x30, 61 | 0x28,0x28,0x24,0x24, 62 | 0x23,0x23,0x63,0x63, 63 | 0x80,0x80,0xc1,0xc1, 64 | 0xff,0xff,0x88,0x88, 65 | 0x88,0x88,0x88,0x88, 66 | 0xcc,0xcc,0xff,0xff, 67 | 0x5f,0x5f,0x5f,0x5f, 68 | 0xd5,0xd5,0x5f,0x5f, 69 | 0x5a,0x5a,0x55,0x55, 70 | 0x5f,0x5f,0xc0,0xc0, 71 | 0xfa,0xfa,0xfa,0xfa, 72 | 0x5b,0x5b,0xfa,0xfa, 73 | 0xaa,0xaa,0x5a,0x5a, 74 | 0xfa,0xfa,0x03,0x03, 75 | 0x00,0x00,0x01,0x01, 76 | 0xff,0xff,0x08,0x08, 77 | 0x08,0x08,0x08,0x08, 78 | 0x1c,0x1c,0xff,0xff, 79 | 0x80,0x80,0xc0,0xc0, 80 | 0xff,0xff,0x20,0x20, 81 | 0x20,0x20,0x20,0x20, 82 | 0x70,0x70,0xff,0xff, 83 | 0x01,0x01,0x86,0x86, 84 | 0xfe,0xfe,0x0c,0x0c, 85 | 0x14,0x14,0x24,0x24, 86 | 0xc4,0xc4,0xc6,0xc6, 87 | 0x11,0x11,0x11,0x11, 88 | 0x11,0x11,0x11,0x11, 89 | 0x11,0x11,0x11,0x11, 90 | 0x11,0x11,0x11,0x11, 91 | 0x81,0x81,0xc3,0xc3, 92 | 0xff,0xff,0x21,0x21, 93 | 0x21,0x21,0x21,0x21, 94 | 0x73,0x73,0xff,0xff, 95 | 0xff,0xff,0x88,0x88, 96 | 0x88,0x88,0xf8,0xf8, 97 | 0x88,0x88,0x88,0x88, 98 | 0x88,0x88,0x8f,0x8f, 99 | 0xff,0xff,0x63,0x63, 100 | 0x21,0x21,0x21,0x21, 101 | 0x23,0x23,0x3f,0x3f, 102 | 0x63,0x63,0xe1,0xe1, 103 | 0x87,0x87,0xc6,0xc6, 104 | 0xfc,0xfc,0xc4,0xc4, 105 | 0x84,0x84,0x84,0x84, 106 | 0x84,0x84,0x84,0x84, 107 | 0xf1,0xf1,0x11,0x11, 108 | 0x11,0x11,0x11,0x11, 109 | 0x1f,0x1f,0x11,0x11, 110 | 0x11,0x11,0x11,0x11, 111 | 0x88,0x88,0x88,0x88, 112 | 0x88,0x88,0xf8,0xf8, 113 | 0x88,0x88,0x88,0x88, 114 | 0x88,0x88,0x8f,0x8f, 115 | 0x61,0x61,0x21,0x21, 116 | 0x23,0x23,0x3f,0x3f, 117 | 0x23,0x23,0x21,0x21, 118 | 0x21,0x21,0x21,0x21, 119 | 0xff,0xff,0xc6,0xc6, 120 | 0x84,0x84,0x84,0x84, 121 | 0xfc,0xfc,0xc4,0xc4, 122 | 0x84,0x84,0x86,0x86, 123 | 0xff,0xff,0x11,0x11, 124 | 0x11,0x11,0x1f,0x1f, 125 | 0x11,0x11,0x11,0x11, 126 | 0x11,0x11,0x11,0x11, 127 | 0x88,0x88,0x88,0x88, 128 | 0x88,0x88,0x88,0x88, 129 | 0xf8,0xf8,0x88,0x88, 130 | 0x88,0x88,0x88,0x88, 131 | 0x21,0x21,0x21,0x21, 132 | 0x21,0x21,0x21,0x21, 133 | 0x23,0x23,0x3f,0x3f, 134 | 0x63,0x63,0xe1,0xe1, 135 | 0x84,0x84,0x84,0x84, 136 | 0x84,0x84,0xc4,0xc4, 137 | 0xfc,0xfc,0xc4,0xc4, 138 | 0x84,0x84,0x86,0x86, 139 | 0x11,0x11,0x11,0x11, 140 | 0x11,0x11,0x1f,0x1f, 141 | 0x11,0x11,0x11,0x11, 142 | 0x11,0x11,0x11,0x11, 143 | 0xff,0xff,0xc0,0xc0, 144 | 0xa0,0xa0,0x90,0x90, 145 | 0x88,0x88,0x87,0x87, 146 | 0x86,0x86,0x85,0x85, 147 | 0xff,0xff,0x0e,0x0e, 148 | 0x04,0x04,0x04,0x04, 149 | 0x04,0x04,0xff,0xff, 150 | 0x03,0x03,0x01,0x01, 151 | 0xff,0xff,0x38,0x38, 152 | 0x10,0x10,0x10,0x10, 153 | 0x10,0x10,0xff,0xff, 154 | 0x80,0x80,0x00,0x00, 155 | 0xff,0xff,0x03,0x03, 156 | 0x05,0x05,0x09,0x09, 157 | 0x11,0x11,0xe1,0xe1, 158 | 0x61,0x61,0xa1,0xa1, 159 | 0x87,0x87,0xc6,0xc6, 160 | 0xfc,0xfc,0xc4,0xc4, 161 | 0x84,0x84,0x84,0x84, 162 | 0xc6,0xc6,0xff,0xff, 163 | 0xf1,0xf1,0x11,0x11, 164 | 0x11,0x11,0x11,0x11, 165 | 0x1f,0x1f,0x11,0x11, 166 | 0x11,0x11,0xff,0xff, 167 | 0x80,0x80,0x40,0x40, 168 | 0x20,0x20,0x1f,0x1f, 169 | 0x18,0x18,0x14,0x14, 170 | 0x12,0x12,0x11,0x11, 171 | 0x00,0x00,0x00,0x00, 172 | 0x00,0x00,0xff,0xff, 173 | 0x00,0x00,0x00,0x00, 174 | 0x00,0x00,0xff,0xff, 175 | 0x01,0x01,0x02,0x02, 176 | 0x04,0x04,0xf8,0xf8, 177 | 0x18,0x18,0x28,0x28, 178 | 0x48,0x48,0x88,0x88, 179 | 0x84,0x84,0x84,0x84, 180 | 0x84,0x84,0x84,0x84, 181 | 0xc4,0xc4,0xfc,0xfc, 182 | 0xc6,0xc6,0x87,0x87, 183 | 0x11,0x11,0x12,0x12, 184 | 0x14,0x14,0x18,0x18, 185 | 0x1f,0x1f,0x20,0x20, 186 | 0x40,0x40,0x80,0x80, 187 | 0x88,0x88,0x48,0x48, 188 | 0x28,0x28,0x18,0x18, 189 | 0xf8,0xf8,0x04,0x04, 190 | 0x02,0x02,0x01,0x01, 191 | 0x85,0x85,0x86,0x86, 192 | 0x87,0x87,0x88,0x88, 193 | 0x90,0x90,0xa0,0xa0, 194 | 0xc0,0xc0,0xff,0xff, 195 | 0x01,0x01,0x03,0x03, 196 | 0xff,0xff,0x04,0x04, 197 | 0x04,0x04,0x04,0x04, 198 | 0x0e,0x0e,0xff,0xff, 199 | 0xa1,0xa1,0x61,0x61, 200 | 0xe1,0xe1,0x11,0x11, 201 | 0x09,0x09,0x05,0x05, 202 | 0x03,0x03,0xff,0xff, 203 | 0x63,0x63,0x23,0x23, 204 | 0x24,0x24,0x28,0x28, 205 | 0x30,0x30,0x7f,0x7f, 206 | 0x61,0x61,0x80,0x80, 207 | 0xff,0xff,0x33,0x33, 208 | 0x11,0x11,0x11,0x11, 209 | 0x11,0x11,0xff,0xff, 210 | 0x83,0x83,0x01,0x01, 211 | 0xc6,0xc6,0xc4,0xc4, 212 | 0x24,0x24,0x14,0x14, 213 | 0x0c,0x0c,0xfe,0xfe, 214 | 0x86,0x86,0x01,0x01, 215 | 0x89,0x89,0x8a,0x8a, 216 | 0x8c,0x8c,0x8f,0x8f, 217 | 0x90,0x90,0xa0,0xa0, 218 | 0xc0,0xc0,0xff,0xff, 219 | 0x01,0x01,0x01,0x01, 220 | 0x01,0x01,0xff,0xff, 221 | 0x10,0x10,0x10,0x10, 222 | 0x10,0x10,0xff,0xff, 223 | 0x00,0x00,0x00,0x00, 224 | 0x00,0x00,0xff,0xff, 225 | 0x08,0x08,0x08,0x08, 226 | 0x08,0x08,0xff,0xff, 227 | 0x01,0x01,0x01,0x01, 228 | 0x01,0x01,0xff,0xff, 229 | 0x09,0x09,0x09,0x09, 230 | 0x09,0x09,0xff,0xff, 231 | 0x91,0x91,0x51,0x51, 232 | 0x31,0x31,0xf1,0xf1, 233 | 0x09,0x09,0x05,0x05, 234 | 0x03,0x03,0xff,0xff, 235 | 0x88,0x88,0xbf,0xbf, 236 | 0xe0,0xe0,0xc3,0xc3, 237 | 0x8f,0x8f,0x9f,0x9f, 238 | 0xbf,0xbf,0xbf,0xbf, 239 | 0x21,0x21,0xff,0xff, 240 | 0x00,0x00,0xfe,0xfe, 241 | 0xf6,0xf6,0xda,0xda, 242 | 0xf6,0xf6,0xda,0xda, 243 | 0x84,0x84,0xff,0xff, 244 | 0x00,0x00,0x7f,0x7f, 245 | 0x5b,0x5b,0x6f,0x6f, 246 | 0x5b,0x5b,0x6f,0x6f, 247 | 0x11,0x11,0xfd,0xfd, 248 | 0x07,0x07,0xc3,0xc3, 249 | 0xf1,0xf1,0xf9,0xf9, 250 | 0xfd,0xfd,0xfd,0xfd, 251 | 0xbf,0xbf,0xbf,0xbf, 252 | 0x9f,0x9f,0x8f,0x8f, 253 | 0xc3,0xc3,0xe0,0xe0, 254 | 0xbf,0xbf,0x88,0x88, 255 | 0xf6,0xf6,0xda,0xda, 256 | 0xf6,0xf6,0xda,0xda, 257 | 0xfe,0xfe,0x00,0x00, 258 | 0xff,0xff,0x21,0x21, 259 | 0x5b,0x5b,0x6f,0x6f, 260 | 0x5b,0x5b,0x6f,0x6f, 261 | 0x7f,0x7f,0x00,0x00, 262 | 0xff,0xff,0x84,0x84, 263 | 0xfd,0xfd,0xfd,0xfd, 264 | 0xf9,0xf9,0xf1,0xf1, 265 | 0xc3,0xc3,0x07,0x07, 266 | 0xfd,0xfd,0x11,0x11, 267 | 0x88,0x88,0x88,0x88, 268 | 0x88,0x88,0x88,0x88, 269 | 0xf8,0xf8,0x88,0x88, 270 | 0x88,0x88,0xff,0xff, 271 | 0x61,0x61,0x21,0x21, 272 | 0x23,0x23,0x3f,0x3f, 273 | 0x21,0x21,0x21,0x21, 274 | 0x63,0x63,0xff,0xff, 275 | 0xff,0xff,0xce,0xce, 276 | 0x84,0x84,0x84,0x84, 277 | 0x84,0x84,0xff,0xff, 278 | 0xc3,0xc3,0x81,0x81, 279 | 0xc0,0xc0,0x5f,0x5f, 280 | 0x5a,0x5a,0x55,0x55, 281 | 0x5f,0x5f,0xda,0xda, 282 | 0x5f,0x5f,0x5f,0x5f, 283 | 0x03,0x03,0xfa,0xfa, 284 | 0xaa,0xaa,0x5a,0x5a, 285 | 0xfa,0xfa,0xab,0xab, 286 | 0xfa,0xfa,0xfa,0xfa, 287 | 0x81,0x81,0x81,0x81, 288 | 0x81,0x81,0xff,0xff, 289 | 0x90,0x90,0x90,0x90, 290 | 0x90,0x90,0xff,0xff, 291 | 0x5f,0x5f,0x5f,0x5f, 292 | 0x4f,0x4f,0xcf,0xcf, 293 | 0x47,0x47,0x63,0x63, 294 | 0x30,0x30,0xff,0xff, 295 | 0xfa,0xfa,0xfa,0xfa, 296 | 0xf2,0xf2,0xf3,0xf3, 297 | 0xe2,0xe2,0xc6,0xc6, 298 | 0x0c,0x0c,0xff,0xff 299 | }; 300 | 301 | 302 | const unsigned char dungeon_map[1024] = { 303 | 0x00,0x01,0x02,0x03,0x04,0x05,0x02,0x06,0x05,0x02,0x06,0x05,0x02,0x01,0x07,0x08,0x00,0x01,0x02,0x02,0x06,0x05,0x02,0x06,0x05,0x02,0x06,0x05,0x06,0x09,0x01,0x07, 304 | 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x0c,0x10,0x0f,0x0c,0x10,0x0f,0x0c,0x11,0x12,0x08,0x0a,0x0b,0x0c,0x0c,0x10,0x0f,0x0c,0x10,0x0f,0x0c,0x10,0x0f,0x10,0x13,0x11,0x12, 305 | 0x14,0x15,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x18,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1a,0x1b, 306 | 0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17, 307 | 0x18,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f, 308 | 0x1c,0x19,0x08,0x08,0x08,0x20,0x21,0x22,0x21,0x23,0x08,0x08,0x08,0x24,0x25,0x08,0x14,0x15,0x08,0x08,0x08,0x20,0x21,0x22,0x21,0x23,0x08,0x08,0x08,0x08,0x24,0x25, 309 | 0x14,0x15,0x08,0x08,0x08,0x16,0x26,0x27,0x28,0x1d,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x16,0x26,0x27,0x28,0x1d,0x08,0x08,0x08,0x08,0x16,0x17, 310 | 0x1c,0x19,0x08,0x08,0x08,0x1e,0x1f,0x08,0x1c,0x19,0x08,0x08,0x08,0x1e,0x12,0x08,0x0a,0x19,0x08,0x08,0x08,0x1e,0x1f,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x1e,0x1f, 311 | 0x18,0x1d,0x08,0x08,0x08,0x24,0x25,0x08,0x14,0x15,0x08,0x08,0x08,0x29,0x2a,0x01,0x2b,0x1d,0x08,0x08,0x08,0x1e,0x1f,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x16,0x17, 312 | 0x1c,0x19,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x2c,0x2d,0x0c,0x10,0x2e,0x08,0x08,0x08,0x24,0x25,0x08,0x14,0x15,0x08,0x08,0x08,0x08,0x1e,0x1f, 313 | 0x1c,0x19,0x08,0x08,0x08,0x1e,0x1f,0x08,0x18,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x16,0x17, 314 | 0x1c,0x19,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f,0x08,0x18,0x1d,0x08,0x08,0x08,0x08,0x1e,0x1f, 315 | 0x18,0x1d,0x08,0x08,0x08,0x1e,0x1f,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x24,0x25, 316 | 0x1c,0x19,0x08,0x08,0x08,0x16,0x17,0x08,0x0a,0x2f,0x21,0x23,0x08,0x08,0x08,0x20,0x21,0x21,0x22,0x21,0x30,0x31,0x12,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x16,0x17, 317 | 0x18,0x1d,0x08,0x08,0x08,0x1e,0x1f,0x08,0x32,0x27,0x28,0x1d,0x08,0x08,0x08,0x16,0x26,0x33,0x34,0x33,0x35,0x27,0x36,0x08,0x18,0x1d,0x08,0x08,0x08,0x08,0x1e,0x1f, 318 | 0x1c,0x19,0x08,0x08,0x08,0x24,0x12,0x08,0x08,0x08,0x1c,0x19,0x08,0x08,0x08,0x1e,0x1f,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0a,0x1d,0x08,0x08,0x08,0x08,0x16,0x17, 319 | 0x1c,0x19,0x08,0x08,0x08,0x29,0x2a,0x01,0x06,0x02,0x2b,0x1d,0x08,0x08,0x08,0x29,0x2a,0x01,0x07,0x08,0x00,0x01,0x02,0x01,0x2b,0x1d,0x08,0x08,0x08,0x08,0x1e,0x1f, 320 | 0x1c,0x19,0x08,0x08,0x08,0x2c,0x2d,0x0c,0x10,0x0c,0x10,0x2e,0x08,0x08,0x08,0x2c,0x2d,0x11,0x12,0x08,0x0a,0x0b,0x0c,0x0c,0x10,0x2e,0x08,0x08,0x08,0x08,0x16,0x1f, 321 | 0x37,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x39,0x3a, 322 | 0x3b,0x3c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3d,0x3e, 323 | 0x18,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x29,0x2a,0x01,0x2b,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f, 324 | 0x0a,0x2f,0x21,0x21,0x21,0x21,0x21,0x22,0x21,0x30,0x21,0x22,0x21,0x23,0x08,0x08,0x08,0x2c,0x2d,0x0c,0x10,0x2e,0x08,0x08,0x08,0x20,0x21,0x21,0x21,0x21,0x31,0x12, 325 | 0x32,0x27,0x33,0x33,0x33,0x33,0x33,0x34,0x33,0x35,0x33,0x27,0x28,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x26,0x27,0x33,0x33,0x27,0x36, 326 | 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f,0x08,0x08,0x08,0x08,0x08, 327 | 0x00,0x01,0x02,0x06,0x02,0x06,0x05,0x02,0x06,0x05,0x01,0x01,0x2b,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x29,0x2a,0x01,0x02,0x06,0x01,0x07, 328 | 0x0a,0x0b,0x0c,0x10,0x0c,0x10,0x0f,0x0c,0x10,0x0f,0x10,0x0c,0x10,0x2e,0x08,0x08,0x08,0x20,0x21,0x22,0x21,0x23,0x08,0x08,0x08,0x2c,0x2d,0x10,0x0c,0x10,0x11,0x12, 329 | 0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x26,0x27,0x28,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x24,0x25, 330 | 0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x24,0x25,0x08,0x14,0x15,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17, 331 | 0x18,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x16,0x17,0x08,0x1c,0x19,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f, 332 | 0x3f,0x40,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f,0x08,0x18,0x1d,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1e,0x1f, 333 | 0x0a,0x2f,0x41,0x42,0x43,0x21,0x30,0x21,0x21,0x21,0x22,0x21,0x30,0x21,0x21,0x30,0x22,0x31,0x12,0x08,0x0a,0x2f,0x21,0x22,0x21,0x30,0x21,0x22,0x21,0x30,0x31,0x12, 334 | 0x32,0x27,0x44,0x45,0x46,0x33,0x35,0x33,0x33,0x33,0x34,0x33,0x35,0x33,0x33,0x35,0x34,0x27,0x36,0x08,0x32,0x27,0x33,0x34,0x33,0x35,0x33,0x34,0x33,0x35,0x27,0x36, 335 | }; 336 | -------------------------------------------------------------------------------- /shintendo-method/res/dungeon.h: -------------------------------------------------------------------------------- 1 | //AUTOGENERATED FILE FROM png2asset 2 | #ifndef METASPRITE_dungeon_H 3 | #define METASPRITE_dungeon_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define dungeon_TILE_ORIGIN 0 10 | #define dungeon_TILE_W 8 11 | #define dungeon_TILE_H 8 12 | #define dungeon_WIDTH 256 13 | #define dungeon_HEIGHT 256 14 | #define dungeon_TILE_COUNT 71 15 | #define dungeon_PALETTE_COUNT 1 16 | #define dungeon_COLORS_PER_PALETTE 4 17 | #define dungeon_TOTAL_COLORS 4 18 | #define dungeon_MAP_ATTRIBUTES 0 19 | 20 | BANKREF_EXTERN(dungeon) 21 | 22 | extern const palette_color_t dungeon_palettes[4]; 23 | extern const uint8_t dungeon_tiles[1136]; 24 | 25 | extern const unsigned char dungeon_map[1024]; 26 | #define dungeon_map_attributes dungeon_map 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /shintendo-method/res/dungeon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/res/dungeon.png -------------------------------------------------------------------------------- /shintendo-method/res/sprite.c: -------------------------------------------------------------------------------- 1 | //AUTOGENERATED FILE FROM png2asset 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | BANKREF(sprite) 8 | 9 | const palette_color_t sprite_palettes[4] = { 10 | RGB8( 46,104, 80), RGB8(225,247,206), RGB8(135,192,106), RGB8( 5, 16, 22) 11 | 12 | }; 13 | 14 | const uint8_t sprite_tiles[576] = { 15 | 0x00,0x00,0x00,0x00, 16 | 0x00,0x00,0x00,0x00, 17 | 0x00,0x00,0x00,0x00, 18 | 0x00,0x00,0x00,0x01, 19 | 0x00,0x03,0x00,0x07, 20 | 0x00,0x0f,0x00,0x0f, 21 | 0x00,0x1f,0x00,0x3f, 22 | 0x00,0x3f,0x00,0x3f, 23 | 24 | 0x00,0x00,0x00,0x00, 25 | 0x00,0x07,0x00,0x0f, 26 | 0x00,0x3f,0x00,0x7f, 27 | 0x00,0xff,0x00,0xff, 28 | 0x00,0xff,0x00,0xff, 29 | 0x00,0xff,0x01,0xfe, 30 | 0x03,0xfc,0x07,0xf8, 31 | 0x0f,0xf0,0x1f,0xe0, 32 | 33 | 0x00,0x1f,0x00,0xff, 34 | 0x00,0xff,0x00,0xff, 35 | 0x00,0xff,0x00,0xff, 36 | 0x00,0xff,0x00,0xff, 37 | 0x03,0xfc,0x1f,0xe0, 38 | 0x7f,0x80,0xff,0x00, 39 | 0xff,0x00,0xff,0x00, 40 | 0xff,0x00,0xff,0x00, 41 | 42 | 0x00,0x7f,0x00,0x7f, 43 | 0x00,0x7f,0x00,0xff, 44 | 0x00,0xff,0x00,0xff, 45 | 0x00,0xff,0x00,0xff, 46 | 0x00,0xff,0x00,0xff, 47 | 0x00,0xff,0x00,0xff, 48 | 0x00,0xff,0x00,0x7f, 49 | 0x00,0x7f,0x00,0x7f, 50 | 51 | 0x1f,0xe0,0x3f,0xc0, 52 | 0x3f,0xc0,0x7f,0x80, 53 | 0x7f,0x80,0x7f,0x80, 54 | 0xff,0x00,0xff,0x00, 55 | 0xff,0x00,0xff,0x00, 56 | 0x7f,0x80,0x7f,0x80, 57 | 0x7f,0x80,0x3f,0xc0, 58 | 0x3f,0xc0,0x1f,0xe0, 59 | 60 | 0xff,0x07,0xfb,0x0c, 61 | 0xf7,0x18,0xf3,0x2c, 62 | 0xff,0x3e,0xdb,0x6c, 63 | 0xee,0x71,0xfd,0x12, 64 | 0xe0,0x3f,0xff,0x3f, 65 | 0xff,0x0b,0xfa,0x0f, 66 | 0xfb,0x0e,0xff,0x07, 67 | 0xfe,0x0d,0xff,0x0f, 68 | 69 | 0xff,0xe0,0x9f,0x70, 70 | 0xef,0x1e,0xdf,0x32, 71 | 0xb7,0x6c,0x2f,0xf8, 72 | 0xdf,0x30,0xbf,0x60, 73 | 0xff,0xf0,0xbf,0xd0, 74 | 0xef,0x98,0x6f,0x98, 75 | 0x5f,0xb8,0xbf,0xf0, 76 | 0xff,0x20,0xff,0xe0, 77 | 78 | 0xff,0x00,0xff,0x07, 79 | 0xfb,0x0c,0xf7,0x18, 80 | 0xf3,0x2c,0xff,0x3e, 81 | 0xdb,0x6c,0xee,0x71, 82 | 0xfd,0x12,0xe0,0x3f, 83 | 0xff,0x3f,0xfc,0x17, 84 | 0xf6,0x1d,0xff,0x1f, 85 | 0xf7,0x29,0xff,0x3f, 86 | 87 | 0xff,0x00,0xff,0xe0, 88 | 0x9f,0x70,0xef,0x1e, 89 | 0xdf,0x32,0xb7,0x6c, 90 | 0x2f,0xf8,0xdf,0x30, 91 | 0xbf,0x70,0xdf,0xf0, 92 | 0xaf,0xd8,0xef,0x18, 93 | 0xcf,0x3c,0x37,0xfc, 94 | 0xef,0xd4,0xff,0xfc, 95 | 96 | 0xff,0x03,0xfc,0x07, 97 | 0xfb,0xfc,0xef,0x98, 98 | 0xeb,0x5c,0xcb,0x7c, 99 | 0xf7,0x38,0xfd,0x1e, 100 | 0xff,0x3f,0xdf,0x73, 101 | 0xd8,0x77,0xf9,0x3e, 102 | 0xfb,0x3f,0xfe,0x1f, 103 | 0xff,0x3f,0xff,0x1f, 104 | 105 | 0xff,0xc0,0x3f,0xe0, 106 | 0xdf,0x3f,0xf7,0x19, 107 | 0xd7,0x3a,0xd3,0x3e, 108 | 0xef,0x1c,0xbf,0x78, 109 | 0xff,0xfc,0xff,0xce, 110 | 0x1d,0xef,0x9d,0x7f, 111 | 0xdf,0xfe,0x7f,0xf8, 112 | 0xe7,0xfc,0xff,0xf8, 113 | 114 | 0xff,0x00,0xff,0x03, 115 | 0xfc,0x07,0xfb,0xfc, 116 | 0xef,0x98,0xeb,0x5c, 117 | 0xcb,0x7c,0xf7,0x38, 118 | 0xfd,0x3e,0xff,0x7f, 119 | 0xbf,0xf3,0xb8,0xf7, 120 | 0xf9,0x7e,0xfb,0x1f, 121 | 0xe6,0x3f,0xff,0x1f, 122 | 123 | 0xff,0x00,0xff,0xc0, 124 | 0x3f,0xe0,0xdf,0x3f, 125 | 0xf7,0x19,0xd7,0x3a, 126 | 0xd3,0x3e,0xef,0x1c, 127 | 0xbf,0x7c,0xfb,0xfe, 128 | 0xfb,0xce,0x3f,0xcc, 129 | 0x9f,0x7c,0xdf,0xf8, 130 | 0x7f,0xfc,0xff,0xf8, 131 | 132 | 0xff,0x00,0xff,0x07, 133 | 0xfb,0x0c,0xf7,0xf8, 134 | 0xf3,0x8c,0xe5,0x5e, 135 | 0xde,0x67,0xee,0x31, 136 | 0xf7,0x18,0xf8,0x7f, 137 | 0x9f,0xf7,0xb8,0xdf, 138 | 0xf3,0x7c,0xfd,0x26, 139 | 0xe5,0x3f,0xff,0x1f, 140 | 141 | 0xff,0x00,0xff,0xe0, 142 | 0xdf,0x30,0xef,0x1f, 143 | 0xcf,0x31,0xa7,0x7a, 144 | 0x7b,0xe6,0x77,0x8c, 145 | 0xef,0x1e,0x19,0xff, 146 | 0xfd,0xeb,0x1f,0xfe, 147 | 0xff,0x3c,0xa7,0x7c, 148 | 0xbf,0xf8,0xff,0xf8, 149 | 150 | 0xff,0x07,0xfb,0x0c, 151 | 0xf7,0xf8,0xf3,0x8c, 152 | 0xe5,0x5e,0xde,0x67, 153 | 0xee,0x31,0xf7,0x18, 154 | 0xf8,0x7f,0x9f,0xff, 155 | 0xbc,0xd7,0xfb,0x7c, 156 | 0xfd,0x3e,0xe5,0x3f, 157 | 0xff,0x1f,0xff,0x1f, 158 | 159 | 0xff,0xe0,0xdf,0x30, 160 | 0xef,0x1f,0xcf,0x31, 161 | 0xa7,0x7a,0x7b,0xe6, 162 | 0x77,0x8c,0xef,0x18, 163 | 0x1f,0xf8,0xff,0xfe, 164 | 0x39,0xef,0xdd,0x3b, 165 | 0x8f,0x7e,0xbf,0xe4, 166 | 0xe7,0xfc,0xff,0xf8, 167 | 168 | 0xff,0x00,0xff,0x00, 169 | 0xff,0x00,0xff,0x00, 170 | 0xff,0x00,0xff,0x00, 171 | 0xff,0x00,0xff,0x00, 172 | 0xff,0x00,0xff,0x00, 173 | 0xff,0x00,0xff,0x00, 174 | 0xff,0x00,0xff,0x00, 175 | 0xff,0x00,0xff,0x00 176 | 177 | }; 178 | 179 | const metasprite_t sprite_metasprite0[] = { 180 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 181 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 182 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 183 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 184 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 185 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 186 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 187 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 188 | METASPR_ITEM(0, 8, 10, S_PAL(0) | S_PRIORITY), 189 | METASPR_ITEM(0, 8, 12, S_PAL(0) | S_PRIORITY), 190 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 191 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 192 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 193 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 194 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 195 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 196 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 197 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 198 | METASPR_TERM 199 | }; 200 | 201 | const metasprite_t sprite_metasprite1[] = { 202 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 203 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 204 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 205 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 206 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 207 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 208 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 209 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 210 | METASPR_ITEM(0, 8, 14, S_PAL(0) | S_PRIORITY), 211 | METASPR_ITEM(0, 8, 16, S_PAL(0) | S_PRIORITY), 212 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 213 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 214 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 215 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 216 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 217 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 218 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 219 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 220 | METASPR_TERM 221 | }; 222 | 223 | const metasprite_t sprite_metasprite2[] = { 224 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 225 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 226 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 227 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 228 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 229 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 230 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 231 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 232 | METASPR_ITEM(0, 8, 18, S_PAL(0) | S_PRIORITY), 233 | METASPR_ITEM(0, 8, 20, S_PAL(0) | S_PRIORITY), 234 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 235 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 236 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 237 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 238 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 239 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 240 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 241 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 242 | METASPR_TERM 243 | }; 244 | 245 | const metasprite_t sprite_metasprite3[] = { 246 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 247 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 248 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 249 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 250 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 251 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 252 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 253 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 254 | METASPR_ITEM(0, 8, 22, S_PAL(0) | S_PRIORITY), 255 | METASPR_ITEM(0, 8, 24, S_PAL(0) | S_PRIORITY), 256 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 257 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 258 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 259 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 260 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 261 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 262 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 263 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 264 | METASPR_TERM 265 | }; 266 | 267 | const metasprite_t sprite_metasprite4[] = { 268 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 269 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 270 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 271 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 272 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 273 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 274 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 275 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 276 | METASPR_ITEM(0, 8, 12, S_PAL(0) | S_FLIPX | S_PRIORITY), 277 | METASPR_ITEM(0, 8, 10, S_PAL(0) | S_FLIPX | S_PRIORITY), 278 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 279 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 280 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 281 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 282 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 283 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 284 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 285 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 286 | METASPR_TERM 287 | }; 288 | 289 | const metasprite_t sprite_metasprite5[] = { 290 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 291 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 292 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 293 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 294 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 295 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 296 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 297 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 298 | METASPR_ITEM(0, 8, 16, S_PAL(0) | S_FLIPX | S_PRIORITY), 299 | METASPR_ITEM(0, 8, 14, S_PAL(0) | S_FLIPX | S_PRIORITY), 300 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 301 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 302 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 303 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 304 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 305 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 306 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 307 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 308 | METASPR_TERM 309 | }; 310 | 311 | const metasprite_t sprite_metasprite6[] = { 312 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 313 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 314 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 315 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 316 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 317 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 318 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 319 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 320 | METASPR_ITEM(0, 8, 26, S_PAL(0) | S_PRIORITY), 321 | METASPR_ITEM(0, 8, 28, S_PAL(0) | S_PRIORITY), 322 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 323 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 324 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 325 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 326 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 327 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 328 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 329 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 330 | METASPR_TERM 331 | }; 332 | 333 | const metasprite_t sprite_metasprite7[] = { 334 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 335 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 336 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 337 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 338 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 339 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 340 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 341 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 342 | METASPR_ITEM(0, 8, 30, S_PAL(0) | S_PRIORITY), 343 | METASPR_ITEM(0, 8, 32, S_PAL(0) | S_PRIORITY), 344 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 345 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 346 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 347 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 348 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 349 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 350 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 351 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 352 | METASPR_TERM 353 | }; 354 | 355 | const metasprite_t sprite_metasprite8[] = { 356 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 357 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 358 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 359 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 360 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 361 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 362 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 363 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 364 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 365 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 366 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 367 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 368 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 369 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 370 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 371 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 372 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 373 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 374 | METASPR_TERM 375 | }; 376 | 377 | const metasprite_t sprite_metasprite9[] = { 378 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 379 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 380 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 381 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 382 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 383 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 384 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 385 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 386 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 387 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 388 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 389 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 390 | METASPR_ITEM(16, -40, 0, S_PAL(0) | S_FLIPY | S_PRIORITY), 391 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPY | S_PRIORITY), 392 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPY | S_PRIORITY), 393 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 394 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 395 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_FLIPY | S_PRIORITY), 396 | METASPR_TERM 397 | }; 398 | 399 | const metasprite_t sprite_metasprite10[] = { 400 | METASPR_ITEM(-24, -24, 0, S_PAL(0) | S_PRIORITY), 401 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_PRIORITY), 402 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_PRIORITY), 403 | METASPR_ITEM(0, 8, 4, S_PAL(0) | S_FLIPX | S_PRIORITY), 404 | METASPR_ITEM(0, 8, 2, S_PAL(0) | S_FLIPX | S_PRIORITY), 405 | METASPR_ITEM(0, 8, 0, S_PAL(0) | S_FLIPX | S_PRIORITY), 406 | METASPR_ITEM(16, -40, 6, S_PAL(0) | S_PRIORITY), 407 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_PRIORITY), 408 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 409 | METASPR_ITEM(0, 8, 34, S_PAL(0) | S_PRIORITY), 410 | METASPR_ITEM(0, 8, 8, S_PAL(0) | S_FLIPX | S_PRIORITY), 411 | METASPR_ITEM(0, 8, 6, S_PAL(0) | S_FLIPX | S_PRIORITY), 412 | METASPR_TERM 413 | }; 414 | 415 | const metasprite_t* const sprite_metasprites[11] = { 416 | sprite_metasprite0, sprite_metasprite1, sprite_metasprite2, sprite_metasprite3, sprite_metasprite4, sprite_metasprite5, sprite_metasprite6, sprite_metasprite7, sprite_metasprite8, sprite_metasprite9, sprite_metasprite10 417 | }; 418 | -------------------------------------------------------------------------------- /shintendo-method/res/sprite.h: -------------------------------------------------------------------------------- 1 | //AUTOGENERATED FILE FROM png2asset 2 | #ifndef METASPRITE_sprite_H 3 | #define METASPRITE_sprite_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define sprite_TILE_ORIGIN 0 10 | #define sprite_TILE_W 8 11 | #define sprite_TILE_H 16 12 | #define sprite_WIDTH 48 13 | #define sprite_HEIGHT 48 14 | #define sprite_TILE_COUNT 36 15 | #define sprite_PALETTE_COUNT 1 16 | #define sprite_COLORS_PER_PALETTE 4 17 | #define sprite_TOTAL_COLORS 4 18 | #define sprite_PIVOT_X 24 19 | #define sprite_PIVOT_Y 24 20 | #define sprite_PIVOT_W 48 21 | #define sprite_PIVOT_H 48 22 | 23 | BANKREF_EXTERN(sprite) 24 | 25 | extern const palette_color_t sprite_palettes[4]; 26 | extern const uint8_t sprite_tiles[576]; 27 | 28 | extern const metasprite_t* const sprite_metasprites[11]; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /shintendo-method/res/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/res/sprite.png -------------------------------------------------------------------------------- /shintendo-method/res/sprite_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/res/sprite_small.png -------------------------------------------------------------------------------- /shintendo-method/src/common.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "common.h" 5 | 6 | uint8_t keys = 0; 7 | uint8_t previous_keys = 0; 8 | 9 | -------------------------------------------------------------------------------- /shintendo-method/src/common.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef _COMMON_H 4 | #define _COMMON_H 5 | // Sprite Tile Data allocation 6 | 7 | #define UPDATE_KEYS() previous_keys = keys; keys = joypad() 8 | #define KEY_PRESSED(K) (keys & (K)) 9 | #define KEY_TICKED(K) ((keys & (K)) && !(previous_keys & (K))) 10 | #define KEY_RELEASED(K) ((previous_keys & (K)) && !(keys & (K))) 11 | #define ANY_KEY_PRESSED (keys) 12 | 13 | extern uint8_t keys; 14 | extern uint8_t previous_keys; 15 | 16 | #define SPR_PLY_X (((160u / 2u) - 8u) + 8u) // Centered. X position for sprites is -8 from set position 17 | #define SPR_PLY_Y (((144u / 2u) - 8u) + 16u) // Centered. Y Position for sprites is -16 from set position 18 | 19 | #define PLY_DIR_LEFT 0U 20 | #define PLY_DIR_UP 2U 21 | #define PLY_DIR_RIGHT 4U 22 | #define PLY_DIR_DOWN 6U 23 | #define PLY_DIR_RESET 0xFF 24 | 25 | 26 | 27 | #endif // _COMMON_H 28 | -------------------------------------------------------------------------------- /shintendo-method/src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Tile and map data 5 | #include "../res/sprite.h" 6 | #include "../res/dungeon.h" 7 | 8 | #include "common.h" 9 | 10 | 11 | // ==================================================================== 12 | 13 | void update_player_sprite(uint8_t dir) { 14 | 15 | // Priority flag is set in metasprite so sprite is under BG & Window except for BG Color 0 16 | // Rotate through frames using system time (could be updated less often) 17 | move_metasprite(sprite_metasprites[(dir) + ((sys_time >> 4)& 0x01u)], 0, 0, SPR_PLY_X, SPR_PLY_Y); 18 | } 19 | 20 | 21 | void init_gfx() { 22 | 23 | SPRITES_8x16; 24 | 25 | // Load background tiles and map 26 | set_bkg_data(0, dungeon_TILE_COUNT, dungeon_tiles); 27 | set_bkg_tiles(0, 0, dungeon_WIDTH >> 3, dungeon_HEIGHT >> 3, dungeon_map); 28 | // All black palette for Background 29 | BGP_REG = DMG_PALETTE(DMG_BLACK, DMG_BLACK, DMG_BLACK, DMG_BLACK); 30 | // Align background to a decent starting point (sprite not in a wall) 31 | move_bkg(19,0); 32 | 33 | // Load sprite tiles and set on center of screen 34 | SPRITES_8x16; 35 | set_sprite_data(0, sprite_TILE_COUNT, sprite_tiles); 36 | update_player_sprite(PLY_DIR_LEFT); 37 | // First color is transparent, doesn't matter 38 | OBP0_REG = DMG_PALETTE(DMG_BLACK, DMG_WHITE, DMG_LITE_GRAY, DMG_BLACK); 39 | 40 | SHOW_BKG; 41 | HIDE_WIN; 42 | SHOW_SPRITES; 43 | } 44 | 45 | 46 | 47 | uint8_t const * p_x_end; 48 | 49 | void main(void) 50 | { 51 | init_gfx(); 52 | 53 | // Loop endlessly 54 | while(1) { 55 | 56 | UPDATE_KEYS(); // Read Joypad 57 | 58 | // Move player (via background scroll) if needed 59 | if (keys & J_LEFT) { 60 | scroll_bkg(-1,0); 61 | update_player_sprite(PLY_DIR_LEFT); 62 | } 63 | else if (keys & J_RIGHT) { 64 | scroll_bkg(1,0); 65 | update_player_sprite(PLY_DIR_RIGHT); 66 | } 67 | else if (keys & J_UP) { 68 | scroll_bkg(0,-1); 69 | update_player_sprite(PLY_DIR_UP); 70 | } 71 | else if (keys & J_DOWN) { 72 | scroll_bkg(0,1); 73 | update_player_sprite(PLY_DIR_DOWN); 74 | } 75 | 76 | wait_vbl_done(); // Yield CPU till the end of each frame 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /shintendo-method/torch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/torch.gif -------------------------------------------------------------------------------- /shintendo-method/torch_flicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/torch_flicker.gif -------------------------------------------------------------------------------- /shintendo-method/torch_gbdk_shintendo_method.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbbbbr/gb-torch-effect/51ca11a62ae17bc1db24d188b65f350ec1abf1f0/shintendo-method/torch_gbdk_shintendo_method.gif -------------------------------------------------------------------------------- /src/common.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "common.h" 5 | 6 | uint8_t keys = 0; 7 | uint8_t previous_keys = 0; 8 | 9 | -------------------------------------------------------------------------------- /src/common.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef _COMMON_H 4 | #define _COMMON_H 5 | // Sprite Tile Data allocation 6 | 7 | // 8 x 16 sprite mode 8 | #define SPR_TILE_COUNT_PLAYER (8u * 4u) // 8 (16x16) sprite frames x 4 tiles each (2 frames per direction) 9 | #define SPR_TILE_COUNT_MASK_SM (4u * 2u) // 3 x (8x16) sprite frames x 2 tiles each 10 | #define SPR_TILE_COUNT_MASK_LG (6u * 2u) // 5 x (8x16) sprite frames x 2 tiles each 11 | #define SPR_TILE_START_MASK_SM SPR_TILE_COUNT_PLAYER 12 | #define SPR_TILE_START_MASK_LG (SPR_TILE_COUNT_PLAYER + SPR_TILE_COUNT_MASK_SM) 13 | 14 | #define UPDATE_KEYS() previous_keys = keys; keys = joypad() 15 | #define KEY_PRESSED(K) (keys & (K)) 16 | #define KEY_TICKED(K) ((keys & (K)) && !(previous_keys & (K))) 17 | #define KEY_RELEASED(K) ((previous_keys & (K)) && !(keys & (K))) 18 | #define ANY_KEY_PRESSED (keys) 19 | 20 | extern uint8_t keys; 21 | extern uint8_t previous_keys; 22 | 23 | #define BKG_TILE_WHITE 1 // 2rd tile in set is solid white 24 | #define BKG_TILE_BLACK 2 // 3rd tile in set is solid black 25 | 26 | #define SPR_PLY_LEFT 0 27 | #define SPR_PLY_RIGHT 1 28 | 29 | #define SPR_PLY_X (((160u / 2u) - 8u) + 8u) // Centered. X position for sprites is -8 from set position 30 | #define SPR_PLY_Y (((144u / 2u) - 8u) + 16u) // Centered. Y Position for sprites is -16 from set position 31 | 32 | #define PLY_DIR_LEFT 0U 33 | #define PLY_DIR_UP 2U 34 | #define PLY_DIR_RIGHT 4U 35 | #define PLY_DIR_DOWN 6U 36 | #define PLY_DIR_RESET 0xFF 37 | 38 | 39 | 40 | #endif // _COMMON_H -------------------------------------------------------------------------------- /src/lcd_isr.s: -------------------------------------------------------------------------------- 1 | ; From SameBoy 2 | ; Each line is 456 cycles. Without scrolling, sprites or a window: 3 | ; Mode 2 - 80 cycles / OAM Transfer 4 | ; Mode 3 - 172 cycles / Rendering 5 | ; Mode 0 - 204 cycles / HBlank 6 | ; 7 | ; Mode 1 is VBlank 8 | 9 | .area _HEADER_LCD (ABS) 10 | 11 | .org 0x48 ; LCD (Install LCD handler at interrupt address) 12 | .custom_int_LCD_vec: 13 | JP .custom_int_LCD ; Call main LCD interrupt handler 14 | 15 | .area _BASE 16 | 17 | 18 | 19 | .custom_int_LCD: 20 | PUSH AF ; 2 21 | PUSH BC ; 2 22 | PUSH HL ; 2 23 | ; == Prep for WX Right-side Rounded Window Update 24 | ; Loads address at *p_x_end in BC 25 | ld hl, #_p_x_end+0 26 | ld c, (hl) 27 | inc hl 28 | ld b, (hl) 29 | ld a, (bc) 30 | 31 | ldh (_WX_REG+0), a ; == Load Window location for first line 32 | inc c ; Move pointer to next LUT entry (LUT is 128 byte aligned, don't need a 16 bit add 33 | 34 | ; Then This is performed below for each scanline + inc c 35 | ; ld a, (bc) 36 | ; ldh (_WX_REG+0),a 37 | ; inc c 38 | 39 | 40 | ; Try to line main loop up with start of Mode 2 (Search Objs) 41 | 42 | ; Per-Scanline Modes: 2 (Search Objs) -> 3 (Render) -> 0 (H-Blank) 43 | ; 44 | ; == Since end of Mode 3 -> 0 timing can fluctuate with 45 | ; extra cycles when sprites are fetched, use the (hoepfully) 46 | ; more consistant mode 0 -> 2 transition to align instead 47 | 48 | ld h, #0x03 ; Pre-load mask into A 49 | wait_mode_10$: ; Wait for H-Blank (Mode 0) 50 | ldh a, (_STAT_REG+0) 51 | and a, h ; Mask to 0x03 52 | jr nz, wait_mode_10$ ; Exit loop on Mode 3 (Render) -> 0 (H-Blank) transition 53 | 54 | wait_mode_23$: 55 | ldh a, (_STAT_REG+0) 56 | and a, h ; Mask to 0x03 57 | jr z, wait_mode_23$ ; Exit loop on Mode 0 (H-Blank) -> 2 (Search Objs) transition 58 | 59 | 60 | ; Should now be ~ Mode 2 (Search Objs) 61 | lcd_loop_start$: 62 | 63 | ld a, #0xEF 64 | ldh (_LCDC_REG+0),a ; Swap BG Tile Map to Alt 65 | ;; ld a, #0x00 ; White 66 | ; ld a, #0xFF ; Black 67 | ; ldh (_BGP_REG+0),a ; Set Background Pal to new color at start of row 68 | 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | 75 | 76 | nop 77 | nop 78 | nop 79 | nop 80 | nop ; ~ Mode 3 (Render) begins 81 | 82 | nop 83 | nop 84 | nop 85 | nop 86 | nop 87 | 88 | nop 89 | ; One less NOP before the swap causes 90 | ; a gap to show and requires another 91 | ; column of masking sprites. 92 | ; 93 | ; One more NOP and the scx % 8 behavior 94 | ; bumps out into the spotlight area. 95 | ; 96 | ; Timing appears a little more sensitive 97 | ; on MGB hardware than CGB/AGS-CGB. 98 | 99 | ; == End of left edge BG masking 100 | 101 | ld a, #0xE7 102 | ldh (_LCDC_REG+0), a ; Swap BG Tile Map to Main 103 | ; ld a, #0xE4 104 | ; ldh (_BGP_REG+0), a ; Set Background Pal to Normal 105 | 106 | nop 107 | nop 108 | nop 109 | nop 110 | 111 | nop 112 | nop 113 | nop 114 | nop 115 | nop 116 | 117 | nop 118 | nop 119 | nop 120 | nop 121 | nop 122 | 123 | nop 124 | nop 125 | nop 126 | nop 127 | nop 128 | 129 | nop 130 | nop 131 | nop 132 | nop 133 | nop 134 | 135 | nop 136 | nop 137 | nop 138 | nop 139 | nop 140 | 141 | nop 142 | nop 143 | nop 144 | nop 145 | nop 146 | 147 | 148 | nop 149 | nop 150 | nop 151 | nop 152 | nop 153 | 154 | nop 155 | nop 156 | 157 | 158 | nop 159 | 160 | 161 | 162 | nop 163 | nop 164 | nop 165 | nop 166 | nop 167 | 168 | 169 | nop 170 | nop 171 | nop ; ~ Mode 0 (HBlank) begins 172 | nop 173 | nop 174 | ; == WX Right-side Rounded Window Update 175 | ; 176 | ; (After exit test so that WX update should be in hblank) 177 | ; Update WX each scanline from the circle LUT 178 | ; BC is pre-loaded with the first LUT address on entering the ISR 179 | ; 44 cycles total 180 | ld a, (bc) ; Load WX for current scanline from LUT (bc is pre-loaded) 181 | ldh (_WX_REG+0), a 182 | inc c ; Move pointer to next LUT entry (LUT is 128 byte aligned, don't need a 16 bit add 183 | 184 | nop 185 | nop 186 | nop 187 | nop 188 | nop 189 | 190 | 191 | nop 192 | nop 193 | nop 194 | nop 195 | nop 196 | 197 | 198 | nop 199 | nop 200 | nop 201 | nop 202 | nop 203 | 204 | ; == Test for Exit based on LY 205 | ldh a, (_LY_REG+0) 206 | ld hl, #_y_line_end 207 | sub a, (hl) 208 | jp Z, lcd_isr_exit$ ; Exit after ending Y line reached 209 | 210 | 211 | jp lcd_loop_start$ ; Otherwise, stay in ISR for another line 212 | 213 | 214 | 215 | lcd_isr_exit$: 216 | 217 | ld A, #0xEF 218 | ldh (_LCDC_REG+0), a ; Swap BG Tile Map to Alt 219 | ; ld a, #0xFF 220 | ; ldh (_BGP_REG+0), a ; Set Background Pal to Normal 221 | 222 | POP HL 223 | POP BC 224 | POP AF 225 | RETI 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | // Tile and map data 7 | #include "../res/dungeon_map.h" 8 | #include "../res/dungeon_tiles.h" 9 | 10 | #include "../res/sprite_tiles.h" 11 | 12 | #include "../res/circle_small_tiles.h" 13 | #include "../res/circle_large_tiles.h" 14 | 15 | #include "common.h" 16 | 17 | // Right edge window mask data 18 | #include "torch_win_data.h" 19 | #include "torch_sprite_data.h" 20 | 21 | // ==================================================================== 22 | 23 | uint8_t y_line_end = 0; 24 | 25 | void init_isr() { 26 | // Add the hblank ISR and enable it 27 | disable_interrupts(); 28 | LYC_REG = 48; // Start ISR at line 48 29 | STAT_REG = 0x40; // LYC ISR = ON 30 | // LCD ISR is in separate ASM file, no need to install it 31 | set_interrupts(VBL_IFLAG | LCD_IFLAG); 32 | enable_interrupts(); 33 | } 34 | 35 | 36 | void update_player_sprite(uint8_t dir) { 37 | 38 | static uint8_t tile_id = PLY_DIR_RESET; 39 | 40 | tile_id = dir * 4U; 41 | // Rotate through frames using system time (could be updated less often) 42 | set_sprite_tile(SPR_PLY_LEFT, tile_id + ((sys_time >> 1) & 0x04)); 43 | set_sprite_tile(SPR_PLY_RIGHT, tile_id + 2u + ((sys_time >> 1) & 0x04)); 44 | } 45 | 46 | 47 | void init_gfx() { 48 | 49 | // Load tiles (background + window) and map 50 | set_bkg_data(0, 79, dungeon_tiles); 51 | set_bkg_tiles(0, 0, 32, 32, dungeon_mapPLN0); 52 | // Set Window map to single solid color, move it to upper left and show it 53 | fill_win_rect(0, 0, 32, 32,BKG_TILE_BLACK); 54 | move_win(112,0); 55 | 56 | 57 | // Load sprite tiles 58 | SPRITES_8x16; 59 | set_sprite_data(0, SPR_TILE_COUNT_PLAYER, sprite_tiles); // 8 (16x16) sprite frames x 4 tiles each 60 | update_player_sprite(PLY_DIR_LEFT); 61 | // Center player on screen 62 | move_sprite(SPR_PLY_LEFT, SPR_PLY_X, SPR_PLY_Y); 63 | move_sprite(SPR_PLY_RIGHT, SPR_PLY_X + 8, SPR_PLY_Y); 64 | // 3= 3(black),2= 1 (l.gray), 1= 0 (white), 0= 2 (d.gray) TRANSP w/ PRIOR 65 | // Rearrange palette to (d.grey=transp, white, l.grey, black) 66 | OBP0_REG = (0x03u << 6) | (0x01u << 4) | (0x00u << 2) | (0x02u); 67 | 68 | // Window mask sprite data 69 | set_sprite_data(SPR_TILE_START_MASK_SM, SPR_TILE_COUNT_MASK_SM, circle_small_tiles); 70 | set_sprite_data(SPR_TILE_START_MASK_LG, SPR_TILE_COUNT_MASK_LG, circle_large_tiles); 71 | 72 | // Copy sprites that don't change into Shadow OAM 73 | memcpy( &(shadow_OAM[spr_count_fixed_start]), // dest (offset into shadow OAM) 74 | &(spr_circle_lg_fixed[0]), // src (sprite data in OAM format) 75 | spr_circle_lg_fixed_size); 76 | 77 | SHOW_BKG; 78 | SHOW_WIN; 79 | SHOW_SPRITES; 80 | } 81 | 82 | 83 | 84 | uint8_t const * p_x_end; 85 | 86 | void main(void) 87 | { 88 | // Pointer to one of the Window circle LUTs 89 | p_x_end = &X_END_LUT_SM[0]; 90 | 91 | init_gfx(); 92 | 93 | // Try to align with the start of a frame as in the loop below 94 | wait_vbl_done(); 95 | init_isr(); 96 | 97 | // Loop endlessly 98 | while(1) { 99 | 100 | // Alternate windowed size 101 | if (sys_time & 0x01) { 102 | // SMALL circle window config 103 | LYC_REG = Y_START; // Top 104 | WX_REG = X_END; // Right 105 | y_line_end = Y_END; // Bottom 106 | p_x_end = &X_END_LUT_SM[0]; 107 | 108 | // Left Edge masking 109 | // Set up *LARGE* circle to copy to OAM on next vblank (via shadow oam) 110 | memcpy( &(shadow_OAM[spr_count_change_start]), // dest (offset into shadow OAM) 111 | &(spr_circle_lg[0]), // src (sprite data in OAM format) 112 | spr_circle_lg_size); 113 | } else { 114 | // LARGE circle window config 115 | LYC_REG = (Y_START - Y_GROW); // Top // Can add one here to alternate Y line timing 116 | WX_REG = (X_END + X_GROW); // Right 117 | y_line_end = (Y_END + Y_GROW); // Bottom 118 | p_x_end = &X_END_LUT_LG[0]; 119 | 120 | // Left Edge masking 121 | // Set up *SMALL* circle to copy to OAM on next vblank (via shadow oam) 122 | memcpy( &(shadow_OAM[spr_count_change_start]), // dest (offset into shadow OAM) 123 | &(spr_circle_sm[0]), // src (sprite data in OAM format) 124 | spr_circle_sm_size); 125 | } 126 | 127 | UPDATE_KEYS(); // Read Joypad 128 | 129 | // Move player (via background scroll) if needed 130 | if (keys & J_LEFT) { 131 | scroll_bkg(-1,0); 132 | update_player_sprite(PLY_DIR_LEFT); 133 | } 134 | else if (keys & J_RIGHT) { 135 | scroll_bkg(1,0); 136 | update_player_sprite(PLY_DIR_RIGHT); 137 | } 138 | else if (keys & J_UP) { 139 | scroll_bkg(0,-1); 140 | update_player_sprite(PLY_DIR_UP); 141 | } 142 | else if (keys & J_DOWN) { 143 | scroll_bkg(0,1); 144 | update_player_sprite(PLY_DIR_DOWN); 145 | } 146 | 147 | wait_vbl_done(); // Yield CPU till the end of each frame 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/torch_sprite_data.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "common.h" 5 | #include "torch_sprite_data.h" 6 | 7 | // ==================================================================== 8 | 9 | // Sprite Circle Left Edge mask OAM arrangements 10 | 11 | 12 | // Block of sprites that do NOT change (Large circle) 13 | const uint8_t spr_circle_lg_fixed[] = { 14 | // Row 0 15 | // x y id flip 16 | C_L(0U, 0U, 0U, FLIP_NO), 17 | C_L(1U, 0U, 1U, FLIP_NO), 18 | C_L(2U, 0U, 2U, FLIP_NO), 19 | C_L(3U, 0U, 3U, FLIP_NO), 20 | C_L(4U, 0U, 4U, FLIP_NO), 21 | 22 | // Row 1 23 | C_L(0U, 1U, 0U, FLIP_NO), 24 | 25 | // Row 2 26 | C_L(0U, 2U, 0U, FLIP_NO), 27 | 28 | // Row 3 29 | // x y id flip 30 | C_L(0U, 3U, 0U, FLIP_V), 31 | C_L(1U, 3U, 1U, FLIP_V), 32 | C_L(2U, 3U, 2U, FLIP_V), 33 | C_L(3U, 3U, 3U, FLIP_V), 34 | C_L(4U, 3U, 4U, FLIP_V) 35 | }; 36 | 37 | 38 | // Center block of sprites that do change (Small circle) 39 | const uint8_t spr_circle_sm[] = { 40 | // Row 1 41 | // x y id flip 42 | C_S(1U, 1U, 0U, FLIP_NO), 43 | C_S(2U, 1U, 0U, FLIP_NO), 44 | C_S(3U, 1U, 1U, FLIP_NO), 45 | C_S(4U, 1U, 2U, FLIP_NO), 46 | // Row 2 47 | C_S(1U, 2U, 0U, FLIP_NO), 48 | C_S(2U, 2U, 0U, FLIP_NO), 49 | C_S(3U, 2U, 1U, FLIP_V), 50 | C_S(4U, 2U, 2U, FLIP_V) 51 | }; 52 | 53 | 54 | // Center block of sprites that do change (Large circle) 55 | const uint8_t spr_circle_lg[] = { 56 | // Row 1 57 | // x y id flip 58 | C_L(1U, 1U, 5U, FLIP_NO), 59 | C_HIDE(), 60 | C_HIDE(), 61 | C_HIDE(), 62 | // Row 2 63 | C_L(1U, 2U, 5U, FLIP_V), 64 | C_HIDE(), 65 | C_HIDE(), 66 | C_HIDE() 67 | }; 68 | 69 | 70 | #define OAM_BYTES_PER_SPRITE 4U 71 | #define SPR_COUNT_LG_FIXED (sizeof(spr_circle_lg_fixed) / OAM_BYTES_PER_SPRITE) 72 | #define SPR_COUNT_LG (sizeof(spr_circle_lg) / OAM_BYTES_PER_SPRITE) 73 | #define SPR_COUNT_SM (sizeof(spr_circle_sm) / OAM_BYTES_PER_SPRITE) 74 | 75 | #define SPR_COUNT_FIXED_START (40u - SPR_COUNT_LG_FIXED - SPR_COUNT_LG) 76 | 77 | const uint8_t spr_count_fixed_start = SPR_COUNT_FIXED_START; // Align with end of OAM 78 | const uint8_t spr_count_change_start = (SPR_COUNT_FIXED_START + (SPR_COUNT_LG_FIXED)); 79 | 80 | const uint8_t spr_circle_lg_fixed_size = sizeof(spr_circle_lg_fixed); 81 | const uint8_t spr_circle_lg_size = sizeof(spr_circle_sm); 82 | const uint8_t spr_circle_sm_size = sizeof(spr_circle_lg); -------------------------------------------------------------------------------- /src/torch_sprite_data.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TORCH_SPRITE_DATA_H 3 | #define _TORCH_SPRITE_DATA_H 4 | // ==================================================================== 5 | 6 | // Sprite Circle Left edge 7 | 8 | #define FLIP_NO 0x00U 9 | #define FLIP_V 0x40U 10 | #define SPR_MASK_ST_X (6 * 8) // Starts 5 tiles from Left edge 11 | #define SPR_MASK_ST_Y ((3.5 * 16) + 1)// Starts 3.5 tiles from Top edge + a small fudge factor 12 | #define C_S(x,y,id,vflip) (y * 16u) + SPR_MASK_ST_Y, (x * 8u) + SPR_MASK_ST_X, (id * 2u) + SPR_TILE_START_MASK_SM, vflip 13 | #define C_L(x,y,id,vflip) (y * 16u) + SPR_MASK_ST_Y, (x * 8u) + SPR_MASK_ST_X, (id * 2u) + SPR_TILE_START_MASK_LG, vflip 14 | #define C_HIDE() 0,0,0,0 // Sprite in non-visible position 15 | 16 | 17 | extern const uint8_t spr_circle_lg_fixed[]; 18 | extern const uint8_t spr_circle_sm[]; 19 | extern const uint8_t spr_circle_lg[]; 20 | 21 | extern const uint8_t spr_count_fixed_start; 22 | extern const uint8_t spr_count_change_start; 23 | 24 | extern const uint8_t spr_circle_lg_fixed_size; 25 | extern const uint8_t spr_circle_lg_size; 26 | extern const uint8_t spr_circle_sm_size; 27 | 28 | 29 | #endif // _TORCH_SPRITE_DATA_H -------------------------------------------------------------------------------- /src/torch_win_data.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "common.h" 5 | #include "torch_win_data.h" 6 | 7 | // ==================================================================== 8 | 9 | // Window Circle Right Edge MASK LUT 10 | // See xls file 11 | 12 | // 128 bit aligned 13 | // Relies on altered CODE location (moving it from 0x0200): -Wl-b_CODE=0x0300 14 | 15 | const uint8_t __at(0x200) X_END_LUT_SM[] = { 16 | 0x57u, 17 | 0x5Cu, 0x5Eu, 0x60u, 0x61u, 0x62u, 0x63u, 0x64u, 0x64u, 0x65u, 0x65u, 18 | 0x66u, 0x66u, 0x66u, 0x66u, 0x66u, 19 | 0x66u, // mid-point 20 | // 0x66u, // removed for roundness fix 21 | 0x66u, 0x66u, 0x66u, 0x66u, 22 | 0x65u, 0x65u, 0x64u, 0x64u, 0x63u, 0x62u, 0x61u, 0x60u, 0x5Eu, 0x5Cu, 23 | 0x57u 24 | }; 25 | 26 | // 128 bit aligned 27 | const uint8_t __at(0x280) X_END_LUT_LG[] = { 28 | 0x57u - 8u, // First line, a little fix for roundness 29 | 0x5Eu, 0x62u, 0x64u, 0x66u, 0x68u, 0x69u, 0x6Au, 0x6Cu, 0x6Du, 0x6Eu, 30 | 0x6Fu, 0x6Fu, 0x70u, 0x71u, 0x72u, 0x72u, 0x73u, 0x73u, 0x74u, 0x74u, 0x75u, 31 | 0x75u, 0x75u, 0x75u, 0x76u, 0x76u, 0x76u, 0x76u, 0x76u, 0x76u, 0x76u, 32 | 0x76u, // mid-point 33 | // 0x76u, // removed for roundness fix 34 | 0x76u, 0x76u, 0x76u, 0x76u, 0x76u, 0x76u, 0x75u, 0x75u, 0x75u, 0x75u, 35 | 0x74u, 0x74u, 0x73u, 0x73u, 0x72u, 0x72u, 0x71u, 0x70u, 0x6Fu, 0x6Fu, 0x6Eu, 36 | 0x6Du, 0x6Cu, 0x6Au, 0x69u, 0x68u, 0x66u, 0x64u, 0x62u, 0x5Eu, 37 | 0x57u - 8u // Last line, a little fix for roundness 38 | }; -------------------------------------------------------------------------------- /src/torch_win_data.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TORCH_WIN_DATA_H 3 | #define _TORCH_WIN_DATA_H 4 | 5 | #define Y_SIZE 16u // +/- center, so 2x for full size 6 | #define Y_GROW 16u 7 | #define Y_START (uint8_t)((144u / 2u) - Y_SIZE) 8 | #define Y_END (uint8_t)((144u / 2u) + Y_SIZE) // + 1 // +1 for proper centering <- not anymore 9 | 10 | #define X_SIZE 16u // +/- center, so 2x for full size 11 | #define X_GROW 16u 12 | #define X_START (uint8_t)((160u / 2u) - X_SIZE) 13 | #define X_END (uint8_t)((160u / 2u) + X_SIZE) // + 1 // +1 for proper centering <- not anymore 14 | 15 | 16 | extern const uint8_t __at(0x200) X_END_LUT_SM[]; 17 | extern const uint8_t __at(0x280) X_END_LUT_LG[]; 18 | 19 | 20 | #endif // _TORCH_WIN_DATA_H --------------------------------------------------------------------------------