Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

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.

Messages - mRax

Pages: [1] 2 3 4
1
WME sources discussion / Re: Game Vs. Monitor Aspect Ratios
« on: October 08, 2009, 12:09:04 PM »
I thought, that only window-type objects were needed in black bars. And made some progress.

1) Changed viewport in CUIWindow::Display
Code: [Select]
  .
  .
  .
  if(!m_Visible) return S_OK;

#ifdef WME_D3D9
  CBRenderD3D* rend = (CBRenderD3D*)Game->m_Renderer;
  D3DVIEWPORT old_vp;
  if(!m_ClipByScreen)
  {
    rend->m_Device->GetViewport(&old_vp);
    D3DVIEWPORT vp = old_vp;
    vp.X = 0;
    vp.Y = 0;
    vp.Width = rend->m_RealWidth;
    vp.Height = rend->m_RealHeight;
    rend->m_Device->SetViewport(&vp);
  }
#endif
  .
  .
  .
#ifdef WME_D3D9
  if(!m_ClipByScreen)
  {
    rend->m_Device->SetViewport(&old_vp);
  }
#endif
  return S_OK;
}
m_ClipByScreen is new window bool property describing of whether the current window should be clipped by screen rectangle (I mean, ScreenRect = MonitorRect - BlackBars). Default value is TRUE. Also m_ClipByScreen was provided in scripts through ScGetProperty/ScSetProperty.

2) That wasn't enough for inventory box (as well as for response box, I thought). Changed CAdInventoryBox::Display as like as CUIWindow::Display. The conditions were only modified
Code: [Select]
if(m_Window)if(!m_Window->m_ClipByScreen)
3) Changed viewport for mouse cursor
Code: [Select]
HRESULT CBGame::DrawCursor(CBSprite* Cursor)
{
  if(!Cursor) return E_FAIL;
  if(Cursor!=m_LastCursor)
  {
    Cursor->Reset();
    m_LastCursor = Cursor;
  }
#ifdef WME_D3D9
  CBRenderD3D* rend = (CBRenderD3D*)Game->m_Renderer;
  D3DVIEWPORT old_vp;
  rend->m_Device->GetViewport(&old_vp);
  D3DVIEWPORT vp = old_vp;
  vp.X = 0;
  vp.Y = 0;
  vp.Width = rend->m_RealWidth;
  vp.Height = rend->m_RealHeight;
  rend->m_Device->SetViewport(&vp);
#endif
  HRESULT res = Cursor->Draw(m_MousePos.x, m_MousePos.y);
#ifdef WME_D3D9
  rend->m_Device->SetViewport(&old_vp);
#endif
  return res;
}

By the way, do you know, that mouse cursor can be moved under black bars? I think, it's someway strange to have ability to move cursor, while can't see it. Before changing CBGame::DrawCursor I tried
Code: [Select]
Game.LockMouseRect(0, 0, Game.ScreenWidth, Game.ScreenHeight)but it didn't have any effect. I'm not sure, but will not be better replace last part in CBGame::GetMousePos with
Code: [Select]
if(m_MouseLockRect.left != 0 || m_MouseLockRect.right != 0 || m_MouseLockRect.top != 0 || m_MouseLockRect.bottom != 0)
{
  .
  .
  .
}
"||"-version doesn't conflict with Game.LockMouseRect() behavior, but dislike "&&"- one can take parameter 0.

4) In Game object there were provided new properties RealWidth and RealHeight. Scripts were changed a little
Code: [Select]
var Inventory = Game.GetInventoryWindow();
if((Game.RealHeight-Game.ScreenHeight)/2>=Inventory.Height)
{
  Inventory.ClipByScreen = FALSE;
  Inventory.Y = -Inventory.Height;
  Game.InventoryVisible = TRUE;
  Game.LockMouseRect(0, Inventory.Y, Game.ScreenWidth, Game.ScreenHeight);
}else{
  Game.AttachScript("scripts\game_loop.script");
  Game.LockMouseRect(0, 0, Game.ScreenWidth, Game.ScreenHeight);
}
Of course, that's not beginner level, but not bad ability, I suppose.

5) Current problem is in transparency of objects in black bars region: Game.ActiveObject doesn't detect objects out of ScreenRect. For example, if Inventory.Y is equal to -Inventory.Height/2, the window has transparent upper half of itself but active lower half. I have stuck in CBRenderer::GetObjectAt method. And here I pass. I can't understand clearly how m_RectList works with: why/where/when object-candidate for ActiveObject become transparent?

6*) May back buffer size be not (m_RealWidth x m_RealHeight)? (for example, (m_Width+m_DrawOffsetX x m_Height+m_DrawOffsetY)) Would it ever possible?

2
Technical forum / Re: Actor3DX.AlphaColor
« on: October 07, 2009, 08:56:02 AM »
P.S. The goal has been reached.

Here is key steps.

1) In CBRenderD3D::Setup3D method line
Code: [Select]
C3DUtils::SetTextureStageState(m_Device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);was changed to next one
Code: [Select]
C3DUtils::SetTextureStageState(m_Device, 0, D3DTSS_ALPHAOP, D3DTOP_BLENDDIFFUSEALPHA);
2) In CXMesh::Render method before SetMaterial call there were added the block
Code: [Select]
D3DMATERIAL m_Material = Mat->m_Material;
if(m_AlphaColor!=0)
{
  if(D3DCOLGetR(m_AlphaColor)!=0)m_Material.Diffuse.r = m_Material.Diffuse.r*((float)(D3DCOLGetR(m_AlphaColor)))/255.0f;
  if(D3DCOLGetG(m_AlphaColor)!=0)m_Material.Diffuse.g = m_Material.Diffuse.g*((float)(D3DCOLGetG(m_AlphaColor)))/255.0f;
  if(D3DCOLGetB(m_AlphaColor)!=0)m_Material.Diffuse.b = m_Material.Diffuse.b*((float)(D3DCOLGetB(m_AlphaColor)))/255.0f;
  if(D3DCOLGetA(m_AlphaColor)!=0)m_Material.Diffuse.a = m_Material.Diffuse.a*((float)(D3DCOLGetA(m_AlphaColor)))/255.0f;
}

// set material
Rend->m_Device->SetMaterial(&m_Material);//Rend->m_Device->SetMaterial(&Mat->m_Material);

It's working. Although I have intention to use not actor3dx.DrawBackfaces property to cut unnecessary polygons but stencil buffer.

3
WME sources discussion / Re: Game Vs. Monitor Aspect Ratios
« on: September 14, 2009, 09:42:34 AM »
Good timing! :) I also think about that black border. But my possible solution is laid in the sources (export new Game properties RealWidth and RealHeight in CBGame::ScGetProperty with standard ScreenWidth and ScreenHeight, modify CBRenderer::SetScreenViewport method and provide it in CBGame::ScCallMethod as "SetScreenViewport"). Since the border isn't my option only, it'll be interesting to listen to what Mnemonic said.

4
Technical forum / Re: Actor3DX.AlphaColor
« on: September 14, 2009, 08:41:24 AM »
I tried take advantage of material diffuse color. In CXModel::Render after
Code: [Select]
Rend->m_Device->SetRenderState(D3DRS_COLORVERTEX, FALSE);I set
Code: [Select]
Rend->m_Device->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);and in CXMesh::Render before .SetMaterial method set (for testing purposes)
Code: [Select]
Mat->m_Material.Diffuse.a = 0.5f;
Mat->m_Material.Diffuse.r = 0.0f;
Mat->m_Material.Diffuse.g = 1.0f;
Mat->m_Material.Diffuse.b = 0.0f;
The results were successfull partially: all Actor3DX became green (yes!) but not half-transparent (no-o!).

So does somebody have ideas what should be done here more? (this topic must be moved to the childboard about WME sources, I guess)

5
Fixed / About m_DrawOffset*
« on: September 14, 2009, 08:15:33 AM »
Probably those are not bugs, but

1. I suppose, .SetMousePos method must be
Code: [Select]
Stack->CorrectParams(2);
int x = Stack->Pop()->GetInt();
int y = Stack->Pop()->GetInt();
x = max(x, 0); x = min(x, m_Renderer->m_Width);
y = max(y, 0); y = min(y, m_Renderer->m_Height);
POINT p;
p.x = x + m_Renderer->m_DrawOffsetX;
p.y = y + m_Renderer->m_DrawOffsetY;
CBPlatform::ClientToScreen(m_Renderer->m_Window, &p);
CBPlatform::SetCursorPos(p.x, p.y);

Stack->PushNULL();
return S_OK;
instead of
Code: [Select]
Stack->CorrectParams(2);
int x = Stack->Pop()->GetInt();
int y = Stack->Pop()->GetInt();
x = max(x, 0); x = min(x, m_Renderer->m_Width);
y = max(y, 0); y = min(y, m_Renderer->m_Height);
POINT p;
p.x = x; p.y = y;
CBPlatform::ClientToScreen(m_Renderer->m_Window, &p);
CBPlatform::SetCursorPos(p.x, p.y);

Stack->PushNULL();
return S_OK;

2. The same goes to .CreateParticleEmitterBone method. Last one doesn't respect m_DrawOffset* values.

6
Fixed / VAL_BOTTOM failed
« on: August 27, 2009, 01:16:44 PM »
Hello! Vertical text alignment of the label in the window
Code: [Select]
WINDOW
{
  NAME="test_window"
  X=0
  Y=0
  WIDTH=800
  HEIGHT=600
  VISIBLE=TRUE

  STATIC
  {
    NAME="test_static"
    FONT="fonts\outline_green.font"
    TEXT="THIS TEXT MUST BE AT THE BOTTOM!"
    TEXT_ALIGN="center"
    VERTICAL_ALIGN="bottom"
    X=0
    Y=0
    WIDTH=800
    HEIGHT=600
    VISIBLE=TRUE
   
    EDITOR_PROPERTY
    {
      NAME="Selected"
      VALUE="True"
    }
  }
}
will be VAL_CENTER for some reason. Not VAL_BOTTOM. Did I make a mistake somewhere? ???

7
Technical forum / Re: Actor3DX.AlphaColor
« on: July 27, 2009, 08:51:10 AM »
I guess it could override vertex colors or material color

That`s the point! Thanks for idea; maybe I'll try it :)

8
Technical forum / Actor3DX.AlphaColor
« on: July 23, 2009, 09:16:11 AM »
It looks like .AlphaColor property hasn't effect on Actor3DX-type objects. Is there some reason for such thing? ??? (The property worked with Actor2D...)

9
WME sources discussion / Re: Mouse position & maximilized window
« on: February 16, 2009, 10:23:15 AM »
I didn't realize Windows would squish the window on maximize when it's larger than desktop resolution.

For me it was a surprise also :)

By the way there is one moment which disturbs me. Since I didn't use MouseLockRect, I haven't paid attention to NewPos object. Now I'm thinking, that NewPos must be recalculated "back" to original (something like that: NewPos.X = NewPox.X * hWnd_rect.right / Game->m_Renderer->m_RealWidth), when the window is squished. Other way mouse cursor can go somewhere wrong in each frame :-\ (to left top corner?) caused by SetCursorPos... Well, I'm not sure...

10
WME sources discussion / Mouse position & maximilized window
« on: February 13, 2009, 04:05:08 PM »
There is a little interesting bug. When game is in window mode (not fullscreen) and game window is stretched like desktop wallpaper, mouse position is calculated wrong.

For example, there are desktop resolution 1280x800 and game window resolution 1280x1024. When game window is maximilized, then its lower part is inaccessible, because of windows mouse position isn't translated properly to stretched window position. The bottom of mouse position (x,800) translated surely into game as it is (x,800) instead of (x,1024).

Here is possible modification, bold font style is used to show changes. (Well, is it good idea to write about all that in `sources discussion`?  ???)

Quote from: bgame.cpp
void CBGame::GetMousePos(POINT* Pos)
{
   CBPlatform::GetCursorPos(Pos);
   CBPlatform::ScreenToClient(Game->m_Renderer->m_Window, Pos);

   Pos->x -= m_Renderer->m_DrawOffsetX;
   Pos->y -= m_Renderer->m_DrawOffsetY;

   //cursor position modification while window is maximized
   if(Game->m_Renderer->m_Windowed)
   {
      HWND hWnd = Game->m_Renderer->m_Window;
      WINDOWPLACEMENT wndpl;
      if(GetWindowPlacement(hWnd, &wndpl))
         if(wndpl.showCmd == SW_SHOWMAXIMIZED)
         {
            RECT hWnd_rect;
            GetClientRect(hWnd, &hWnd_rect);
            Pos->x *= Game->m_Renderer->m_RealWidth;
            Pos->x /= hWnd_rect.right;
            Pos->y *= Game->m_Renderer->m_RealHeight;
            Pos->y /= hWnd_rect.bottom;
         }
   }


   if(m_MouseLockRect.left != 0 && m_MouseLockRect.right != 0 && m_MouseLockRect.top != 0 && m_MouseLockRect.bottom != 0)
   {
      if(!CBPlatform::PtInRect(&m_MouseLockRect, *Pos))
      {
         Pos->x = max(m_MouseLockRect.left, Pos->x);
         Pos->y = max(m_MouseLockRect.top, Pos->y);

         Pos->x = min(m_MouseLockRect.right, Pos->x);
         Pos->y = min(m_MouseLockRect.bottom, Pos->y);

         POINT NewPos = *Pos;
         CBPlatform::ClientToScreen(Game->m_Renderer->m_Window, &NewPos);
         CBPlatform::SetCursorPos(NewPos.x, NewPos.y);
      }
   }
}

I'm sorry for my English, but guess you're understanding what I'm talking about...

P.S. That stretched window is a great way to make game for several screen resolutions. Meaning 1280x1024 window fits perfectly for all desktop resolutions (1280x1024, 1280x800, 1024x768, 800x600, e.t.c.) of 4:3 monitor. I'm talking about window mode, of course.

11
Technical forum / Several idle-animations
« on: February 13, 2008, 03:43:46 PM »
Hi! I used several "idle" animations in the project. Between two "idle" animations I want to play special "intermediate" animation. It`s not very bad, huh, but after that intermediate animation user can see previous idle just for a moment (or maybe, intermediate animation`s beginning): actor "jumps" quickly between "idles".

This is a piece of code
    var n;
    if(form=="")n="sit";else n="";
    actor.PlayAnimAsync(form+"to"+n);
    form=n;
    actor.IdleAnimName=form+"idle";
    actor.TalkAnimName=form+"talk";
    WaitFor(actor);

12
Technical forum / Alpha-channel in the .tga texture
« on: February 07, 2008, 04:15:54 PM »
Hello! I've just looked for subject in the threads, but finally not found anything. So I'm sorry, I'm going to ask one question :)

Is in WME some texture requirements? I tried to make "half-transparent" actor3d`s glasses (alpha-channel), and not successfull. Those glasses made actor`s piece behind itself is invisible ???

13
Technical forum / Re: Windows and z-order
« on: July 03, 2007, 07:56:11 AM »
I see :) Thanks all of you.

14
Technical forum / Re: Windows and z-order
« on: July 02, 2007, 11:12:32 AM »
IN_GAME = TRUE

Thanks!! Now project is worked properly :D

But can you help me once more time, saying why window .InGame property solves that problem? :o In the documentation I find next information

Quote
InGame -- Specifies whether this is an "in-game" type window (it's always displayed before the inventory window)

and don't see any accordings to window .Focus() method ability ::)

15
Technical forum / Re: Windows and z-order
« on: July 02, 2007, 09:24:54 AM »
Well, I tried it first time, but it didn't worked :-\

So, I modify an original wme 3d demo project to show the trouble (links have been removed). Player can click on the icon to show and hide the full-screen window. After the window with back.png image was clicked, the icon become unaccessable.

Scripts:
  • entities\toolbar\scr\on.script
  • scenes\items\notebook\scr\notebook.script
  • scripts\game_daemon.script

Pages: [1] 2 3 4

Page created in 0.044 seconds with 18 queries.