summaryrefslogtreecommitdiff
path: root/src/script/common/c_internal.h
Commit message (Expand)AuthorAge
* Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot2018-06-30
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* Create a filesystem abstraction layer for CSM and only allow accessing files ...red-0012017-06-30
* Push error handler afresh each time lua_pcall is usedKahrl2015-08-27
* Use numeric indices and raw table access with LUA_REGISTRYINDEXKahrl2015-08-27
* SAPI: Track last executed mod and include in error messageskwolekr2015-08-12
* Improve Script CPP API diagnosticskwolekr2015-08-05
* Add proper lua api deprecated handlingsapier2014-04-29
* Handle LuaErrors in Lua -> C++ calls on LuaJITShadowNinja2013-12-18
* Pass a errfunc to lua_pcall to get a tracebackShadowNinja2013-11-15
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* Move scriptapi to separate folder (by sapier)sapier2013-05-25
lc">// This brightness is reserved for sunlight #define LIGHT_SUN 15 #ifndef SERVER /** * \internal * * \warning DO NOT USE this directly; it is here simply so that decode_light() * can be inlined. * * Array size is #LIGHTMAX+1 * * The array is a lookup table to convert the internal representation of light * (brightness) to the display brightness. * */ extern const u8 *light_decode_table; // 0 <= light <= LIGHT_SUN // 0 <= return value <= 255 inline u8 decode_light(u8 light) { // assert(light <= LIGHT_SUN); if (light > LIGHT_SUN) light = LIGHT_SUN; return light_decode_table[light]; } // 0.0 <= light <= 1.0 // 0.0 <= return value <= 1.0 float decode_light_f(float light_f); void set_light_table(float gamma); #endif // ifndef SERVER // 0 <= daylight_factor <= 1000 // 0 <= lightday, lightnight <= LIGHT_SUN // 0 <= return value <= LIGHT_SUN inline u8 blend_light(u32 daylight_factor, u8 lightday, u8 lightnight) { u32 c = 1000; u32 l = ((daylight_factor * lightday + (c - daylight_factor) * lightnight)) / c; if (l > LIGHT_SUN) l = LIGHT_SUN; return l; }