diff options
| author | aura <nw@moneybot.cc> | 2026-03-14 01:12:57 +0100 |
|---|---|---|
| committer | day <day@national.shitposting.agency> | 2026-03-15 19:20:13 +0100 |
| commit | fed4ed30fa727e528aa4ee3fad1b5123e022c6be (patch) | |
| tree | 0053800c66ee101d4119d4ad6362631391e9647a /src | |
| parent | c205cb8ac24c0a34960c41879708e7c25c19a353 (diff) | |
fix textures in 2d render, some bugfix
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/physics/movement.cpp | 2 | ||||
| -rw-r--r-- | src/render/gl_2d.cpp | 2 | ||||
| -rw-r--r-- | src/util/allocator.h | 4 | ||||
| -rw-r--r-- | src/util/string.h | 10 |
4 files changed, 11 insertions, 7 deletions
diff --git a/src/game/physics/movement.cpp b/src/game/physics/movement.cpp index 3979394..094bc81 100644 --- a/src/game/physics/movement.cpp +++ b/src/game/physics/movement.cpp @@ -86,7 +86,7 @@ void gmove_check_velocity() { for( U32 i = 0; i < 3; ++i ) { F32* v = &gmove->pl->velocity[i]; - if( isnan( *v ) ) *v = 0.f; continue; + if( isnan( *v ) ) { *v = 0.f; continue; } if( *v > maxspeed ) *v = maxspeed; if( *v < -maxspeed ) *v = -maxspeed; } diff --git a/src/render/gl_2d.cpp b/src/render/gl_2d.cpp index bc55cae..0b20212 100644 --- a/src/render/gl_2d.cpp +++ b/src/render/gl_2d.cpp @@ -22,7 +22,7 @@ GL_SHADER_PROGRAM* gl_2d_init( GL_DATA* gl, VEC2 screensize, const char* shadern glUniform4fv( ratio_location, 1, &screen_ratio[0] ); I32 samplers_location = glGetUniformLocation( program->id, "g_samplers" ); - glUniform1iv( samplers_location, 255, SAMPLER_INDICES ); + glUniform1iv( samplers_location, gl->shader_texture_limit, SAMPLER_INDICES ); return program; } diff --git a/src/util/allocator.h b/src/util/allocator.h index ff3d3c5..327dfc1 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -76,9 +76,9 @@ struct LIST { size = 0; } - LIST( U32 _size, const T* data ) { + LIST( U32 _size, const T* _data ) { data = (T*)malloc( sizeof( T ) * _size ); - memcpy( data, data, _size * sizeof( T ) ); + memcpy( data, _data, _size * sizeof( T ) ); size = _size; capacity = _size; } diff --git a/src/util/string.h b/src/util/string.h index 04bd9c6..2268a36 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -137,7 +137,7 @@ struct __str : public LIST<CT> { } U8 equals( const CT* rhs ) { - for( U32 i = 0; i < this->size; ++i ) { + for( U32 i = 0; i < this->size + 1; ++i ) { if( !rhs[i] || this->data[i] != rhs[i] ) return 0; } @@ -158,13 +158,15 @@ struct __str : public LIST<CT> { this->data[c] = 0; this->size = c; va_end( args2 ); + + return *this; } __str<CT>& append( const CT* str ) { U32 len; for( len = 0; !!str[len]; ++len ); if( this->size + len > this->capacity ) - this->reserve( this->size * 2 ); + this->reserve( this->size + len + 1 ); memcpy( this->data + this->size, str, len * sizeof(CT) ); this->size += len; @@ -173,7 +175,7 @@ struct __str : public LIST<CT> { } __str<CT>& append( const __str<CT>& str ) { - U32 len = str.len; + U32 len = str.size; if( this->size + len + 1 >= this->capacity ) this->reserve( this->size + len + 1 ); @@ -212,6 +214,8 @@ struct __str : public LIST<CT> { if( found ) return i; } + + return -1; } CT* find( const CT* str ) { |
