summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhoenixBound <PhoenixBound@users.noreply.github.com>2020-02-22 19:45:50 -0600
committerPhoenixBound <PhoenixBound@users.noreply.github.com>2020-02-22 19:45:50 -0600
commit940d3ecfe46c98f0cd4f618ba068af9e4c1e8fcf (patch)
tree08b79cd1a1aac30d8d4502a2dd351eb1b3348fb3
parent367bf83fb64cf4ac75d5ba353b9b9cccafe7d110 (diff)
Bring up to date with object event naming
-rw-r--r--Adding-new-overworlds.md168
1 files changed, 74 insertions, 94 deletions
diff --git a/Adding-new-overworlds.md b/Adding-new-overworlds.md
index 7a2aa8f..62e3017 100644
--- a/Adding-new-overworlds.md
+++ b/Adding-new-overworlds.md
@@ -8,30 +8,30 @@ This tutorial is for adding a new overworld sprite. We'll be using the following
2. [Adding your image](#2-adding-your-image)
3. [Adding a new palette](#3-adding-a-new-palette)
4. [Adding a new pic table](#4-adding-a-new-pic-table)
-5. [Adding a new EventObjectGraphicsInfo entry](#5-adding-a-new-eventobjectgraphicsinfo-entry)
+5. [Adding a new ObjectEventGraphicsInfo entry](#5-adding-a-new-objecteventgraphicsinfo-entry)
6. [Adding a define for your overworld](#6-adding-a-define-for-your-overworld)
## 1. Formatting your image
-Your image should be saved as a .png with a bit depth of 4, allowing for a maximum palette of 16 colours. The first colour within the palette will be transparent in game so ensure that your background colour is in that first slot. The width and height should be a multiple of 8 (16, 32, 64 for example) and the poses should be ordered like the sprite sheet above in order to avoid having to make changes to the animation tables, although if desired making custom animations should be somewhat simple.
+Your image should be saved as a .png with a bit depth of 4, allowing for a maximum palette of 16 colours. The first colour within the palette will be transparent in game, so ensure that your background colour is in that first slot. The width and height should be a multiple of 8 (16, 32, 64 for example) and the poses should be ordered like the sprite sheet above in order to avoid having to make changes to the animation tables, although if desired making custom animations should be somewhat simple.
-The overworld, or event object graphics are located in **graphics/event_objects/pics** so it is recommended to save your image there.
+The overworld graphics, or object event graphics, are located in **graphics/object_events/pics** so it is recommended to save your image there.
## 2. Adding your image
-Within **src/data/field_event_obj/event_object_graphics.h** add a label for your image:
+Within **src/data/object_events/object_event_graphics.h** add a label for your image:
```c
-const u32 gEventObjectPic_Example[] = INCBIN_U32("graphics/event_objects/pics/people/example.4bpp");
+const u32 gObjectEventPic_Example[] = INCBIN_U32("graphics/object_events/pics/people/example.4bpp");
```
-If you want your new overworld to use a new palette then add that too. The palette can be generated from the .png so you don’t need to have a separate .pal file.
+If you want your new overworld to use a new palette, then add that too. The palette can be generated from the .png, so you don’t need to have a separate .pal file.
```c
-const u16 gEventObjectPalette_Example[] = INCBIN_U16("graphics/event_objects/pics/people/example.gbapal");
+const u16 gObjectEventPalette_Example[] = INCBIN_U16("graphics/object_events/pics/people/example.gbapal");
```
-Next you need to specify the build rules for the sprite sheet within **spritesheet_rules.mk**.
+Next, you need to specify the build rules for the sprite sheet within **spritesheet_rules.mk**.
–mwidth and –mheight represent the size of one frame of your spritesheet, in tiles rather than pixels (1 tile is 8x8 pixels).
Each frame of the example above is 32x32 pixels so the build rule becomes:
```mk
-$(EVENTOBJGFXDIR)/people/example.4bpp: %.4bpp: %.png
+$(OBJEVENTGFXDIR)/people/example.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 4 -mheight 4
```
## 3. Adding a new palette
@@ -39,55 +39,55 @@ If your new overworld uses an existing palette then you can skip this step.
In **src/event_object_movement.c** you will need to add a reference to your new palette to sEventObjectSpritePalettes[], the palette requires a unique tag which we will use later.
The existing tags are defined above sEventObjectSpritePalettes[].
-```c
- #define EVENT_OBJ_PAL_TAG_30 0x111F
- #define EVENT_OBJ_PAL_TAG_31 0x1120
- #define EVENT_OBJ_PAL_TAG_32 0x1121
- #define EVENT_OBJ_PAL_TAG_33 0x1122
- #define EVENT_OBJ_PAL_TAG_34 0x1123
-+ #define EVENT_OBJ_PAL_EXAMPLE 0x1124
- #define EVENT_OBJ_PAL_TAG_NONE 0x11FF
+```diff
+ #define OBJ_EVENT_PAL_TAG_30 0x111F
+ #define OBJ_EVENT_PAL_TAG_31 0x1120
+ #define OBJ_EVENT_PAL_TAG_32 0x1121
+ #define OBJ_EVENT_PAL_TAG_33 0x1122
+ #define OBJ_EVENT_PAL_TAG_34 0x1123
++ #define OBJ_EVENT_PAL_EXAMPLE 0x1124
+ #define OBJ_EVENT_PAL_TAG_NONE 0x11FF
```
-```c
-const struct SpritePalette sEventObjectSpritePalettes[] = {
+```diff
+const struct SpritePalette sObjectEventSpritePalettes[] = {
// removed for brevity
- {gEventObjectPalette30, EVENT_OBJ_PAL_TAG_30},
- {gEventObjectPalette31, EVENT_OBJ_PAL_TAG_31},
- {gEventObjectPalette32, EVENT_OBJ_PAL_TAG_32},
- {gEventObjectPalette33, EVENT_OBJ_PAL_TAG_33},
- {gEventObjectPalette34, EVENT_OBJ_PAL_TAG_34},
-+ {gEventObjectPalette_Example, EVENT_OBJ_PAL_EXAMPLE},
+ {gObjectEventPalette30, OBJ_EVENT_PAL_TAG_30},
+ {gObjectEventPalette31, OBJ_EVENT_PAL_TAG_31},
+ {gObjectEventPalette32, OBJ_EVENT_PAL_TAG_32},
+ {gObjectEventPalette33, OBJ_EVENT_PAL_TAG_33},
+ {gObjectEventPalette34, OBJ_EVENT_PAL_TAG_34},
++ {gObjectEventPalette_Example, OBJ_EVENT_PAL_EXAMPLE},
{NULL, 0x0000},
};
```
## 4. Adding a new pic table
-Within **src/data/field_event_obj/event_obj_pic_tables.h** add a new pic table for your overworld.
+Within **src/data/object_events/object_event_pic_tables.h**, add a new pic table for your overworld.
We will be using the macro:
```c
overworld_frame(ptr, width, height, frame)
```
Where the width and height are in tiles rather than pixels. So our new pic table becomes:
```c
-const struct SpriteFrameImage gEventObjectPicTable_Example[] = {
- overworld_frame(gEventObjectPic_Example, 4, 4, 0),
- overworld_frame(gEventObjectPic_Example, 4, 4, 1),
- overworld_frame(gEventObjectPic_Example, 4, 4, 2),
- overworld_frame(gEventObjectPic_Example, 4, 4, 3),
- overworld_frame(gEventObjectPic_Example, 4, 4, 4),
- overworld_frame(gEventObjectPic_Example, 4, 4, 5),
- overworld_frame(gEventObjectPic_Example, 4, 4, 6),
- overworld_frame(gEventObjectPic_Example, 4, 4, 7),
- overworld_frame(gEventObjectPic_Example, 4, 4, 8),
+const struct SpriteFrameImage gObjectEventPicTable_Example[] = {
+ overworld_frame(gObjectEventPic_Example, 4, 4, 0),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 1),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 2),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 3),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 4),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 5),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 6),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 7),
+ overworld_frame(gObjectEventPic_Example, 4, 4, 8),
};
```
-If the frames in your sprite sheet are in a different order to the example shown above then this table will need re-arranging.
-## 5. Adding a new EventObjectGraphicsInfo entry
-Within **src/data/field_event_obj/event_object_graphics_info.h** add a new entry for your overworld.
+If the frames in your sprite sheet are in a different order to the example shown above, then this table will need re-arranging.
+## 5. Adding a new ObjectEventGraphicsInfo entry
+Within **src/data/object_events/object_event_graphics_info.h**, add a new entry for your overworld.
```c
-const struct EventObjectGraphicsInfo gEventObjectGraphicsInfo_Example = {
+const struct ObjectEventGraphicsInfo gEventObjectGraphicsInfo_Example = {
.tileTag = 0xFFFF,
- .paletteTag1 = EVENT_OBJ_PAL_EXAMPLE,
- .paletteTag2 = EVENT_OBJ_PAL_TAG_NONE,
+ .paletteTag1 = OBJ_EVENT_PAL_EXAMPLE,
+ .paletteTag2 = OBJ_EVENT_PAL_TAG_NONE,
.size = 512,
.width = 32,
.height = 32,
@@ -96,10 +96,10 @@ const struct EventObjectGraphicsInfo gEventObjectGraphicsInfo_Example = {
.inanimate = FALSE,
.disableReflectionPaletteLoad = FALSE,
.tracks = TRACKS_FOOT,
- .oam = &gEventObjectBaseOam_32x32,
- .subspriteTables = gEventObjectSpriteOamTables_32x32,
- .anims = gEventObjectImageAnimTable_Standard,
- .images = gEventObjectPicTable_Example,
+ .oam = &gObjectEventBaseOam_32x32,
+ .subspriteTables = gObjectEventSpriteOamTables_32x32,
+ .anims = gObjectEventImageAnimTable_Standard,
+ .images = gObjectEventPicTable_Example,
.affineAnims = gDummySpriteAffineAnimTable,
};
```
@@ -109,69 +109,49 @@ const struct EventObjectGraphicsInfo gEventObjectGraphicsInfo_Example = {
- `.size` refers to the size in bytes of 1 frame of your overworld. It can be calculated by multiplying the width by height by bit depth (in this case 32x32x4) to get the size in bits, then divide by 8 to convert it into bytes.
- `.width` is the width in pixels of one frame of your sprite sheet.
- `.height` is the height in pixels of one frame of your sprite sheet.
-- `.paletteSlot`: There are 16 available palette slots, slot 0 is used by the main character you play as, slot 10 is used by special NPCs such as the cable car or invisible keckleon. Note that whilst slot 0 is used by the main character there are duplicate EventObjectGraphicsInfo entries for your rival, which uses slot 10 instead so as not to load the wrong palette when both Brendan and May are on screen.
+- `.paletteSlot`: There are 16 available palette slots. Slot 0 is used by the main character you play as, and slot 10 is used by special NPCs such as the cable car or invisible Kecleon. Note that whilst slot 0 is used by the main character, there are duplicate ObjectEventGraphicsInfo entries for your rival, which uses slot 10 instead so as not to load the wrong palette when both Brendan and May are on screen.
- `.inanimate` If set to TRUE then your overworld won't be animated, used for NPCs such as the dolls or cushions.
-
-- `.tracks` determines what tracks, if any are left when moving through sand or similar tiles.
-- `.oam` The oam tables are located in **src/data/field_event_obj/base_oam.h** and are size dependant.
-- `.subspriteTables` The subsprite tables are located in **src/data/field_event_obj/event_object_subsprites.h** and are size dependant.
-- `.anims` The anim tables are located in **src/data/field_event_obj/event_object_anims.h**. Most NPCs use gEventObjectImageAnimTable_Standard which allows for the walking animation.
+- `.shadowSize` When a movement taken by an NPC creates a shadow (e.g. jumping over a ledge), this determines what shadow sprite will be drawn under it.
+- `.tracks` determines what tracks, if any, are left when moving through sand or similar tiles.
+- `.oam` The oam tables are located in **src/data/object_events/base_oam.h** and are size dependent.
+- `.subspriteTables` The subsprite tables are located in **src/data/object_events/object_event_subsprites.h** and are size dependent.
+- `.anims` The anim tables are located in **src/data/object_events/object_event_anims.h**. Most NPCs use gObjectEventImageAnimTable_Standard, which allows for the walking animation.
- `.images` refers to the pic table we just created.
-- `.affineAnims` allows for effects such as rotation and scale, most overworlds use gDummySpriteAffineAnimTable although Groudon and Kyogre do use such effects.
+- `.affineAnims` allows for effects such as rotation and scale. Most overworlds use gDummySpriteAffineAnimTable, but Groudon and Kyogre do use such effects.
-Next we need to add a pointer to our new EventObjectGraphicsInfo and amend the table of pointers within **src/data/field_event_obj/event_object_graphics_info_pointers.h**
+Next, we need to add a pointer to our new ObjectEventGraphicsInfo and amend the table of pointers within **src/data/object_events/object_event_graphics_info_pointers.h**.
-First add a declaration before the table of pointers; gEventObjectGraphicsInfoPointers[], then add an entry to the table itself.
+First, add a declaration before the table of pointers (gObjectEventGraphicsInfoPointers), then add an entry to the table itself.
```c
-const struct EventObjectGraphicsInfo gEventObjectGraphicsInfo_Example;
+const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Example;
```
-```c
-const struct EventObjectGraphicsInfo *const gEventObjectGraphicsInfoPointers[] = {
+```diff
+const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM_OBJ_EVENT_GFX] = {
// removed for brevity
- &gEventObjectGraphicsInfo_Brandon,
- &gEventObjectGraphicsInfo_RubySapphireBrendan,
- &gEventObjectGraphicsInfo_RubySapphireMay,
- &gEventObjectGraphicsInfo_Lugia,
- &gEventObjectGraphicsInfo_HoOh,
-+ &gEventObjectGraphicsInfo_Example,
+ [OBJ_EVENT_GFX_BRANDON] = &gObjectEventGraphicsInfo_Brandon,
+ [OBJ_EVENT_GFX_LINK_RS_BRENDAN] = &gObjectEventGraphicsInfo_RubySapphireBrendan,
+ [OBJ_EVENT_GFX_LINK_RS_MAY] = &gObjectEventGraphicsInfo_RubySapphireMay,
+ [OBJ_EVENT_GFX_LUGIA] = &gObjectEventGraphicsInfo_Lugia,
+ [OBJ_EVENT_GFX_HOOH] = &gObjectEventGraphicsInfo_HoOh,
++ [OBJ_EVENT_GFX_EXAMPLE] = &gObjectEventGraphicsInfo_Example,
};
```
## 6. Adding a define for your overworld
-Finally we want to add a define for our overworld in **include/constants/event_objects.h** so we can use that as opposed to raw numbers.
-As we've added our overworld to the end of the standard overworld table (i.e before gMauvilleOldManGraphicsInfoPointers[]) we will need to add our define between EVENT_OBJ_GFX_HOOH and EVENT_OBJ_GFX_BARD_2 and update the numbers as necessary.
+Finally, we want to add a define for our overworld in **include/constants/event_objects.h** so we can use that as opposed to raw numbers.
+As we've added our overworld to the end of the standard overworld table (i.e before gMauvilleOldManGraphicsInfoPointers[]), we will need to add our define between OBJ_EVENT_GFX_HOOH and NUM_OBJ_EVENT_GFX and update both of their associated numbers.
```c
Original
-#define EVENT_OBJ_GFX_LUGIA 237
-#define EVENT_OBJ_GFX_HOOH 238
-#define EVENT_OBJ_GFX_BARD_2 239
+#define OBJ_EVENT_GFX_LUGIA 237
+#define OBJ_EVENT_GFX_HOOH 238
-#define EVENT_OBJ_GFX_VAR_0 240
-#define EVENT_OBJ_GFX_VAR_1 241
-#define EVENT_OBJ_GFX_VAR_2 242
-#define EVENT_OBJ_GFX_VAR_3 243
+#define NUM_OBJ_EVENT_GFX 239
```
```c
Updated
-#define EVENT_OBJ_GFX_LUGIA 237
-#define EVENT_OBJ_GFX_HOOH 238
-#define EVENT_OBJ_GFX_EXAMPLE 239
-#define EVENT_OBJ_GFX_BARD_2 240
-
-#define EVENT_OBJ_GFX_VAR_0 241
-#define EVENT_OBJ_GFX_VAR_1 242
-#define EVENT_OBJ_GFX_VAR_2 243
-#define EVENT_OBJ_GFX_VAR_3 244
-```
-Note that by default there is a limit of 256 overworlds (0-255) but this can be expanded with some work. [Here is an example of the limit being raised to an effective limit of 512.](https://github.com/tustin2121/trihard-emerald/commit/e54c965c123848116740ee8335a1bec3223513e6)
+#define OBJ_EVENT_GFX_LUGIA 237
+#define OBJ_EVENT_GFX_HOOH 238
+#define OBJ_EVENT_GFX_EXAMPLE 239
-As our final step we need to update NUM_OBJECT_GRAPHICS_INFO and SPRITE_VAR within **include/event_object_movement.h**.
-```c
-Original
-#define NUM_OBJECT_GRAPHICS_INFO 239
-#define SPRITE_VAR 240
+#define NUM_OBJ_EVENT_GFX 240
```
-```c
-Updated
-#define NUM_OBJECT_GRAPHICS_INFO 240
-#define SPRITE_VAR 241
-``` \ No newline at end of file
+Note that by default, there is a limit of 256 overworlds (0-255), but it can be expanded with some work. [Here is an example of the limit being raised to an effective limit of 512.](https://github.com/tustin2121/trihard-emerald/commit/e54c965c123848116740ee8335a1bec3223513e6) \ No newline at end of file