-
Posts
353 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Articles
Docs
Gallery
Everything posted by Steve_Yorkshire
-
http://i.imgur.com/IHaCprY.jpg
-
Yeah that's I did. I wasn't sure if it was sending the bits as the amount of bits or whether the bits were numbered in order (like an array) with energy being number 5, health numer 6 etc, --- so I did it like the later. I think it doesn't do that though does it? :oops:
-
@Azaezel Just to check, I take it I needed a new bit so my new Energy2 takes position 7 and the total ThreadSequenceBits also updates to 7? That's what I've done it seems to work fine. enum PublicConstants { ThreadSequenceBits = 7,//yorks was 6 is now 7 MaxSequenceIndex = (1 << ThreadSequenceBits) - 1, EnergyLevelBits = 5, Energy2LevelBits = 7,//yorks - added and given the next available bit which is 7 DamageLevelBits = 6, DamageStateBits = 2, //...
-
Yeah looks nice. Now move my threads in blogs over :P edit: Thanks :)
-
Thanks for the explanation. :)
-
Okay, here's a question which I could do with some help... I have duplicated a new energy system for shapebase/player. Works just like the original but I wanted more than one. Do I have to add a new "enum PublicConstants" for this? It seems to work fine whether I do or do not. shapeBase.h class ShapeBase : public GameBase, public ISceneLight { /... public: typedef GameBase Parent; enum PublicConstants { ThreadSequenceBits = 6, MaxSequenceIndex = (1 << ThreadSequenceBits) - 1, EnergyLevelBits = 5, //Energy2LevelBits = 5,//yorks - is it okay to use EnergyLevelBits again? Or give this new value and make ThreadSequenceBits 7? Seems to work either way DamageLevelBits = 6, DamageStateBits = 2, // The thread and image limits should not be changed without // also changing the ShapeBaseMasks enum values declared // further down. MaxSoundThreads = 4, ///< Should be a power of 2 MaxScriptThreads = 4, ///< Should be a power of 2 MaxMountedImages = 4, ///< Should be a power of 2 MaxImageEmitters = 3, NumImageBits = 3, CollisionTimeoutValue = 250 ///< Timeout in ms. }; //...Any explanation welcomed, preferably expressed in an idiot proof manner. ;)
-
A noticed that HealthTextGui had both pulse and a warning colour, whilst HealthBarGui only had pulse. So I fancied changing that. It uses a decimal to determine the value when it will change colour (0.0 - 1.0). I am using 2 seperate energy systems in the video, one linked to weapon energy (new style) - first bar top right and main bar at bottom of screen, and the other one is linked to sprint energy (old style) , 2nd bar at the top right. dQXwYy6uEoQ Engine/T3D/fps/guiHealthBarHud.cpp class GuiHealthBarHud : public GuiControl { //... ColorF mFillColor; ColorF mFrameColor; ColorF mDamageFillColor; ColorF mWarnColor;//yorks new F32 mWarnLevel;//yorks new S32 mPulseRate; F32 mPulseThreshold; //... } //... //In the middle of the console doc class add: ConsoleDocClass( GuiHealthBarHud, //... " warnThreshold = \"0.5\"; // yorks Warning colour\n" //... "@ingroup GuiGame\n" ); GuiHealthBarHud::GuiHealthBarHud() { //... mDamageFillColor.set(0, 1, 0, 1); mWarnColor.set(1, 0, 0, 1);//yorks new mWarnLevel = 0.5f;//yorks new mPulseRate = 0; //... } void GuiHealthBarHud::initPersistFields() { addGroup("Colors"); //... addField("warningColor", TypeColorF, Offset(mWarnColor, GuiHealthBarHud), "Color for the text when Health is low.");//yorks new endGroup("Colors"); addGroup("Pulse"); addField("warnThreshold", TypeF32, Offset(mWarnLevel, GuiHealthBarHud), "The Health level - as a decimal - at which to use the warningColor.");//yorks new addField( "pulseRate", TypeS32, Offset( mPulseRate, GuiHealthBarHud ), "Speed at which the control will pulse." ); addField( "pulseThreshold", TypeF32, Offset( mPulseThreshold, GuiHealthBarHud ), "Health level the control must be under before the control will pulse." ); endGroup("Pulse"); //... } And now you've two choices of code, both of each work. I am including both as I am not sure which is really better. The first works like the original healthBar but calls value twice, the second works more like HealthTextGui using an alias/local var. edit: 18 Feb 2015: after much testing Choice TWO seems to be the better option. Choice ONE: void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect) { /... // Background first if (mShowFill) GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor); /* //yorks out start // Pulse the health fill if it's below the threshold if (mPulseRate != 0) if (mValue < mPulseThreshold) { U32 time = Platform::getVirtualMilliseconds(); F32 alpha = 2.0f * F32(time % mPulseRate) / F32(mPulseRate); mDamageFillColor.alpha = (alpha > 1.0f)? 2.0f - alpha: alpha; } else mDamageFillColor.alpha = 1; */ //yorks out end if (mValue < mWarnLevel)//yorks in start { if (mPulseRate != 0) { U32 time = Platform::getVirtualMilliseconds(); F32 alpha = 2.0f * F32(time % mPulseRate) / F32(mPulseRate); mWarnColor.alpha = (alpha > 1.0f) ? 2.0f - alpha : alpha; } else mWarnColor.alpha = 1; } else mDamageFillColor.alpha = 1;//yorks in end // Render damage fill % RectI rect(updateRect); if(getWidth() > getHeight()) rect.extent.x = (S32)(rect.extent.x * mValue); else { S32 bottomY = rect.point.y + rect.extent.y; rect.extent.y = (S32)(rect.extent.y * mValue); rect.point.y = bottomY - rect.extent.y; }//yorks in end if (mValue < mWarnLevel)//yorks new - second call :/ GFX->getDrawUtil()->drawRectFill(rect, mWarnColor);//yorks new else//yorks new GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor); // Border last if (mShowFrame) GFX->getDrawUtil()->drawRect(updateRect, mFrameColor); } Choice TWO: void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect) { //... // Background first if (mShowFill) GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor); /* // Pulse the health fill if it's below the threshold if (mPulseRate != 0) if (mValue < mPulseThreshold) { U32 time = Platform::getVirtualMilliseconds(); F32 alpha = 2.0f * F32(time % mPulseRate) / F32(mPulseRate); mDamageFillColor.alpha = (alpha > 1.0f)? 2.0f - alpha: alpha; } else mDamageFillColor.alpha = 1; */ ///yorks in start ColorF tColor = mDamageFillColor; // If warning level is exceeded switch to warning color if (mValue < mWarnLevel) { tColor = mWarnColor; // If the pulseRate is set then pulse the text if Health is below the threshold if (mPulseRate != 0 && mValue < mPulseThreshold) { U32 time = Platform::getVirtualMilliseconds(); F32 alpha = 2.0f * F32(time % mPulseRate) / F32(mPulseRate); tColor.alpha = (alpha > 1.0f) ? 2.0f - alpha : alpha; } }//yorks in end // Render damage fill % RectI rect(updateRect); if(getWidth() > getHeight()) rect.extent.x = (S32)(rect.extent.x * mValue); else { S32 bottomY = rect.point.y + rect.extent.y; rect.extent.y = (S32)(rect.extent.y * mValue); rect.point.y = bottomY - rect.extent.y; } //GFX->getDrawUtil()->drawRectFill(rect, mDamageFillColor);//yorks out GFX->getDrawUtil()->drawRectFill(rect, tColor);//yorks in // Border last if (mShowFrame) GFX->getDrawUtil()->drawRect(updateRect, mFrameColor); }
-
@AndyWright Nice to see you've not been stabbed or shot down South. ;)
-
@buckmaster Seems to crash looking for a valid character in gfx/gFont.h. Only happens if there is no ammoAmount to show and thus ammoAmount in scripts/client/client.cs is hidden. And it only crashes if the first weapon on startup is non-ammo. Loading an ammo-wpn first and then switching back and forth between ammo and non-ammo weapons is fine. // Update the Ammo Counter with current ammo, if not any then hide the counter. function clientCmdSetAmmoAmountHud(%amount, %amountInClips) { if (!%amount) AmmoAmount.setVisible(false); else { AmmoAmount.setVisible(true); AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips); } } gfx/gFont.h inline bool GFont::isValidChar(const UTF16 in_charIndex) const { if(mRemapTable[in_charIndex] != -1)//dies here return true; if(mPlatformFont) return mPlatformFont->isValidChar(in_charIndex); return false; } I'll post the full stack - but if I'm honest I just like make gaemz and don't understand what makes them go. ;) > energyWeapon_DEBUG DLL.dll!GFont::isValidChar(const unsigned short in_charIndex) Line 185 C++ energyWeapon_DEBUG DLL.dll!GFont::getStrNWidthPrecise(const unsigned short * str, unsigned int n) Line 486 C++ energyWeapon_DEBUG DLL.dll!GFont::getStrNWidthPrecise(const char * str, unsigned int n) Line 466 C++ energyWeapon_DEBUG DLL.dll!GFont::getStrWidthPrecise(const char * in_pString) Line 419 C++ energyWeapon_DEBUG DLL.dll!GuiControl::renderJustifiedText(Point2I offset, Point2I extent, const char * text) Line 605 C++ energyWeapon_DEBUG DLL.dll!GuiTextCtrl::onRender(Point2I offset, const RectI & updateRect) Line 235 C++ energyWeapon_DEBUG DLL.dll!GuiControl::renderChildControls(Point2I offset, const RectI & updateRect) Line 574 C++ energyWeapon_DEBUG DLL.dll!GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI & updateRect) Line 135 C++ energyWeapon_DEBUG DLL.dll!GuiControl::renderChildControls(Point2I offset, const RectI & updateRect) Line 574 C++ energyWeapon_DEBUG DLL.dll!GuiTSCtrl::onRender(Point2I offset, const RectI & updateRect) Line 471 C++ energyWeapon_DEBUG DLL.dll!GameTSCtrl::onRender(Point2I offset, const RectI & updateRect) Line 179 C++ energyWeapon_DEBUG DLL.dll!GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap) Line 1760 C++ energyWeapon_DEBUG DLL.dll!GuiCanvas::handlePaintEvent(unsigned int did) Line 342 C++ energyWeapon_DEBUG DLL.dll!fastdelegate::FastDelegate1::operator()(unsigned int p1) Line 990 C++ energyWeapon_DEBUG DLL.dll!Signal::trigger(unsigned int a) Line 669 C++ energyWeapon_DEBUG DLL.dll!Journal::Call,unsigned int>(Signal * obj, void (unsigned int) * method, unsigned int a) Line 634 C++ energyWeapon_DEBUG DLL.dll!JournaledSignal::trigger(unsigned int a) Line 81 C++ energyWeapon_DEBUG DLL.dll!GuiCanvas::paint() Line 1522 C++ energyWeapon_DEBUG DLL.dll!fastdelegate::FastDelegate0::operator()() Line 905 C++ energyWeapon_DEBUG DLL.dll!Signal::trigger() Line 651 C++ energyWeapon_DEBUG DLL.dll!Process::processEvents() Line 95 C++ energyWeapon_DEBUG DLL.dll!StandardMainLoop::doMainLoop() Line 610 C++ energyWeapon_DEBUG DLL.dll!torque_enginetick() Line 120 C++ energyWeapon_DEBUG DLL.dll!TorqueMain(int argc, const char * * argv) Line 377 C++ energyWeapon_DEBUG DLL.dll!torque_winmain(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * lpszCmdLine, int __formal) Line 452 C++ energyWeapon_DEBUG.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpszCmdLine, int nCommandShow) Line 95 C++ [External Code] [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
-
Ribbons Projectiles And Objects Resource
Steve_Yorkshire replied to Steve_Yorkshire's topic in Visuals
@8bitprodigy Well volunteered to accept this important assignment yourself! ;) -
http://i.imgur.com/kTvNNTl.jpg
-
@Nils Looks nice! Any video? 8-)
-
@gibby This is how I handle ribbons. http://forums.torque3d.org/viewtopic.php?f=17&t=35&p=216
-
s12zj4WQKa0 90% of the code comes from Tim at MaxGaming for TGE/A, 10% from myself to get it working in Torque3D. http://www.yorkshirerifles.com/downloads/ribbons_Torque3D.zip Make sure you've got ribbon.cpp/h and ribbonNode.cpp/h in T3D/fx and the ribbon shaders basicRibbonShaderP/V.hlsl in shaders/ribbons. ribbons.cs goes in art/datablocks, don't forget to exec it in art/datablocks/datablockExec.cs. ribbons.cs new ShaderData( basicRibbonShader ) { DXVertexShaderFile = "shaders/ribbons/basicRibbonShaderV.hlsl"; DXPixelShaderFile = "shaders/ribbons/basicRibbonShaderP.hlsl"; pixVersion = 2.0; }; //custom material//////////////////////////////////// singleton CustomMaterial( basicRibbonGlow ) { shader = basicRibbonShader; version = 2.0; emissive[0] = true; glow[0] = true; doubleSided = false; translucent = true; BlendOp = AddAlpha; translucentBlendOp = AddAlpha; preload = false;//yorks }; //ribbon data//////////////////////////////////////// datablock RibbonData(basicRibbon) { category = "Misc"; size[0] = 0.8; color[0] = "1.0 0.3 0.0 1.0"; position[0] = 1.0; size[1] = 0; color[1] = "1.0 0 0.0 0.0"; position[1] = 0.0; RibbonLength = 6; fadeAwayStep = 0.25; RibbonMaterial = basicRibbonGlow; }; datablock RibbonData(longRibbon) { size[0] = 0.5; color[0] = "0.6 0.7 0.8 1.0"; position[0] = 1.0; size[1] = 0.25; color[1] = "0.6 0.7 0.8 0.5"; position[1] = 0.5; size[2] = 0; color[2] = "0.6 0.7 0.8 0.0"; position[2] = 0.0; RibbonLength = 40; fadeAwayStep = 0.25; UseFadeOut = true; RibbonMaterial = basicRibbonGlow; }; datablock RibbonData(amberRibbon) { size[0] = 0.2; color[0] = "1.0 0.65 0.1 1.0"; position[0] = 1.0; size[1] = 0; color[1] = "1.0 0.65 0.1 0.0"; position[1] = 0.0; RibbonLength = 30; fadeAwayStep = 0.25; UseFadeOut = true; RibbonMaterial = basicRibbonGlow; }; datablock RibbonData(greenRibbon) { size[0] = 0.2; color[0] = "0.0 1.0 0.0 1.0"; position[0] = 1.0; size[1] = 0; color[1] = "0.0 1.0 0.0 0.0"; position[1] = 0.0; RibbonLength = 30; fadeAwayStep = 0.25; UseFadeOut = true; RibbonMaterial = basicRibbonGlow; }; datablock RibbonNodeData(DefaultRibbonNodeData) { timeMultiple = 1.0; }; function createRibbon(%emitter, %pos) { %r = new RibbonNode() { datablock = DefaultRibbonNodeData; emitter = %emitter; position = %pos; }; if(isObject(MissionCleanup)) MissionCleanup.add(%r); return %r; } scripts/server/weapon.cs weaponImage::onFire function at the end. // Create the projectile object %p = new (%this.projectileType)() { dataBlock = %this.projectile; initialVelocity = %muzzleVelocity; initialPosition = %obj.getMuzzlePoint(%slot); sourceObject = %obj; sourceSlot = %slot; client = %obj.client; sourceClass = %obj.getClassName(); }; MissionCleanup.add(%p); //yorks we now have a projectile so let's attach a ribbon to it %ribbon = createRibbon(longRibbon, %obj.getMuzzlePoint(%slot)); %p.mountObject(%ribbon, 0); } } Next lets add some ribbons to the Cheetah. scripts/server/cheetah.cs, onAdd function // Mount the brake lights %obj.mountObject(%obj.rightBrakeLight, %this.rightBrakeSlot); %obj.mountObject(%obj.leftBrakeLight, %this.leftBrakeSlot); //yorks add ribbons! %ribbon1 = createRibbon(amberRibbon, %obj.getTransform()); %ribbon2 = createRibbon(greenRibbon, %obj.getTransform()); %obj.mountObject(%ribbon1, %this.rightBrakeSlot); %obj.mountObject(%ribbon2, %this.leftBrakeSlot); And make sure we don't get console spam when the vehicle is removed. scripts/server/vehicle.cs VehicleData::onRemove function function VehicleData::onRemove(%this, %obj) { //echo("\c4VehicleData::onRemove("@ %this.getName() @", "@ %obj.getClassName() @")"); // if there are passengers/driver, kick them out for(%i = 0; %i < %obj.getDatablock().numMountPoints; %i++) { if (%obj.getMountNodeObject(%i)) { %passenger = %obj.getMountNodeObject(%i); if(isMethod(%passenger, doDismount))//yorks in %passenger.getDataBlock().doDismount(%passenger, true); else//yorks in %passenger.delete();//yorks in for ribbons etc } } } http://www.yorkshirerifles.com/random/ribbons_cheetah.jpg
-
Found a crash caused by RefreshWeaponHUD not displaying the ammoAmount if a non-ammo weapon is the first one loaded at startup and then the player switches to an ammo-using weapon. No crash if first weapon loaded is an ammo-user. Makes no sense but hey, we're all used to that. :P Fix posted in resource, also suggest fix goes into main repo. function clientCmdRefreshWeaponHUD(%amount, %preview, %ret, %zoomRet, %amountInClips) { if (!%amount) { //AmmoAmount.setVisible(false);//yorks bad! //causes a crash if this weapon is the default and you change to an other weapon AmmoAmount.setText(""); } else { AmmoAmount.setVisible(true); AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips); }
-
Looks like MenuBuilder is getting added on the 2nd time GUI Editor is opened - for reasons unknown to god nor nature. :roll: Also note if you do get to quit before it crashes you get the errors: tools/base/menuBar/menuBuilder.ed.cs (157): Unknown command removeFromMenuBar. Object (4359) MenuBuilder I made a really crappy workaround which really needs a proper fix: /// Called before onSleep when the canvas content is changed function GuiEditCanvas::onDestroyMenu(%this) { if( !isObject( %this.menuBar ) ) return; // Destroy menus while( %this.menuBar.getCount() != 0 ) //%this.menuBar.getObject( 0 ).delete();//yorks out {//yorks in start %menu = %this.menuBar.getObject( 0 ); %canDelete = isMethod(%menu.getClassName(), delete); if(%canDelete) %menu.delete(); else { echo("\c2error removed " @ %menu); %this.menuBar.remove(%menu); } }//yorks in end %this.menuBar.removeFromCanvas(); %this.menuBar.delete(); }
-
Keep getting a crash/lockup in the new 3.6.3. Stock code. Open GUI editor up and then close twice and it all crashes. Note: not an issue in 3.6.2. To reproduce method 1: Start a level, start GUI editor (F10), close it, reopen GUI editor (F10), close it again and crash/lock. The error which loops into eternity. To reproduce method 2: At MainMenu open GUI Editor, close it, open it again and close aghain and crash/lock. To reproduce method 3: Open GUI Editor once, then exit and quit Torque. Lots of errors but T3D will quit before it locks. The error which loops to crash: tools/guiEditor/scripts/guiEditorCanvas.ed.cs (223): Unknown command delete. Object (4479) MenuBuilder The script: tools/guiEditor/scripts/guiEditorCanvas.ed.cs /// Called before onSleep when the canvas content is changed function GuiEditCanvas::onDestroyMenu(%this) { if( !isObject( %this.menuBar ) ) return; // Destroy menus while( %this.menuBar.getCount() != 0 ) %this.menuBar.getObject( 0 ).delete();//yorks - here be dragons! %this.menuBar.removeFromCanvas(); %this.menuBar.delete(); } Suggest: http://media.tumblr.com/1e1d8ecea26aa3ce4e442c713e1e6004/tumblr_inline_mok7jhHaaZ1qz4rgp.png Bonus Suggestion: A dedicated bug forum for checking stuff might be useful.
-
[Done] Hello Kitty Syntax Highlighting
Steve_Yorkshire replied to LukasPJ's topic in Website Feedback
Just testing my signature, TRON says it's broken the forums pastebin.com/L8RgZwfB http://pastebin.com/L8RgZwfB http://www.yorkshirerifles.com One Bloke ... In His Bedroom ... Making Games ... Edit: yep looks broken to me :P -
Courtesy of MangoFusion and Hutch respectively. http://stuff.cuppadev.co.uk/6p758.jpg http://i.imgur.com/j9E4aV9.jpg
-
Post your Torquescript maymays! http://i.imgur.com/TWry0j9.jpg http://www.yorkshirerifles.com/random/kork_chan.jpg http://www.yorkshirerifles.com/random/tard_torquescript.jpg http://www.yorkshirerifles.com/random/torquescript_bestscript.jpg http://i.imgur.com/37cRtTa.jpg http://i.imgur.com/t0JkkF7.jpg http://i.imgur.com/vyFstsa.jpg
-
Camera Orbiting Rotation Issue And Possible Fix
Steve_Yorkshire replied to Steve_Yorkshire's topic in C++
In practice video: raGkoyQPb1w -
I have been digging around in the camera related C++ parts of the engine after noticing a few strange going ons with OrbitMode/OrbitObject. function serverCmdisoCam(%client, %deg) { //mDegToRad(35.264) = 0.615472907 //true isometric //mDegToRad(90) = 1.570796 //true top down echo("\c1isocam " @ %deg); %camera = %client.camera; %control = %client.player; if(%deg < 5) { echo("\c2error: deg < 5 setting to ServerConnection.getControlCameraDefaultFov " @ ServerConnection.getControlCameraDefaultFov()); %deg = ServerConnection.getControlCameraDefaultFov(); } %rad = mDegToRad(%deg); if(!isObject(%control)) echo("\c2error: no control object for client " @ %client); else %camera.setOrbitObject(%control, %rad @ " 0 0", 5.0, 20.0, 20.0, true, "0 -4 2", false); } When orbiting a control object (such as the player) and sending a new server command to change the rotation or distance or offset of the camera, all values update except for rotation which does not change. However when checking what the rotation is with Torquescript it returns the updated rotation even though the camera/screen rotation has clearly not changed. It turns out that in camera.cpp readPacketData does not read position for orbiting because it is inhereted from the object (makes sense) but that it also does not unpack the rotation, meaning that the orbit rotation around the object can only be called once when it is initially set to orbit the object. //line 1146 camera.cpp _setPosition(pos,rot); // Movement in OrbitObjectMode is not input-based - don't reset interpolation if(mMode != OrbitObjectMode) { mDelta.pos = pos; mDelta.posVec.set(0.0f, 0.0f, 0.0f); mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } I cannot see any particular reason for the rotation to be unread, so I propose the following change to add rotation for orbitModes. _setPosition(pos,rot); // Movement in OrbitObjectMode is not input-based - don't reset interpolation if(mMode != OrbitObjectMode) { mDelta.pos = pos; mDelta.posVec.set(0.0f, 0.0f, 0.0f); mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } else//york new { //yorks pass rotation for orbitmode mDelta.rot = rot; mDelta.rotVec.set(0.0f, 0.0f, 0.0f); }//yorks new end Now when %client.setOrbitMode/Object is called via a server command it will update the rotation as well as all the rest of the passed values such as distance and offset.
-
Image Testing http://i.imgur.com/t0JkkF7.jpg
-
Hello Kitty still exists under Control Panel > Board Preferences > My Board Style > K_Kitty REJOICE OH MERE MORTALS! 8-)
