diff --git a/doc/files/castray2d.txt b/doc/files/castray2d.txt index a6b8054..b39c75e 100644 --- a/doc/files/castray2d.txt +++ b/doc/files/castray2d.txt @@ -1,4 +1,10 @@ #title CastRay2D [RCBasic Doc] #header function CastRay2D( from_x, from_y, to_x, to_y ) +Cast a ray and get the closest hit on the ray +Returns 1 if there is a hit and 0 if not + +NOTE: GetRayHit2D is used to read each hit + +#ref GetRayHit3D CastRay3D CastRay3D_All CastRay2D_All GetRayHit2D diff --git a/doc/files/castray2d_all.txt b/doc/files/castray2d_all.txt index b69d7f8..2093841 100644 --- a/doc/files/castray2d_all.txt +++ b/doc/files/castray2d_all.txt @@ -1,4 +1,10 @@ #title CastRay2D_All [RCBasic Doc] #header function CastRay2D_All( from_x, from_y, to_x, to_y ) +Cast a ray and gets all hits on the ray +Returns the number of hits from the ray cast + +NOTE: GetRayHit2D is used to read each hit + +#ref GetRayHit3D CastRay3D CastRay3D_All CastRay2D GetRayHit2D diff --git a/doc/files/castray3d.txt b/doc/files/castray3d.txt index d82a600..77ef899 100644 --- a/doc/files/castray3d.txt +++ b/doc/files/castray3d.txt @@ -1,4 +1,10 @@ #title CastRay3D [RCBasic Doc] #header function CastRay3D( from_x, from_y, from_z, to_x, to_y, to_z ) +Cast a ray and get the closest hit on the ray +Returns 1 if there is a hit and 0 if not + +NOTE: GetRayHit3D is used to read each hit + +#ref GetRayHit3D CastRay3D_All CastRay2D CastRay2D_All GetRayHit2D diff --git a/doc/files/castray3d_all.txt b/doc/files/castray3d_all.txt index e7c5123..3e20f67 100644 --- a/doc/files/castray3d_all.txt +++ b/doc/files/castray3d_all.txt @@ -1,4 +1,10 @@ #title CastRay3D_All [RCBasic Doc] #header function CastRay3D_All( from_x, from_y, from_z, to_x, to_y, to_z ) +Cast a ray and gets all hits on the ray +Returns the number of hits from the ray cast + +NOTE: GetRayHit3D is used to read each hit + +#ref GetRayHit3D CastRay3D CastRay2D CastRay2D_All GetRayHit2D diff --git a/doc/files/getlighttype.html b/doc/files/getlighttype.html index bc32006..ba71148 100644 --- a/doc/files/getlighttype.html +++ b/doc/files/getlighttype.html @@ -22,10 +22,10 @@ LIGHT_TYPE_POINT
  • - LIGHT_TYPE_POINT + LIGHT_TYPE_DIRECTIONAL
  • - LIGHT_TYPE_POINT + LIGHT_TYPE_SPOT

    Related: SetLightType

    diff --git a/doc/files/getrayhit2d.txt b/doc/files/getrayhit2d.txt index 79d18c3..19fae36 100644 --- a/doc/files/getrayhit2d.txt +++ b/doc/files/getrayhit2d.txt @@ -1,4 +1,12 @@ #title GetRayHit2D [RCBasic Doc] #header sub GetRayHit2D( index, ByRef spr_id, ByRef x, ByRef y, ByRef normal_x, ByRef normal_y ) +This function will get the collision point and the normal of a ray hit. +NOTES: +#list ul +#li CastRay2D or CastRay2D_All must be called prior to calling this function +#li spr_id will return -1 if there was not a hit at the specified index +#/list + +#ref GetRayHit3D CastRay3D CastRay3D_All CastRay2D CastRay2D_All diff --git a/doc/files/getrayhit3d.txt b/doc/files/getrayhit3d.txt index 0f911e2..74fc46e 100644 --- a/doc/files/getrayhit3d.txt +++ b/doc/files/getrayhit3d.txt @@ -1,4 +1,12 @@ #title GetRayHit3D [RCBasic Doc] #header sub GetRayHit3D( index, ByRef actor_id, ByRef x, ByRef y, ByRef z, ByRef normal_x, ByRef normal_y, ByRef normal_z ) +This function will get the collision point and the normal of a ray hit. +NOTES: +#list ul +#li CastRay3D or CastRay3D_All must be called prior to calling this function +#li actor_id will return -1 if there was not a hit at the specified index +#/list + +#ref CastRay3D CastRay3D_All CastRay2D CastRay2D_All GetRayHit2D diff --git a/doc/files/setlighttype.html b/doc/files/setlighttype.html index 0dd4c80..6894a19 100644 --- a/doc/files/setlighttype.html +++ b/doc/files/setlighttype.html @@ -19,10 +19,10 @@ LIGHT_TYPE_POINT
  • - LIGHT_TYPE_POINT + LIGHT_TYPE_DIRECTIONAL
  • - LIGHT_TYPE_POINT + LIGHT_TYPE_SPOT

    Related: SetLightType

    diff --git a/rcbasic_runtime/main.cpp b/rcbasic_runtime/main.cpp index 88751bc..d3c69a9 100755 --- a/rcbasic_runtime/main.cpp +++ b/rcbasic_runtime/main.cpp @@ -4448,7 +4448,7 @@ int main(int argc, char * argv[]) if(debug_opt.compare("a")==0) { //rc_intern_dirChange("/home/n00b/Music/rcbasic_v400_linux64/examples/tile_demo"); - rc_intern_dirChange("/home/n00b/Music/Simple 3D Platformer/"); + rc_intern_dirChange("/home/n00b/Music/RCBasic_v400_Linux64/examples/RC3/gfx/beast_demo/"); rc_filename = "main.cbc"; } else diff --git a/rcbasic_runtime/rc_gfx.h b/rcbasic_runtime/rc_gfx.h index 87598cd..b08b482 100644 --- a/rcbasic_runtime/rc_gfx.h +++ b/rcbasic_runtime/rc_gfx.h @@ -2316,6 +2316,13 @@ int rc_loadImageEx(std::string img_file, Uint32 color_key = 0, bool use_color_ke if(img.image == NULL) return -1; + if(color_key == -1) + { + Uint32* img_pixels = (Uint32*)img.image->lock(); + color_key = img_pixels[0]; + img.image->unlock(); + } + if(use_color_key) VideoDriver->makeColorKeyTexture(img.image, irr::video::SColor(color_key), false); @@ -2371,6 +2378,13 @@ int rc_createImageEx(int w, int h, double * pdata, Uint32 colorkey, bool use_col return -1; Uint32 * img_pixels = (Uint32*)image->getData(); + + if( ((w*h) >= 1) && colorkey == -1) + { + colorkey = img_pixels[0]; + } + + for(int i = 0; i < (w*h); i++) { img_pixels[i] = (Uint32)pdata[i]; @@ -2941,6 +2955,12 @@ void rc_setColorKey(int img_id, Uint32 colorkey) if(!rc_imageExists(img_id)) return; + if(colorkey == -1) + { + Uint32* img_pixels = (Uint32*)rc_image[img_id].image->lock(); + colorkey = img_pixels[0]; + rc_image[img_id].image->unlock(); + } VideoDriver->makeColorKeyTexture(rc_image[img_id].image, irr::video::SColor(colorkey)); } diff --git a/rcbasic_runtime/rcbasic_runtime.depend b/rcbasic_runtime/rcbasic_runtime.depend index b0d8d89..48c5d7b 100755 --- a/rcbasic_runtime/rcbasic_runtime.depend +++ b/rcbasic_runtime/rcbasic_runtime.depend @@ -1,5 +1,5 @@ # depslib dependency file v1.0 -1734119283 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp +1734280140 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp "rc_os_defines.h" @@ -33,7 +33,7 @@ "rc_func130_cases.h" -1734207123 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h +1734280140 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h 1734207007 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h @@ -1248,7 +1248,7 @@ 1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h -1733959687 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h +1734280525 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h "SDL.h"