The Dink Network

Reply to Re: Help me Revise the DinkC reference.

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
August 4th 2021, 11:05 PM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
====================
**FUNCTIONS (A - C)**
====================

Below is all the current changes/additions I've made to functions. I'm going through them from A - Z in order and will be posting what I add/change as I go. If a fucntion isn't listed, it didn't need changing.

Function: busy()
Addition: Added an example of one useful purpose of this function (maybe the only useful purpose):
One useful purpose of this function is to check if a sprite is currently saying something when it dies, and if so, kill off the text sprite. This will prevent the bug of the text sprite surviving, and instantly jumping to a different position on the screen.

void die(void)
{
 //if this sprite is saying anything, kill the text sprite
 int &gettext = busy(¤t_sprite);
 if (&gettext > 0)
 {
  sp_active(&gettext, 0);
 }
}


====================
**FUNCTIONS (D - G)**
====================

Function: disable_all_sprites()
Changed: Rewritten and example of how to actually disable all sprites.

`disable_all_sprites()` is supposed to disable all sprites on the current screen but does not work as intended. If this function worked as intended, the equivalent would be setting sp_disabled() to 1 for all sprites.

This functions will disable several sprites, but will leave at least 1 enabled, sometimes more.

Here is a nice work around that will accomplish the true intention of this command, and will disable all sprites instantly.


 //there can be a maximum of 299 actve sprite numbers
 //we'll start at 2 to exlude Dink.
 //If you want to disable Dink as well, change the following line to 'int &getsp = 1;'
 int &getsp = 2;
 int &sprite_exist;
loop:
 //check if a sprite exists with this active sprite number
 &sprite_exist = sp_active(&getsp, -1);
 if (&sprite_exist > 0)
 {
  //this sprite exists - so disable it.
  sp_disabled(&getsp, 1);
 }
 if (&getsp < 299)
 {
  //increment active sprite number '&getsp' and loop.
  &getsp += 1;
  goto loop;
 }


===============================================
===============================================

Function: disable_all_sprites()
Changed: Rewritten and example of how to actually enable all sprites.

`enable_all_sprites()` is supposed to enables all sprites after they have been disabled with disable_all_sprites() or sp_diabled(). This function does not work as intended.

Here is a nice work around that will accomplish the true intention of this command, and will enable all sprites instantly.


 //there can be a maximum of 299 actve sprite numbers
 //check every active sprite number for active sprites and enable them all
 int &getsp = 1;
 int &sprite_exist;
loop:
 //check if a sprite exists with this active sprite number
 &sprite_exist = sp_active(&getsp, -1);
 if (&sprite_exist > 0)
 {
  //this sprite exists - so enable it.
  sp_disabled(&getsp, 0);
 }
 if (&getsp < 299)
 {
  //increment active sprite number '&getsp' and loop.
  &getsp += 1;
  goto loop;
 }


===============================================
===============================================

Function: external()
Addition: Added warning for external bug

Calling a procedure with `external()` can randomly cause the calling script to continue past `}` and into code afterwards. In some cases it may even continue past a `return;`. A solution to this is using `goto` at the end of the calling procedure, and jump to the end of the script.`

===============================================
===============================================

Function: fade_up()
Addition: FreeDink bug of text not visible, and workaround explanation.
[FreeDink, all versions] when the game is in fullscreen mode, or the window is resized in window mode, text will be barely visible. A work around for this is to warp Dink to a screen with no sprites, filled with black tiles, and make Dink invisible using `sp_nodraw()`. Then do `fade_up()` and create your text.

===============================================
===============================================

Function: get_version()
Addition: Note that FreeDink engine version can be returned through Dinkc, and a link to Version Checker.
[i]Note: FreeDink Engine versions are not returned using this function, it will only return `108` (Or `107` if running in 1.07 mode). If you need to get the FreeDink engine version, this can be accomplished through DinkC, check out: Version Checker.