diff --git a/include/NE2D.h b/include/NE2D.h index 68c6ad7..0fc8b96 100644 --- a/include/NE2D.h +++ b/include/NE2D.h @@ -140,7 +140,7 @@ void NE_SpriteSystemEnd(void); /// function. /// /// @param sprite Sprite to be drawn. -void NE_SpriteDraw(NE_Sprite *sprite); +void NE_SpriteDraw(const NE_Sprite *sprite); /// Draws all visible sprites. /// @@ -241,7 +241,7 @@ void NE_2DDrawQuadGradient(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, u32 color1, /// @param z Priority. /// @param mat Material to use. void NE_2DDrawTexturedQuad(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat); + const NE_Material *mat); /// Draws a quad with a material at the given coordinates with a flat color. /// @@ -253,7 +253,7 @@ void NE_2DDrawTexturedQuad(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, /// @param mat Material to use. /// @param color Color void NE_2DDrawTexturedQuadColor(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat, u32 color); + const NE_Material *mat, u32 color); /// Draws a quad with a material at the given coordinates with a color gradient. /// @@ -268,8 +268,8 @@ void NE_2DDrawTexturedQuadColor(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, /// @param color3 Lower right color. /// @param color4 Lower left color. void NE_2DDrawTexturedQuadGradient(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat, u32 color1, u32 color2, - u32 color3, u32 color4); + const NE_Material *mat, u32 color1, + u32 color2, u32 color3, u32 color4); /// @} diff --git a/include/NEGUI.h b/include/NEGUI.h index 7ed2f39..69626f9 100644 --- a/include/NEGUI.h +++ b/include/NEGUI.h @@ -186,25 +186,25 @@ void NE_GUISlideBarSetMinMax(NE_GUIObj *sldbr, int min, int max); /// /// @param obj Pointer to the object. /// @return Event. -NE_GUIState NE_GUIObjectGetEvent(NE_GUIObj *obj); +NE_GUIState NE_GUIObjectGetEvent(const NE_GUIObj *obj); /// Gets the value of a check box. /// /// @param chbx Check box. /// @return It returns true if the check box is checked. -bool NE_GUICheckBoxGetValue(NE_GUIObj *chbx); +bool NE_GUICheckBoxGetValue(const NE_GUIObj *chbx); /// Gets the value of a radio button. /// /// @param rdbtn Radio button. /// @return It returns true if the radio button is checked. -bool NE_GUIRadioButtonGetValue(NE_GUIObj *rdbtn); +bool NE_GUIRadioButtonGetValue(const NE_GUIObj *rdbtn); /// Gets the value of a slide bar. /// /// @param sldbr Slide bar. /// @return It returns the value of the slide bar. -int NE_GUISlideBarGetValue(NE_GUIObj *sldbr); +int NE_GUISlideBarGetValue(const NE_GUIObj *sldbr); /// Deletes the given object. /// diff --git a/include/NEModel.h b/include/NEModel.h index 40a81a7..28e33f1 100644 --- a/include/NEModel.h +++ b/include/NEModel.h @@ -121,7 +121,7 @@ void NE_ModelSetAnimationSecondary(NE_Model *model, NE_Animation *anim); /// Draw a model. /// /// @param model Pointer to the model. -void NE_ModelDraw(NE_Model *model); +void NE_ModelDraw(const NE_Model *model); /// Clone model. /// @@ -255,13 +255,13 @@ void NE_ModelAnimSecondarySetSpeed(NE_Model *model, int32_t speed); /// /// @param model Pointer to the model. /// @return Returns the frame in f32 format. -int32_t NE_ModelAnimGetFrame(NE_Model *model); +int32_t NE_ModelAnimGetFrame(const NE_Model *model); /// Returns the current frame of the secondary animation of an animated model. /// /// @param model Pointer to the model. /// @return Returns the frame in f32 format. -int32_t NE_ModelAnimSecondaryGetFrame(NE_Model *model); +int32_t NE_ModelAnimSecondaryGetFrame(const NE_Model *model); /// Sets the current frame of an animated model. /// diff --git a/include/NEPalette.h b/include/NEPalette.h index c2fef87..8d29c76 100644 --- a/include/NEPalette.h +++ b/include/NEPalette.h @@ -55,7 +55,7 @@ void NE_PaletteDelete(NE_Palette *pal); /// Tells the GPU to use the palette in the specified object. /// /// @param pal Pointer to the palette object. -void NE_PaletteUse(NE_Palette *pal); +void NE_PaletteUse(const NE_Palette *pal); /// Resets the palette system and sets the new max number of palettes. /// @@ -96,7 +96,7 @@ void NE_PaletteSystemEnd(void); /// /// @param pal Palette to modify. /// @return Returns a pointer to the base address of the palette in VRAM. -void *NE_PaletteModificationStart(NE_Palette *pal); +void *NE_PaletteModificationStart(const NE_Palette *pal); /// Set the desired entry of a palette to a new color. /// diff --git a/include/NEPhysics.h b/include/NEPhysics.h index 501fff0..ac834dd 100644 --- a/include/NEPhysics.h +++ b/include/NEPhysics.h @@ -210,7 +210,7 @@ void NE_PhysicsOnCollision(NE_Physics *physics, NE_OnCollision action); /// /// @param pointer Pointer to the object. /// @return True if there is a collision, false otherwise. -bool NE_PhysicsIsColliding(NE_Physics *pointer); +bool NE_PhysicsIsColliding(const NE_Physics *pointer); /// Updates all physics objects. void NE_PhysicsUpdateAll(void); @@ -228,7 +228,8 @@ void NE_PhysicsUpdate(NE_Physics *pointer); /// @param pointer1 Pointer to first object. /// @param pointer2 Pointer to second object. /// @return Returns true if two objects are colliding. -bool NE_PhysicsCheckCollision(NE_Physics *pointer1, NE_Physics *pointer2); +bool NE_PhysicsCheckCollision(const NE_Physics *pointer1, + const NE_Physics *pointer2); /// @} diff --git a/include/NEText.h b/include/NEText.h index fec0c82..b0006ae 100644 --- a/include/NEText.h +++ b/include/NEText.h @@ -37,7 +37,7 @@ void NE_TextPriorityReset(void); /// @param mat Font texture. /// @param sizex (sizex, sizey) Size of one character. /// @param sizey (sizex, sizey) Size of one character. -void NE_TextInit(int slot, NE_Material *mat, int sizex, int sizey); +void NE_TextInit(int slot, const NE_Material *mat, int sizex, int sizey); /// Clears the given text font slot. /// diff --git a/include/NETexture.h b/include/NETexture.h index e39499e..c8bbeb4 100644 --- a/include/NETexture.h +++ b/include/NETexture.h @@ -136,7 +136,6 @@ void NE_MaterialTexClone(NE_Material *source, NE_Material *dest); /// @param pal Palette. void NE_MaterialTexSetPal(NE_Material *tex, NE_Palette *pal); - /// Set active material to use when drawing polygons. /// /// If the pointer passed is NULL the function will disable textures and new @@ -144,7 +143,7 @@ void NE_MaterialTexSetPal(NE_Material *tex, NE_Palette *pal); /// a valid material. /// /// @param tex Material to be used. -void NE_MaterialUse(NE_Material *tex); +void NE_MaterialUse(const NE_Material *tex); /// Flags to choose which VRAM banks Nitro Engine can use to allocate textures. typedef enum { @@ -216,7 +215,7 @@ void NE_TextureSystemEnd(void); /// /// @param tex Material. /// @return Returns the size in pixels. -int NE_TextureGetSizeX(NE_Material *tex); +int NE_TextureGetSizeX(const NE_Material *tex); /// Returns the height of a texture. /// @@ -224,7 +223,7 @@ int NE_TextureGetSizeX(NE_Material *tex); /// /// @param tex Material. /// @return Returns the size in pixels. -int NE_TextureGetSizeY(NE_Material *tex); +int NE_TextureGetSizeY(const NE_Material *tex); /// Returns the real width of a texture. /// @@ -233,7 +232,7 @@ int NE_TextureGetSizeY(NE_Material *tex); /// /// @param tex Material. /// @return Returns the size in pixels. -int NE_TextureGetRealSizeX(NE_Material *tex); +int NE_TextureGetRealSizeX(const NE_Material *tex); /// Returns the real height size of a texture. /// @@ -242,7 +241,7 @@ int NE_TextureGetRealSizeX(NE_Material *tex); /// /// @param tex Material. /// @return Returns the size in pixels. -int NE_TextureGetRealSizeY(NE_Material *tex); +int NE_TextureGetRealSizeY(const NE_Material *tex); /// Sets lighting propierties of this material. /// @@ -282,7 +281,7 @@ void NE_MaterialSetDefaultPropierties(u32 diffuse, u32 ambient, u32 specular, /// /// @param tex Texture to modify. /// @return Returns a pointer to the base address of the texture in VRAM. -void *NE_TextureDrawingStart(NE_Material *tex); +void *NE_TextureDrawingStart(const NE_Material *tex); /// Sets the specified pixel to the specified color. /// diff --git a/source/NE2D.c b/source/NE2D.c index 047fc03..bdc1133 100644 --- a/source/NE2D.c +++ b/source/NE2D.c @@ -161,7 +161,7 @@ void NE_SpriteSystemEnd(void) ne_sprite_system_inited = false; } -void NE_SpriteDraw(NE_Sprite *sprite) +void NE_SpriteDraw(const NE_Sprite *sprite) { if (!ne_sprite_system_inited) return; @@ -251,8 +251,8 @@ void NE_SpriteDrawAll(void) // Internal use. See NETexture.c -int __NE_TextureGetRawX(NE_Material *tex); -int __NE_TextureGetRawY(NE_Material *tex); +int __NE_TextureGetRawX(const NE_Material *tex); +int __NE_TextureGetRawY(const NE_Material *tex); //-------------------------------------------- @@ -355,7 +355,7 @@ void NE_2DDrawQuadGradient(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, u32 color1, } void NE_2DDrawTexturedQuad(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat) + const NE_Material *mat) { NE_AssertPointer(mat, "NULL pointer"); NE_Assert(mat->texindex != NE_NO_TEXTURE, "No texture"); @@ -382,7 +382,7 @@ void NE_2DDrawTexturedQuad(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, } void NE_2DDrawTexturedQuadColor(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat, u32 color) + const NE_Material *mat, u32 color) { NE_AssertPointer(mat, "NULL pointer"); NE_Assert(mat->texindex != NE_NO_TEXTURE, "No texture"); @@ -411,8 +411,8 @@ void NE_2DDrawTexturedQuadColor(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, } void NE_2DDrawTexturedQuadGradient(s16 x1, s16 y1, s16 x2, s16 y2, s16 z, - NE_Material *mat, u32 color1, u32 color2, - u32 color3, u32 color4) + const NE_Material *mat, u32 color1, + u32 color2, u32 color3, u32 color4) { NE_AssertPointer(mat, "NULL pointer"); NE_Assert(mat->texindex != NE_NO_TEXTURE, "No texture"); diff --git a/source/NEGUI.c b/source/NEGUI.c index 1778ce8..b306d2a 100644 --- a/source/NEGUI.c +++ b/source/NEGUI.c @@ -912,7 +912,7 @@ void NE_GUISlideBarSetMinMax(NE_GUIObj *sldbr, int min, int max) slidebar->x1 + (slidebar->y2 - slidebar->y1); } -NE_GUIState NE_GUIObjectGetEvent(NE_GUIObj *obj) +NE_GUIState NE_GUIObjectGetEvent(const NE_GUIObj *obj) { ne_slidebar_t *ptr; @@ -935,21 +935,21 @@ NE_GUIState NE_GUIObjectGetEvent(NE_GUIObj *obj) } } -bool NE_GUICheckBoxGetValue(NE_GUIObj *chbx) +bool NE_GUICheckBoxGetValue(const NE_GUIObj *chbx) { NE_AssertPointer(chbx, "NULL pointer"); NE_Assert(chbx->type == NE_CheckBox, "Not a check box"); return ((ne_checkbox_t *)(chbx->pointer))->checked; } -bool NE_GUIRadioButtonGetValue(NE_GUIObj *rdbtn) +bool NE_GUIRadioButtonGetValue(const NE_GUIObj *rdbtn) { NE_AssertPointer(rdbtn, "NULL pointer"); NE_Assert(rdbtn->type == NE_RadioButton, "Not a radio button"); return ((ne_radiobutton_t *)(rdbtn->pointer))->checked; } -int NE_GUISlideBarGetValue(NE_GUIObj *sldbr) +int NE_GUISlideBarGetValue(const NE_GUIObj *sldbr) { NE_AssertPointer(sldbr, "NULL pointer"); NE_Assert(sldbr->type == NE_SlideBar, "Not a slide bar"); diff --git a/source/NEModel.c b/source/NEModel.c index 2feb44d..ae39d77 100644 --- a/source/NEModel.c +++ b/source/NEModel.c @@ -176,7 +176,7 @@ void NE_ModelSetAnimationSecondary(NE_Model *model, NE_Animation *anim) // Internal use... see below extern bool NE_TestTouch; -void NE_ModelDraw(NE_Model *model) +void NE_ModelDraw(const NE_Model *model) { NE_AssertPointer(model, "NULL pointer"); if (model->meshdata == NULL) @@ -387,14 +387,14 @@ void NE_ModelAnimSecondarySetSpeed(NE_Model *model, int32_t speed) model->animinfo[1]->speed = speed; } -int32_t NE_ModelAnimGetFrame(NE_Model *model) +int32_t NE_ModelAnimGetFrame(const NE_Model *model) { NE_AssertPointer(model, "NULL pointer"); NE_Assert(model->modeltype == NE_Animated, "Not an animated model"); return model->animinfo[0]->currframe; } -int32_t NE_ModelAnimSecondaryGetFrame(NE_Model *model) +int32_t NE_ModelAnimSecondaryGetFrame(const NE_Model *model) { NE_AssertPointer(model, "NULL pointer"); NE_Assert(model->modeltype == NE_Animated, "Not an animated model"); diff --git a/source/NEPalette.c b/source/NEPalette.c index 2761502..129d2bb 100644 --- a/source/NEPalette.c +++ b/source/NEPalette.c @@ -145,7 +145,7 @@ void NE_PaletteDelete(NE_Palette *pal) NE_DebugPrint("Material not found"); } -void NE_PaletteUse(NE_Palette *pal) +void NE_PaletteUse(const NE_Palette *pal) { NE_AssertPointer(pal, "NULL pointer"); NE_Assert(pal->index != NE_NO_PALETTE, "No asigned palette"); @@ -262,7 +262,7 @@ void NE_PaletteSystemEnd(void) static u16 *palette_adress = NULL; static int palette_format; -void *NE_PaletteModificationStart(NE_Palette *pal) +void *NE_PaletteModificationStart(const NE_Palette *pal) { NE_AssertPointer(pal, "NULL pointer"); NE_Assert(pal->index != NE_NO_PALETTE, "No asigned palette"); diff --git a/source/NEPhysics.c b/source/NEPhysics.c index eaba598..d378064 100644 --- a/source/NEPhysics.c +++ b/source/NEPhysics.c @@ -191,7 +191,7 @@ void NE_PhysicsOnCollision(NE_Physics *physics, NE_OnCollision action) physics->oncollision = action; } -bool NE_PhysicsIsColliding(NE_Physics *pointer) +bool NE_PhysicsIsColliding(const NE_Physics *pointer) { NE_AssertPointer(pointer, "NULL pointer"); return pointer->iscolliding; @@ -405,7 +405,8 @@ void NE_PhysicsUpdate(NE_Physics *pointer) } } -bool NE_PhysicsCheckCollision(NE_Physics *pointer1, NE_Physics *pointer2) +bool NE_PhysicsCheckCollision(const NE_Physics *pointer1, + const NE_Physics *pointer2) { NE_AssertPointer(pointer1, "NULL pointer 1"); NE_AssertPointer(pointer2, "NULL pointer 2"); diff --git a/source/NEText.c b/source/NEText.c index 8c4fa5c..2f152eb 100644 --- a/source/NEText.c +++ b/source/NEText.c @@ -10,7 +10,7 @@ typedef struct { int sizex, sizey; - NE_Material *material; + const NE_Material *material; } ne_textinfo_t; static ne_textinfo_t NE_TextInfo[NE_MAX_TEXT_FONTS]; @@ -27,7 +27,7 @@ void NE_TextPriorityReset(void) NE_TEXT_PRIORITY = 0; } -void NE_TextInit(int slot, NE_Material *mat, int sizex, int sizey) +void NE_TextInit(int slot, const NE_Material *mat, int sizex, int sizey) { NE_AssertMinMax(0, slot, NE_MAX_TEXT_FONTS, "Invalid slot %d", slot); NE_AssertPointer(mat, "NULL pointer"); @@ -73,7 +73,7 @@ static void _ne_texturecuadprint(int xcrd1, int ycrd1, int xcrd2, int ycrd2, GFX_VERTEX_XY = (ycrd1 << 16) | (xcrd2 & 0xFFFF); } -static void _ne_charprint(ne_textinfo_t * textinfo, int xcrd1, int ycrd1, +static void _ne_charprint(const ne_textinfo_t * textinfo, int xcrd1, int ycrd1, char character) { // Texture coords @@ -92,7 +92,7 @@ int NE_TextPrint(int slot, int x, int y, u32 color, const char *text) { NE_AssertMinMax(0, slot, NE_MAX_TEXT_FONTS, "Invalid slot %d", slot); - ne_textinfo_t *textinfo = &NE_TextInfo[slot]; + const ne_textinfo_t *textinfo = &NE_TextInfo[slot]; if (textinfo->material == NULL) return -1; @@ -142,7 +142,7 @@ int NE_TextPrintBox(int slot, int x, int y, int endx, int endy, u32 color, { NE_AssertMinMax(0, slot, NE_MAX_TEXT_FONTS, "Invalid slot %d", slot); - ne_textinfo_t *textinfo = &NE_TextInfo[slot]; + const ne_textinfo_t *textinfo = &NE_TextInfo[slot]; if (textinfo->material == NULL) return -1; @@ -199,7 +199,7 @@ int NE_TextPrintFree(int slot, int x, int y, u32 color, const char *text) { NE_AssertMinMax(0, slot, NE_MAX_TEXT_FONTS, "Invalid slot %d", slot); - ne_textinfo_t *textinfo = &NE_TextInfo[slot]; + const ne_textinfo_t *textinfo = &NE_TextInfo[slot]; if (textinfo->material == NULL) return -1; diff --git a/source/NETexture.c b/source/NETexture.c index 280c814..7dc3939 100644 --- a/source/NETexture.c +++ b/source/NETexture.c @@ -417,7 +417,7 @@ void NE_MaterialTexSetPal(NE_Material *tex, NE_Palette *pal) NE_Texture[tex->texindex].palette = pal; } -void NE_MaterialUse(NE_Material *tex) +void NE_MaterialUse(const NE_Material *tex) { if (tex == NULL) { @@ -653,7 +653,7 @@ void NE_TextureSystemEnd(void) } // Internal use -int __NE_TextureGetRawX(NE_Material *tex) +int __NE_TextureGetRawX(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, @@ -662,35 +662,35 @@ int __NE_TextureGetRawX(NE_Material *tex) } // Internal use -int __NE_TextureGetRawY(NE_Material *tex) +int __NE_TextureGetRawY(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material"); return (NE_Texture[tex->texindex].param & (0x7 << 23)) >> 23; } -int NE_TextureGetRealSizeX(NE_Material *tex) +int NE_TextureGetRealSizeX(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material"); return 8 << __NE_TextureGetRawX(tex); } -int NE_TextureGetRealSizeY(NE_Material *tex) +int NE_TextureGetRealSizeY(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material"); return 8 << __NE_TextureGetRawY(tex); } -int NE_TextureGetSizeX(NE_Material *tex) +int NE_TextureGetSizeX(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material"); return NE_Texture[tex->texindex].sizex; } -int NE_TextureGetSizeY(NE_Material *tex) +int NE_TextureGetSizeY(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material"); @@ -732,7 +732,7 @@ static int drawingtexture_type; static int drawingtexture_realx; static u32 ne_vram_saved; -void *NE_TextureDrawingStart(NE_Material *tex) +void *NE_TextureDrawingStart(const NE_Material *tex) { NE_AssertPointer(tex, "NULL pointer"); NE_Assert(tex->texindex != NE_NO_TEXTURE, "No texture asigned to material");