summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2022-07-26 16:33:04 +0300
committerjussi2022-07-26 16:33:04 +0300
commit4f54a0a4992358c633e5e3535e2980211028f3a2 (patch)
tree05a52f180c6e200b90811d2ec7baef7a7c2c13a8 /src
parent314d0412a53b8e012ec183c503a69cc32e24ab34 (diff)
downloadreilua-enhanced-4f54a0a4992358c633e5e3535e2980211028f3a2.tar.gz
reilua-enhanced-4f54a0a4992358c633e5e3535e2980211028f3a2.tar.bz2
reilua-enhanced-4f54a0a4992358c633e5e3535e2980211028f3a2.zip
Create material using correct texture source.
Diffstat (limited to 'src')
-rw-r--r--src/core.c2
-rw-r--r--src/models.c8
-rw-r--r--src/textures.c2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index 8e48c0a..d6a6c7f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -331,7 +331,7 @@ int lcoreSetWindowState( lua_State *L ) {
}
/*
-> state = RL_IsWindowState( int flag ) )
+> state = RL_IsWindowState( int flag )
Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... )
diff --git a/src/models.c b/src/models.c
index ef5e493..fc294e0 100644
--- a/src/models.c
+++ b/src/models.c
@@ -1554,7 +1554,13 @@ int lmodelsCreateMaterial( lua_State *L ) {
while ( lua_next( L, t4 ) != 0 ) {
if ( strcmp( "texture", (char*)lua_tostring( L, -2 ) ) == 0 && lua_isnumber( L, -1 ) ) {
- state->materials[i]->maps[map].texture = *state->textures[ lua_tointeger( L, -1 ) ];
+ size_t texId = lua_tointeger( L, -1 );
+
+ if ( !validSourceTexture( texId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ state->materials[i]->maps[map].texture = *texturesGetSourceTexture( texId );
}
else if ( strcmp( "color", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
state->materials[i]->maps[map].color = uluaGetColor( L );
diff --git a/src/textures.c b/src/textures.c
index fe0848b..7cc423a 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1285,7 +1285,7 @@ Get image pixel color at ( x, y ) position
- Success return Color
*/
int ltexturesGetImageColor( lua_State *L ) {
- if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetImageColor( Image image, Vector2 pixelPos )" );
lua_pushboolean( L, false );
return 1;