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

BSP to BS2 conversion problems #1

Closed
supadupaplex opened this issue Jan 30, 2018 · 2 comments
Closed

BSP to BS2 conversion problems #1

supadupaplex opened this issue Jan 30, 2018 · 2 comments

Comments

@supadupaplex
Copy link

supadupaplex commented Jan 30, 2018

Hello, Triang3l. Your map converter is awesome but I have some problems with BSP to BS2 conversion. I don't know if you are aware of those issues, so I would just leave this list here:

  1. Crashes on real PS2 (or red messages in PCSX2 "Program log" console). I found out that most of them are related to NPC movement. On start of first Half-life: Uplink map there are no crashes until Barney starts running to scientist or houndeye behind a door on the left is provoked.

  2. Sometimes NPC's are unable to walk through their scripted path (Barney on anomalous materials entrance is not coming to open tram door, scientist can't walk through retractable bridge in the Blue Shift intro).

  3. I don't know if it is normal, but BS2PC gives this error during conversion of Blue Shift map "ba_power2.bsp".
    image

  4. Texture fethching from some WAD's is broken. BS2PC just crashes during conversion if it tries to get textures from WAD.
    I performed a little investigation. Problem is in "bs2pc_wad.c" file. It starts when "mid" variable has zero value. It causes underflow of "high" variable and then "mid" and "low" are updated with enormous values that derived from "high".
    image

It all ends with this exception.
image

Then I applied this quick hack, it allows to complete map conversion.
image

But there are still some checkerboarded textures in resulting map. Examples:
image
image
image

@supadupaplex
Copy link
Author

Update. I found solution to some of mentioned problems.

  1. Crashes were not related to *.bs2's. They were caused by PC *.nod files.

  2. NPC's still stuck during scripted sequences. Maybe this is related to *.nod files too.

  3. I changed these lines in bs2pc_subdiv.c:

#define BS2PC_MAX_POLY_VERTS 1024
#define BS2PC_MAX_POLY_STRIPS 512

to these:

#define BS2PC_MAX_POLY_VERTS 2048
#define BS2PC_MAX_POLY_STRIPS 1024

This change allowed to complete ba_power2 map conversion.

  1. Checkerboarding problem was resolved with safer *.wad lump iteration in bs2pc_wad.c. I changed these lines:
while (low <= high) {
  mid = low + ((high - low) >> 1);
  difference = BS2PC_CompareTextureNames(lumps[mid].name, name);
  if (difference == 0) {
    lumpInfo = &lumps[mid];
    break;
  }
  if (difference > 0) {
    high = mid - 1;
  }
  else {
    low = mid + 1;
  }
}

to these:

for (int lmp = 0; lmp < wad->lumpCount; lmp++) {
  difference = BS2PC_CompareTextureNames(lumps[lmp].name, name);
  if (difference == 0) {
    lumpInfo = &lumps[lmp];
    break;
  }
}

Result:

2

1

3

@supadupaplex
Copy link
Author

Update. I found solution to *.nod files problem. Issues with NPC's behavior were indeed caused by improper/missing *.nod files and a message "Node graph out of date, rebuilding ..." was a lie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant