GameMaker/Game Dev Memes

TsukaYuriko

☄️
Forum Staff
Moderator
My OCD is officially triggered because the first line of the first block ends with a closing square bracket instead of a dot, without a blank line to separate them, and the start of each parameter line's explanation text isn't indented so they all align.

The only thing worse than total chaos is chaos amidst order.
 

Alice

Darts addict
Forum Staff
Moderator


(it's not that I dislike tutorials by any means, but right now, I have other announcement I keep looking forward to)
(yes, it's the "new GML open beta" one)
(besides, changes in GML are likely to improve tutorial-worthy solutions as well, and are probably a good topic for several tutorials themselves)
 

Evanski

Raccoon Lord
Forum Staff
Moderator
S

Sam (Deleted User)

Guest
Darn it, you deserve some $$$ for the effort that went into this

(ps i changed it from angry to sad because i don't know whether angry means 'dislike' and i don't want to downvote you)
 

Evanski

Raccoon Lord
Forum Staff
Moderator
I dont get why people hate the vapor wave theme it looks great

Evanski_theme.png
 
Last edited:
S

Sam (Deleted User)

Guest
why won't you show the code!!!
The code was patched, but i was suspicious that it might cause an infinite loop in rare cases.

Here's a better example of what might cause such adrenaline, tho:
C++:
int ret = system(argv[0]); // fork bomb
 
S

Sam (Deleted User)

Guest
When you are so good at making bad code that you are bad at making good code but it still werks.
C++:
static inline void video_thread(video_t ind, wid_t wid) {
  // MPEG-2 vidoe codec + MP2 audio codec + *.MPG = werk!
  HRESULT hr = S_OK;
  CoInitialize(NULL);
  HWND vidwin = NULL;
  RECT rect; long evCode;
  widmap.insert(std::make_pair(ind, wid));
  HWND window = (HWND)stoull(wid, nullptr, 10);
  wstring wstr_fname = widen(vidmap.find(ind)->second);
  hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
  if (SUCCEEDED(hr)) {
    hr = pGraph->RenderFile(wstr_fname.c_str(), NULL);
    if (SUCCEEDED(hr)) {
      hr = CoCreateInstance(CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&pVideoRenderer);
      if (SUCCEEDED(hr)) {
        hr = pGraph->FindFilterByName(L"Video Renderer", &pVideoRenderer);
        if (SUCCEEDED(hr)) {
          hr = pVideoRenderer->QueryInterface(IID_IVMRAspectRatioControl, (void **)&pAspectRatio);
          if (SUCCEEDED(hr)) {
            hr = pAspectRatio->SetAspectRatioMode(VMR_ARMODE_LETTER_BOX);
            if (SUCCEEDED(hr)) {
              hr = pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);
              if (SUCCEEDED(hr)) {
                SetWindowLongPtr(window, GWL_STYLE, GetWindowLongPtr(window, GWL_STYLE) | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
                hr = pVidWin->put_Owner((OAHWND)window);
                if (SUCCEEDED(hr)) {
                  GetClientRect(window, &rect);
                  hr = pVidWin->SetWindowPosition(0, 0, rect.right - rect.left, rect.bottom - rect.top);
                  if (SUCCEEDED(hr)) {
                    hr = pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
                    if (SUCCEEDED(hr)) {
                      hr = pVidWin->SetWindowForeground(OATRUE);
                      if (SUCCEEDED(hr)) {
                        hr = pVidWin->HideCursor(OATRUE);
                        if (SUCCEEDED(hr)) {
                          hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
                          if (SUCCEEDED(hr)) {
                            hr = pVideoRenderer->FindPin(L"VMR Input0", &pin);
                            if (SUCCEEDED(hr)) {
                              hr = pin->QueryInterface(IID_IOverlay, (void **)&pOverlay);
                              if (SUCCEEDED(hr)) {
                                hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
                                if (SUCCEEDED(hr)) {
                                  hr = pOverlay->GetWindowHandle(&vidwin);
                                  if (SUCCEEDED(hr)) {
                                    std::lock_guard<std::mutex> guard1(window_mutex);
                                    cwidmap.insert(std::make_pair(ind, std::to_string((unsigned long long)vidwin)));
                                    std::thread finthread(update_thread, ind);
                                    hr = pControl->Run();
                                    if (SUCCEEDED(hr)) {
                                      while (ShowCursor(false) >= 0);
                                      hr = pEvent->WaitForCompletion(INFINITE, &evCode);
                                      if (SUCCEEDED(hr)) {
                                        hr = pControl->Stop();
                                        if (SUCCEEDED(hr)) {
                                          hr = pVidWin->put_Visible(OAFALSE);
                                          if (SUCCEEDED(hr)) {
                                            pVidWin->put_Owner((OAHWND)NULL);
                                          }
                                        }
                                      }
                                      while (ShowCursor(true) < 0);
                                    }
                                    std::lock_guard<std::mutex> guard2(update_mutex);
                                    updmap[ind] = false;
                                    finthread.join();
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  if (pEvent != NULL) { pEvent->Release(); }
  if (pControl != NULL) { pControl->Release(); }
  if (pVidWin != NULL) { pVidWin->Release(); }
  if (pAspectRatio != NULL) { pAspectRatio->Release(); }
  if (pVideoRenderer != NULL) { pVideoRenderer->Release(); }
  if (pGraph != NULL) { pGraph->Release(); }
  if (pin != NULL) { pin->Release(); }
  CoUninitialize();
}
However, those != NULL checks at the end are probably redundant as I saw no obvious sign of over-releasing going on before I added them.
 
Last edited by a moderator:
Top