Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telephone call not displaying the other persons room #17

Open
WizzardMaker opened this issue Nov 3, 2020 · 6 comments
Open

telephone call not displaying the other persons room #17

WizzardMaker opened this issue Nov 3, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@WizzardMaker
Copy link
Member

When calling someone, the other room is usually displayed. This is no longer the case in the new SDL build

How it's supposed to look like:
image

@WizzardMaker WizzardMaker added the bug Something isn't working label Nov 3, 2020
@dedmen
Copy link

dedmen commented Mar 13, 2022

in SDL_UpperBlit (SDL_surface.c)
after destiantion clip the width is -160 and the height is 440.

Destination rect x is 800, but destination clip is only 640 wide.
Thus is just skips the whole blit.

But, even fixing that doesn't fix it.

@dedmen
Copy link

dedmen commented Mar 13, 2022

Found it.

SDL_SaveBMP(qRoom.RoomBm.pBitmap->GetSurface(), "P:\\oroom.bmp");
SDL_SaveBMP(RoomBm.pBitmap->GetSurface(), "P:\\preblit.bmp");
RoomBm.BlitFrom (qRoom.RoomBm, &SrcRect, Dest);
SDL_SaveBMP(RoomBm.pBitmap->GetSurface(), "P:\\postblit.bmp");

If you dump the rooms. The other room thats blitted in is just black texture. It hasn't been rendered

explorer_2022-03-13_17-30-49

@dedmen
Copy link

dedmen commented Mar 13, 2022

CStdRaum::OnPaint(BOOL bHandyDialog)
I'd assume that bHandyDialog flag for painting is there for a reason.. well it once was maybe

Think is, GameFrame::Invalidate renders only location windows of the players.
So dialog room is never pained.

I just did

          if (Sim.Players.Players[c].DialogWin)
              Sim.Players.Players[c].DialogWin->OnPaint(true);

         w = Sim.Players.Players[c].LocationWin;

in GameFrame::Invalidate, so we paint the dialog room before we render the players room

Well... its something?
devenv_2022-03-13_17-37-18

@dedmen
Copy link

dedmen commented Mar 13, 2022

Can also call qRoom.OnPaint(true) from within CStdRaum::PostPaint, so we render it just before we want to blit it in.

But that doesn't make a difference, character is still missing and the blit artifacts at the bottom.

Ah because it calls CStdRaum::OnPaint, instead of the overrridden CAufsicht::OnPaint()
Cannot call with true :D

So just qRoom.OnPaint();

Bam!
AT_2022-03-13_17-44-46

@dedmen
Copy link

dedmen commented Mar 13, 2022

Oops, wrong direction
AT_2022-03-13_17-55-01

Tada
AT_2022-03-13_18-01-46

Had to turn color key off
Color key seems to be new with SDL2, but that doesn't explain why the other room was not pained.

in CStdRaum::PostPaint()

      CStdRaum &qRoom=*(CStdRaum*)qPlayer.DialogWin;
      SDL_SetColorKey(qRoom.RoomBm.pBitmap->GetSurface(), false, 0);
      qRoom.OnPaint();
      CRect     SrcRect (qRoom.HandyOffset, 0, qRoom.HandyOffset+340, 440);
      XY        Dest (qRoom.TempScreenScroll, 0);

It seems like a very hacky solution though.

@dedmen
Copy link

dedmen commented Mar 13, 2022

Ah I guess CWnd from MFC automatically always paints itself.
So previously all instanciated rooms would've always been painted?

https://docs.microsoft.com/en-us/cpp/mfc/reference/cwnd-class?view=msvc-170#onpaint
Yeah seems like it.

Yes every room called in its constructor

   ShowWindow(SW_SHOW);
   UpdateWindow();

That would paint the room once immediately after its constructed.
And its then a active window, so it would be painted regularly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants