Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - bx83

#221
Upload well and truly uploaded.
Comments?
#222
Okay guys - all fixed, as you'll see from the green jacket. I'm in Port Macquarie running off my phone, so it takes like 10 min to send 1 image; soon fixed.
I now have an alpha (then, as more sounds come through, a beta and a demo); most of it's done, but noooot ent*irely*, and it's moving at a snails pace.

But oh yes. It *will* happen.
#223
Well it would be the same games file (same rooms, same objects), but with animations missing till I get them in there.

They are chapters in fact, just that a) I want to release it before the end of time, but b) I haven’t got all the animations and one or two objects from the last room.
#224
So for simplicities sake, can I just have the same game, but 3 different versions; first one starting room 1 and ending with an impassable but at room 10; second one starting room 11 and ending room 20 etc?

So the entire game, compiled 3 different times, with objects missing from the 3 versions which makes it impossible to continue?

But the three games are *exactly the same game*, just with object.visible=false in the first one (and you need the object to continue on to the next part), but then part 2 where it’s object.visible=true, and you can go onward again?

Same game; same variables; different starting room and 1 variable with changed value?
#225
I’m creating 3 game parts, through 3 different exe’s. All share the same code/rooms.
Can you do this with save games? Or through progressive parts + save games? Eg.

Part 1, room 1-10
part 2, rooms 1-20
part 3, rooms 1-30
(As opposed to part 1 rooms 1-10, part 2 room 11-20 etc)

Basically, can you do 3 (progressive) exe’s with a progressive save game; or will the different save games be incompatible within the 3 parts?
#226
Thank you, works perfectly :)
#227
Another problem; soundSource audio plays, for a second, at 100% volume, when re-entering a room.

video:
https://bluekeystudios.com/filez/soundsourceprob.mov

This also happens in the second room I made.
#228
Okay, works now :)

I've changed:

Code: ags
#define SOUND_SOURCE_COUNT 3
SoundSource soundSources[SOUND_SOURCE_COUNT];
void StopSoundSources()
{
	for(int i=0; i<SOUND_SOURCE_COUNT; i++)
		soundSources[i].Stop();
}


...to be at the top of the room script.

This definition code is commented out in globalscript.ash:
Code: ags
import void StopSoundSources();


I didn't bother implementing the ChangePlayerRoom() because this will only be in like 5 rooms.
#229
So put #define SOUND_SOURCE_COUNT 3 in a rooms room_Load()?

I usually run StopSoundSources() before I leave the room, but you're right -- this makes no difference to the sounds, so I think I'll put it in the room code.

How... exactly do I do this? :P I've put both lines in room code, then I get an 'undefined token' (line 4) in this code (also in the room):
Code: ags
function late_repeatedly_execute_always()
{
  for(int i=0; i<SOUND_SOURCE_COUNT; i++)
    soundSources[i].UpdateVolume(player.x, player.y);
}

#230
globalscript.ash:
import bool Init(AudioClip* clip, AudioPriority pri, int x, int y, int radius, int minVolume=0);

globalscript.ash:
void SoundSource::UpdateVolume(int x, int y)
{
   if(this.channel != null)
   {
      int dx = this.x - x;
      int dy = this.y - y;
      int d_squared = dx*dx + dy*dy;

      if(d_squared >= (this.radius * this.radius))
         this.channel.Volume = this.minVolume;
      else
         this.channel.Volume = FloatToInt(100.0 - (Maths.Sqrt(IntToFloat(d_squared))/IntToFloat(this.radius)) * (100.0 - IntToFloat(this.minVolume)));
   }
}

bool SoundSource::Init(AudioClip* clip, AudioPriority pri, int x, int y, int radius, int minVolume)
{
   if(this.channel != null)
      this.channel.Stop();

   this.x = x;
   this.y = y;
   this.radius = radius;
   this.minVolume = minVolume;

   this.channel = clip.Play(pri, eRepeat);
   return this.channel != null;
}

Some errors, now fixed and working beautifully :)
#231
Okay, think I've followed your instructions, but there's an error.

In GlobalScript.asc - error on line 9:
Code: ags
void SoundSource::UpdateVolume(int x, int y)
{
	if(this.channel != null)
	{
		int dx = this.x - x;
		int dy = this.y - y;
		int d_squared = dx*dx + dy*dy;
 
		if(d_squared >= radius*radius)                  <===== Undefined symbol 'radius'
			this.channel.Volume = minVolume;
		else
			this.channel.Volume = FloatToInt(100.0 - (Maths.Sqrt(IntToFloat(d_squared))/IntToFloat(radius)) * (100.0 - IntToFloat(minVolume)));
	}
}
 
bool SoundSource::Init(AudioClip* clip, AudioPriority pri, int x, int y, int radius, int minVolume)
{
	if(this.channel != null)
		this.channel.Stop();
 
	this.x = x;
	thix.y = y;
	this.radius = radius;
	this.minVolume = minVolume;
 
	this.channel = clip.Play(pri, eRepeat);
	return this.channel != null;
}
 
void SoundSource::Stop()
{
	if(this.channel != null)
	 this.channel.Stop();
 
	this.channel = null;
}
		
void StopSoundSources()
{
	for(int i=0; i<SOUND_SOURCE_COUNT; i++)
		soundSources[i].Stop();
}


In GlobalScript.ash:
Code: ags
struct SoundSource
{
	AudioChannel* channel;
	int x;
	int y;
	int radius;
	int minVolume;
 
	import bool Init(AudioClip* clip, AudioPriority pri, int x, int y, int radius, int minVolume);
	import void UpdateVolume(int x, int y);
	import void Stop();
};

#define SOUND_SOURCE_COUNT 3
SoundSource soundSources[SOUND_SOURCE_COUNT];

import function StopSoundSources();


In room code:

Code: ags
function room_Load()
{
  soundSources[0].Init(aFlys2, eAudioPriorityNormal, 415, 610, 50, 2);
  soundSources[1].Init(aMeatMarket_tinnyradio, eAudioPriorityNormal, 1150, 365, 80, 40);
}

function late_repeatedly_execute_always()
{
  for(int i=0; i<SOUND_SOURCE_COUNT; i++)
    soundSources[i].UpdateVolume(player.x, player.y);
}


What to do?
#232
For late_repeatedly_execute_always(), is this in global script, or it can also be used for room?
RomLoadOrWhatever() represents roomLoad() or repex() or some init function in the room?
Man that blows the shit out of my tiny 4 hours of coding :p
#233
SoundPlayer1/2/3 are defined in global scope.
Why would I store the x,y coordinates?
Hopefully soundSample.Play() will not throw null because I know all the sound samples exist. Or did you mean something else?
So keep a global int pointer to soundPlayer1/2/3? Might be simpler to just have 3 separate functions?..
“Factor that out into its own function” - not sure what you mean by this.
#234
I recently made a function which is just like AudioChannel.SetRoomLocation(), but allow you to choose the area in which the sound exists (as opposed to the entire screen, which would only see the volumes go to 0 if you're at the edge of the screen).

My code:

Code: ags
function soundPlayLocation (int x, int y, float r, AudioClip* soundSample, int residual)
{
	float d=0.0;
	int 	p=0;
	int 	sp=0;
	
	if (soundPlayer1==null) {
		sp=1;
		soundPlayer1=soundSample.Play(eAudioPriorityNormal, eRepeat);
	} else {
		if (soundPlayer2==null) {
			sp=2;
			soundPlayer2=soundSample.Play(eAudioPriorityNormal, eRepeat);
		} else {
			if (soundPlayer3==null) {
				sp=3;
				soundPlayer3=soundSample.Play(eAudioPriorityNormal, eRepeat);
			} else {
				Display("more than 3 sound samples.");
				return -1;
			}
		}
	}
	
	float dx = IntToFloat(abs(player.x - x));
	float dy = IntToFloat(abs(player.y - y));
		
	d=Maths.Sqrt((dx * dx) + (dy * dy));
	
	if (d>r) {
		switch (sp) {
			case 1: soundPlayer1.Volume=residual;
			case 2: soundPlayer2.Volume=residual;
			case 3: soundPlayer3.Volume=residual;
		}
	} else {
		p=FloatToInt( 100.0-((d/r)*100.0) );
		if (p<residual) p=residual;
		switch(sp) {
			case 1: soundPlayer1.Volume = p;
			case 2: soundPlayer2.Volume = p;
			case 3: soundPlayer3.Volume = p;
		}
	}	
}


Typical calling code:
Code: ags
soundPlayLocation(415, 610, 50.0, aFlys2, 10);


This focuses on a circle, who's center point is x,y, with a radius of r, and a residual sound so that it will always play no lower than 'residual's volume, even when you're outside the circle.
It works fine; but when it comes to playing more than 1 sample, it doesn't work.

I thought I would make a version with 3 global AudioChannel* variables, and find the newest one and assign soundSample to it, allowing for 3 positions in the room the play from.

However as soon as I load the game, I get this error:
Code: ags
		switch (sp) {
			case 1: soundPlayer1.Volume=residual;  <--THIS LINE - 'null pointer referenced'
			case 2: soundPlayer2.Volume=residual;
			case 3: soundPlayer3.Volume=residual;
		}

...despite the fact that it first loads soundSample into soundPlayer1 at beginning:
Code: ags
if (soundPlayer1==null) {
		sp=1;
		//if (soundPlayer1.PlayingClip!=soundSample)
		soundPlayer1=soundSample.Play(eAudioPriorityNormal, eRepeat);
...


What have I done wrong?
#235
I have a character cEgo. I have him Say() five things. These are represented as EGO1.wav, EGO2.wav, EGO3 etc.

But in the speech folder, I copy in EGO1-50.wav, 50 voice recordings, not 5.

Is there’s only cEgo.Say(“&1 ... &5 in the programme, then do these 5 items get included in speech.vox, or everything in the speech/ directory?
#236
If I include 5 voice samples with Say() In the code, but then copy 500 to Speech/, how many will be compiled into speech.vox?
#237
Alright - code is working :)
Here it is, though no doubt doing some things twice when it only has to do them once:

Code: ags
function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
	ConversationIsOn=true;
	
	
	dialog_left=11;

  info.X = 0;
  info.Y = 672;
  info.Width = 1366;
  info.Height = 96;
	
	MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
  DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
	ds.DrawImage(0, 0, 2639);
	ds.Release();
	
	gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
  gFakeDialogOptions.Visible = true;
}

//----------------------------------------------------------------------------------------------------------------------
// Draw Dialog Options
//----------------------------------------------------------------------------------------------------------------------

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
	int i = 1, ypos = 0, xpos = dialog_left;  
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
			gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
			gFakeDialogOptions.Visible = true;
			
      String str = info.DialogToRender.GetOptionText(i);  //get glyph number from option text
      int cur_img = str.AsInt;                            //current image is that number
      ds.DrawImage(xpos, ypos, cur_img);                  //draw this glyph
      xpos = xpos + 96;																		//xpos+=width of glyph
    }
    i++;
  }
	
	
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Render
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_render(DialogOptionsRenderingInfo* info)
{
  DrawDialogOptions(info.Surface, info);
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{

	gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
  gFakeDialogOptions.Visible = true;
	
	int i = 1, xpos = dialog_left;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (	 mouse.y >= info.Y
					&& mouse.x >= xpos
					&& mouse.x <= xpos+96)
      {
        info.ActiveOptionID = i;
        

        DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
        
				
				DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Mouse Click
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
  if (info.ActiveOptionID > 0)
  {

    DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();

		DrawDialogOptions(ds, info);
    ds.Release();

    gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
    gFakeDialogOptions.Visible = true;
    info.RunActiveOption();
  }
}
#238
I think I've followed your instructions; still doesn't show sprite 2639.


Code: ags
function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
  ConversationIsOn=true;
	
  dialog_left=11;

  info.X = 0;
  info.Y = 672;
  info.Width = 1366;
  info.Height = 96;
	 
  MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
  DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
  ds.DrawImage(0, 672, 2639);
  ds.Release();
}

//----------------------------------------------------------------------------------------------------------------------
// Draw Dialog Options
//----------------------------------------------------------------------------------------------------------------------

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
  int i = 1, ypos = 0, xpos = dialog_left;  
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      String str = info.DialogToRender.GetOptionText(i);  //get glyph number from option text
      int cur_img = str.AsInt;                            //current image is that number
      ds.DrawImage(xpos, ypos, cur_img);                  //draw this glyph
      xpos = xpos + 96;																		//xpos+=width of glyph
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Render
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_render(DialogOptionsRenderingInfo* info)
{
  DrawDialogOptions(info.Surface, info);
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{
  int i = 1, xpos = dialog_left;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (	 mouse.y >= info.Y
					&& mouse.x >= xpos
					&& mouse.x <= xpos+96)
      {
        info.ActiveOptionID = i;
        
        //transplanted in from dialogue_options_mouse_click() to get rid of background/old buttons in real time
        DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
	DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Mouse Click
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
  if (info.ActiveOptionID > 0)
  {
    DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
    DrawDialogOptions(ds, info);
    ds.Release();

    gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
    gFakeDialogOptions.Visible = true;
    info.RunActiveOption();
  }
}
#239
Yes - I’m trying to draw the woodpanel graphic above (4th post), and then the option icons on top of that.
#240
Okay I've tried this:

Code: ags
function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
	ConversationIsOn=true;
	
	// Create a 1366x96 dialog options area at (0,704)
	dialog_left=11;

  info.X = 0;
  info.Y = 672;
  info.Width = 1366;
  info.Height = 96;
}

//----------------------------------------------------------------------------------------------------------------------
// Draw Dialog Options
//----------------------------------------------------------------------------------------------------------------------

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
	ds.DrawImage(0, 672, 2639);
	
	int i = 1, ypos = 0, xpos = dialog_left;  
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      String str = info.DialogToRender.GetOptionText(i);  //get glyph number from option text
      int cur_img = str.AsInt;                            //current image is that number
      ds.DrawImage(xpos, ypos, cur_img);                  //draw this glyph
      xpos = xpos + 96;																		//xpos+=width of glyph
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Render
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_render(DialogOptionsRenderingInfo* info)
{
  DrawDialogOptions(info.Surface, info);
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{
	MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
  DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
	ds.DrawImage(0, 672, 2639);
	
	int i = 1, xpos = dialog_left;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (	 mouse.y >= info.Y
					&& mouse.x >= xpos
					&& mouse.x <= xpos+96)
      {
        info.ActiveOptionID = i;
        
        //transplanted in from dialogue_options_mouse_click() to get rid of background/old buttons in real time
	DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Mouse Click
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
  if (info.ActiveOptionID > 0)
  {
    MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
    DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
    ds.DrawImage(0, 672, 2639);
    DrawDialogOptions(ds, info);
    ds.Release();

    gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
    gFakeDialogOptions.Visible = true;
    info.RunActiveOption();
  }
}


Still doesn't work - doesn't show up sprite 2639 anywhere, at any time, even for an instant. Could you point out the lines which don't have to be there? I'm trying but the stupid is strong in me today.
SMF spam blocked by CleanTalk